adds links to login or verification on question answers

This commit is contained in:
Alberto Garcia Cabeza
2017-02-08 13:49:14 +01:00
committed by Javi Martín
parent 4f9ca04a84
commit 54fbae6339
2 changed files with 13 additions and 11 deletions

View File

@@ -17,8 +17,16 @@
class: "button secondary hollow js-question-answer" %> class: "button secondary hollow js-question-answer" %>
<% end %> <% end %>
<% end %> <% end %>
<% elsif !user_signed_in? %>
<% question.question_answers.order(id: :desc).each do |answer| %>
<%= link_to answer.title, new_user_session_path, class: "button secondary hollow" %>
<% end %>
<% elsif !current_user.level_two_or_three_verified? %>
<% question.question_answers.order(id: :desc).each do |answer| %>
<%= link_to answer.title, verification_path, class: "button secondary hollow" %>
<% end %>
<% else %> <% else %>
<% question.question_answers.each do |answer| %> <% question.question_answers.order(id: :desc).each do |answer| %>
<span class="button secondary hollow disabled"><%= answer.title %></span> <span class="button secondary hollow disabled"><%= answer.title %></span>
<% end %> <% end %>
<% end %> <% end %>

View File

@@ -179,12 +179,9 @@ feature 'Polls' do
visit poll_path(poll) visit poll_path(poll)
expect(page).to have_content('Han Solo')
expect(page).to have_content('Chewbacca')
expect(page).to have_content('You must Sign in or Sign up to participate') expect(page).to have_content('You must Sign in or Sign up to participate')
expect(page).to have_link('Han Solo', href: new_user_session_path)
expect(page).not_to have_link('Han Solo') expect(page).to have_link('Chewbacca', href: new_user_session_path)
expect(page).not_to have_link('Chewbacca')
end end
scenario 'Level 1 users' do scenario 'Level 1 users' do
@@ -203,11 +200,8 @@ feature 'Polls' do
expect(page).to have_content('You must verify your account in order to answer') expect(page).to have_content('You must verify your account in order to answer')
expect(page).to have_content('Han Solo') expect(page).to have_link('Han Solo', href: verification_path)
expect(page).to have_content('Chewbacca') expect(page).to have_link('Chewbacca', href: verification_path)
expect(page).not_to have_link('Han Solo')
expect(page).not_to have_link('Chewbacca')
end end
scenario 'Level 2 users in an incoming poll' do scenario 'Level 2 users in an incoming poll' do