Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Link appears in the browser, but the test says it's not there
<% if user_signed_in? %>
<% if current_user.id == article.author.id %>
<%= link_to 'Edit article', edit_article_path(article) %>
<% end %>
<% end %>
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
<% 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
You can’t perform that action at this time.