Full Error:

Failures:

  1) FoodsController should assign the requested food to @food
     Failure/Error: get :edit, :id => @food.id
     ActionView::Template::Error:
       undefined method `model_name' for NilClass:Class
     # ./app/views/foods/_form.html.erb:1:in
`_app_views_foods__form_html_erb__2500079613968748019_2175296860__3835516174707068795'
     # ./app/views/foods/edit.html.erb:3:in
`_app_views_foods_edit_html_erb__1881942591214137850_2175310520__4134993942280106228'
     # ./app/controllers/foods_controller.rb:30:in `edit'
     # ./spec/controllers/foods_controller_spec.rb:21:in `block (2 levels)
in <top (required)>'


On Tue, May 31, 2011 at 13:57, Chris Habgood <chabg...@gmail.com> 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
>             assigns(:food).should be(@food)
>          end
>        end
> end
> On Tue, May 31, 2011 at 13:50, Ken Egervari <ken.egerv...@gmail.com>wrote:
>
>>
>> On Tue, May 31, 2011 at 2:38 PM, Chris Habgood <chabg...@gmail.com>wrote:
>>
>>> Still getting the same error.  ugggh.
>>
>>
>> Truly, you have to give us some more code to help you.
>>
>> _______________________________________________
>> rspec-users mailing list
>> rspec-users@rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users
>>
>
>
>
> --
> *"In matters of style, swim with the current; in matters of principle,
> stand like a rock."
> Thomas Jefferson
> *
>



-- 
*"In matters of style, swim with the current; in matters of principle, stand
like a rock."
Thomas Jefferson
*
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to