Merge pull request #1403 from consul/polls-questions-author-visible-name

uses Poll::Question#author_visible_name in question/show
This commit is contained in:
Juanjo Bazán
2017-02-07 12:19:59 +01:00
committed by GitHub
2 changed files with 19 additions and 1 deletions

View File

@@ -28,7 +28,12 @@
<strong><%= t('poll_questions.show.author') %></strong>
</span>
<br>
<%= link_to @question.author.name, @question.author %>
<% if @question.author_visible_name.present? %>
<%= @question.author_visible_name %>
<% else %>
<%= link_to @question.author.name, @question.author %>
<% end %>
</p>
<p>

View File

@@ -12,6 +12,19 @@ feature 'Poll Questions' do
expect(proposal_question.title).to appear_before(normal_question.title)
end
scenario 'shows the author visible name instead of a link to the author' do
poll = create(:poll)
question_with_author = create(:poll_question, poll: poll)
question_with_author_visible_name = create(:poll_question, poll: poll, author_visible_name: 'potato')
visit question_path(question_with_author)
expect(page).to have_link(question_with_author.author.name)
visit question_path(question_with_author_visible_name)
expect(page).to_not have_link(question_with_author_visible_name.author.name)
expect(page).to have_content(question_with_author_visible_name.author_visible_name)
end
context 'Answering' do
let(:geozone) { create(:geozone) }
let(:poll) { create(:poll, geozone_restricted: true, geozone_ids: [geozone.id]) }