Skip to content

Instantly share code, notes, and snippets.

@tomtt
Created May 3, 2009 02:59
Show Gist options
  • Select an option

  • Save tomtt/105808 to your computer and use it in GitHub Desktop.

Select an option

Save tomtt/105808 to your computer and use it in GitHub Desktop.
# comments_controller_spec.rb
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe CommentsController do
describe "create" do
describe "with valid parameters" do
it "should redirect to the enclosing resource page after successful submit when nested in aliased url" do
news_article = Factory.create(:news_article)
post(:create,
:comment => {},
:news_article_id => news_article.to_param)
response.should redirect_to(news_article_path(news_article, { 'comment[body]' => '' }))
end
end
end
end
## Output:
>: spec spec/controllers/comments_controller_spec.rb
Profiling enabled.
F
1)
'CommentsController create with valid parameters should redirect to the enclosing resource page after successful submit when nested in aliased url' FAILED
expected redirect to "/news/title-1-4087", got redirect to "http://test.host/news/title-1-4087?comment%5Bbody%5D=&comment%5Bemail%5D=&comment%5Busername%5D="
./spec/controllers/bla_controller_spec.rb:11:
script/spec:10:
Finished in 0.285887 seconds
1 example, 1 failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment