Created
April 6, 2012 04:59
-
-
Save terenceponce/2317054 to your computer and use it in GitHub Desktop.
Link appears in the browser, but the test says it's not there
This file contains 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
<% if user_signed_in? %> | |
<% if current_user.id == article.author.id %> | |
<%= link_to 'Edit article', edit_article_path(article) %> | |
<% end %> | |
<% end %> |
This file contains 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
let(:user) { Fabricate(:user) } | |
before do | |
visit new_user_session_path | |
fill_in 'Email', :with => user.email | |
fill_in 'Password', :with => user.password | |
click_button 'Sign in' | |
end | |
describe 'when user has a self-authored article' do | |
let(:article) { Fabricate(:article, :author_id => user.id) } | |
before { visit articles_path } | |
it { should have_link('Edit article', :href => edit_article_path(article)) } | |
end |
This file contains 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
<% provide(:title, 'Articles') %> | |
<h1>Articles</h1> | |
<% if user_signed_in? %> | |
<%= link_to 'Post article', new_article_path %> | |
<% end %> | |
<%= render @articles %> | |
<%= will_paginate %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment