On 2011-05-31 1:57 PM, Chris Habgood wrote:
The program works when I run it on the server.
describe FoodsController do
render_views
before(:each) do
Food.delete_all
login_as_admin
Food.stubs(:find).with("1").returns(@food = mock_model(Food,
:save=>false))
end
#describe "stub_model(Food) with a hash of stubs" do
#let(:food) do
# stub_model Food, :id => 5, :food =>{:name => 'brisket'}
#end
describe "GET edit" do
it "should assign the requested food to @food" do
#Food.should_receive(:find).with("1").and_return(@food)
puts @food
get :edit, :id => @food.id <http://food.id>
If this is how you are actually making the 'get :edit' call, you might
try converting your @food.id to a string. When the controller gets the
params, everything is a string, but if you give RSpec an integer, it
will obediently pass it along.
get :edit, :id => @food.id.to_s
I should point out at this point that I have not yet really used the
RSpec 2.x family, so I might be mistaken. But with 1.x, this is the case.
Peace,
Phillip
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users