On Sun, Oct 5, 2008 at 9:26 PM, Greg Hauptmann < [EMAIL PROTECTED]> wrote:
> So overall I'm pondering how to test my "populate_projections" method > in a manner that minimises the amount of dynamically generated > fixtures I have to create (currently I create recurring items & > bank_accounts), and also the reliance on the BankAccount.balance? > method (and it's correct operation). My specific question was about > how to stub out the already existing BankAccount.balance? method using > "any_instance.stubs". > In general, I do something like bank_account = mock_model(BankAccount, :balance => 12) BankAccount.stub!(:find).with(bank_account.id).and_return bank_account Is that what you're talking about? As opposed to bank_account = BankAcount.create! Transaction.create!(:back_account_id => bank_account.id, :amount => 12) Are you asking which one is better, or am I totally off on the wrong track? :) Otherwise, I'd pick the first approach, because it's faster. ///ark
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users