Created
March 5, 2012 11:47
-
-
Save rhysforyou/1977977 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe SubjectsController do | |
| context "POST create" do | |
| it "creates a new record and shows it given valid attributes" do | |
| subject_attrs = Factory.attributes_for(:subject) | |
| post :create, subject: subject_attrs | |
| # The following line raises an exception: | |
| # Failure/Error: response.should redirect_to(:action => :show) | |
| # Expected response to be a redirect to <http://test.host/assets?action=show&controller=subjects> but was a redirect to <http://test.host/subjects/1> | |
| response.should redirect_to(action: :show) | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We figured this out when we got a similar error. It turned out our implementation was passing nil for an id in a call to
url_for, which confused the router. The nil was thanks to an oversight when mocking the model for the test.