Skip to content

Instantly share code, notes, and snippets.

@mikepack
Created March 2, 2011 22:11
Show Gist options
  • Save mikepack/851864 to your computer and use it in GitHub Desktop.
Save mikepack/851864 to your computer and use it in GitHub Desktop.
describe "POST create" do
describe "with valid params" do
it "assigns a newly created attending as @attending" do
Attending.stub(:new).with({'event_id' => 1}) { mock_attending(:save => true) }
post :create, :event_id => 1
assigns(:attending).should be(mock_attending)
end
end
end
Produces:
Failure/Error: post :create, :event_id => 1
<Attending(id: integer, user_id: integer, event_id: integer, created_at: datetime, updated_at: datetime) (class)> received :new with unexpected arguments
expected: ({"event_id"=>1})
got: ({:event_id=>1})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment