[rails] expecting <"edit"> but rendering with <"">.

1,535 views
Skip to first unread message

Chris Habgood

unread,
May 24, 2011, 4:25:06 PM5/24/11
to rs...@googlegroups.com
I keep getting "" returned when looking for a template:

describe "edit action" do
       it "edit action should render edit template" do
         Food.stub(:find_by_id).and_return(food)
         response.should render_template(:edit)
       end
     end 

Justin Ko

unread,
May 24, 2011, 8:05:04 PM5/24/11
to rs...@googlegroups.com, rspec-users
_______________________________________________
rspec-users mailing list
rspec...@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

David Chelimsky

unread,
May 24, 2011, 8:11:12 PM5/24/11
to rs...@googlegroups.com, rspec-users

Chris Habgood

unread,
May 24, 2011, 8:10:50 PM5/24/11
to rs...@googlegroups.com, rspec-users
It is already there.

--
You received this message because you are subscribed to the Google Groups "rspec" group.
To post to this group, send email to rs...@googlegroups.com.
To unsubscribe from this group, send email to rspec+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rspec?hl=en.



--
"In matters of style, swim with the current; in matters of principle, stand like a rock." 
Thomas Jefferson

Justin Ko

unread,
May 24, 2011, 8:21:46 PM5/24/11
to rspec-users, rs...@googlegroups.com
And it works as expected in dev mode (using the browser)?

Chris Habgood

unread,
May 24, 2011, 8:38:37 PM5/24/11
to rs...@googlegroups.com, rspec-users
no.

Chris Habgood

unread,
May 24, 2011, 8:39:08 PM5/24/11
to rs...@googlegroups.com, rspec-users
describe FoodsController do
  render_views

   before(:each) do
     Food.delete_all
     login_as_admin
   end
  
   describe "stub_model(Food) with a hash of stubs" do
     let(:food) do
       stub_model Food
     end

  
     describe "edit action" do
       it "edit action should render edit template" do
         #Food.stub(:find_by_id).and_return(food)
         Food.any_instance.stubs(:valid?).returns(true)

Justin Ko

unread,
May 24, 2011, 9:07:46 PM5/24/11
to rspec-users
Looks like you're not invoking the action:

get :edit, :id => ...

Sent from my iPhone
Reply all
Reply to author
Forward
0 new messages