Hi there,
I have something like this:
describe StockItemsController do
mock_models :stock_item, :account
describe :post => :create do
expects :current_account, :on => proc { @controller }, :returns =>
account_proc
expects :new, :on => StockItem, :with => { "account_id" =>
account_proc.id }, :returns => stock_item_proc
should_redirect_to { stock_items_url }
end
end
And the controller action:
def create
@stock_item = StockItem.new({ "account_id" =>
current_account.id })
@stock_item.save!
redirect_to stock_items_url
end
I get:
<StockItem(id: integer, account_id: integer) (class)> received :new
with unexpected arguments
expected: ({"account_id"=>
2173769420})
got: ({"account_id"=>1001})
I'm guessing this is something to do with the evaluation of the
account_proc but I'm missing what the exact problem is. Does anyone
have any advice?
Thanks!
--
You received this message because you are subscribed to the Google Groups "Remarkable" group.
To post to this group, send email to
remarka...@googlegroups.com.
To unsubscribe from this group, send email to
remarkable-co...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/remarkable-core?hl=en.