Rename component as now it renders all question answers additional information
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
class Polls::Questions::ReadMoreAnswerComponent < ApplicationComponent
|
||||
class Polls::Questions::ReadMoreComponent < ApplicationComponent
|
||||
with_collection_parameter :question
|
||||
attr_reader :question
|
||||
delegate :wysiwyg, to: :helpers
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
<div id="poll_more_info_answers" class="expanded poll-more-info-answers">
|
||||
<div class="row padding">
|
||||
<%= render Polls::Questions::ReadMoreAnswerComponent.with_collection(@questions) %>
|
||||
<%= render Polls::Questions::ReadMoreComponent.with_collection(@questions) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe Polls::Questions::ReadMoreAnswerComponent do
|
||||
describe Polls::Questions::ReadMoreComponent do
|
||||
include Rails.application.routes.url_helpers
|
||||
let(:poll) { create(:poll) }
|
||||
let(:question) { create(:poll_question, poll: poll, title: "Question title?") }
|
||||
@@ -9,7 +9,7 @@ describe Polls::Questions::ReadMoreAnswerComponent do
|
||||
it "renders question title" do
|
||||
create(:poll_question_answer, question: question, description: "Question answer description")
|
||||
|
||||
render_inline Polls::Questions::ReadMoreAnswerComponent.new(question: question)
|
||||
render_inline Polls::Questions::ReadMoreComponent.new(question: question)
|
||||
|
||||
expect(page).to have_content "Question title?"
|
||||
end
|
||||
@@ -18,7 +18,7 @@ describe Polls::Questions::ReadMoreAnswerComponent do
|
||||
create(:poll_question_answer, title: "Answer A", question: question, given_order: 2)
|
||||
create(:poll_question_answer, title: "Answer B", question: question, given_order: 1)
|
||||
|
||||
render_inline Polls::Questions::ReadMoreAnswerComponent.new(question: question)
|
||||
render_inline Polls::Questions::ReadMoreComponent.new(question: question)
|
||||
|
||||
expect("Answer B").to appear_before("Answer A")
|
||||
end
|
||||
@@ -26,7 +26,7 @@ describe Polls::Questions::ReadMoreAnswerComponent do
|
||||
it "does not render when answers does not have more information" do
|
||||
answer.update!(description: nil)
|
||||
|
||||
render_inline Polls::Questions::ReadMoreAnswerComponent.new(question: question)
|
||||
render_inline Polls::Questions::ReadMoreComponent.new(question: question)
|
||||
|
||||
expect(page).not_to be_rendered
|
||||
end
|
||||
@@ -34,7 +34,7 @@ describe Polls::Questions::ReadMoreAnswerComponent do
|
||||
it "renders answers with videos" do
|
||||
create(:poll_answer_video, answer: answer, title: "Awesome video", url: "youtube.com/watch?v=123")
|
||||
|
||||
render_inline Polls::Questions::ReadMoreAnswerComponent.new(question: question)
|
||||
render_inline Polls::Questions::ReadMoreComponent.new(question: question)
|
||||
|
||||
expect(page).to have_link("Awesome video", href: "youtube.com/watch?v=123")
|
||||
end
|
||||
@@ -42,7 +42,7 @@ describe Polls::Questions::ReadMoreAnswerComponent do
|
||||
it "renders answers with images" do
|
||||
create(:image, imageable: answer, title: "The yes movement")
|
||||
|
||||
render_inline Polls::Questions::ReadMoreAnswerComponent.new(question: question)
|
||||
render_inline Polls::Questions::ReadMoreComponent.new(question: question)
|
||||
|
||||
expect(page).to have_css "img[alt='The yes movement']"
|
||||
end
|
||||
@@ -50,7 +50,7 @@ describe Polls::Questions::ReadMoreAnswerComponent do
|
||||
it "renders answers with documents" do
|
||||
create(:document, documentable: answer, title: "The yes movement")
|
||||
|
||||
render_inline Polls::Questions::ReadMoreAnswerComponent.new(question: question)
|
||||
render_inline Polls::Questions::ReadMoreComponent.new(question: question)
|
||||
|
||||
expect(page).to have_link("The yes movement")
|
||||
end
|
||||
Reference in New Issue
Block a user