Re: [rspec-users] Stub an AR Model Instance Method

2011-06-18 Thread Karl
33 am, David Chelimsky wrote: > On Jun 9, 2011, at 12:33 PM, Karl wrote: > > > Obviously, I'm missing something very simple, can someone please > > explain how to stub an instance of an AR model method. > > > This does not work: > > @widget = Widget.f

[rspec-users] Stub an AR Model Instance Method

2011-06-11 Thread Karl
Obviously, I'm missing something very simple, can someone please explain how to stub an instance of an AR model method. This does not work: @widget = Widget.first # Widget has an instance method called 'next_seriel_number' @widget.stub(:next_serial_number).and_return(43, nil) I know I could use '

[rspec-users] TypeError: can't convert RSpec::Mocks::Mock to Hash

2011-02-17 Thread Karl
In MoneyOrdersController controller: def create @money_order = current_user.money_orders.build(params[:money_order]) if @money_order.save flash.now[:msg_ok] = "Added money order for: #{number_to_currency(@money_order.amount)}" end respond_with(@money_order) end In MoneyOrdersControlle

[rspec-users] TypeError: can't convert RSpec::Mocks::Mock to Hash

2011-02-16 Thread Karl Smith
# controller def create @money_order = current_user.money_orders.build(params[:money_order]) if @money_order.save @money_orders = current_user.money_orders.staged flash.now[:msg_ok] = "Added money order for: #{number_to_currency(@money_order.amount)}" end respond_with(@money_order)