Skip to content

Instantly share code, notes, and snippets.

@jcwilk
Created March 1, 2011 19:14
Show Gist options
  • Save jcwilk/849691 to your computer and use it in GitHub Desktop.
Save jcwilk/849691 to your computer and use it in GitHub Desktop.
describe FavoritesHelper, ".link_to_like" do
before do
@user = mock_model(User, :get_favorite => nil)
@guide = mock_model(Guide)
helper.stub!(:user_logged_in?).and_return(true)
helper.stub!(:link_to_login).and_return('login')
helper.stub!(:current_user).and_return(@subscriber)
helper.stub!(:render)
end
it "should render that the user has already liked this guide" do
@guide.stub!(:a_method_that_gets_called_that_we_dont_care_about_asserting).and_return('the value it should return to cause this scenario')
@guide.should_receive(:a_method_thats_important_to_get_called_which_should_fail_the_test_if_it_isnt).and_return('appropriate_return_value')
helper.link_to_like(@guide).should match(/Liked/)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment