Skip to content

Instantly share code, notes, and snippets.

@thillain
Created September 10, 2011 16:46
Show Gist options
  • Save thillain/1208508 to your computer and use it in GitHub Desktop.
Save thillain/1208508 to your computer and use it in GitHub Desktop.
Show action
require 'spec_helper'
describe "posts/show.html.erb" do
before(:each) do
@post = assign(:post, stub_model(Post,:id=>1,:title => "Test",:description=>'Want to contribute Engines'))
end
it "displays the post title with description" do
render
rendered.should contain("Test")
rendered.should contain("Want to contribute Engines")
end
it "displays the edit link" do
render
rendered.should have_selector('a',:href=>edit_post_path(@post.id),:content => 'Edit')
end
it "displays the back link to list the post" do
render
rendered.should have_selector('a',:content=>'Back',:href=>posts_path)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment