Since now poll question answers have been renamed to poll question options, using HTML IDs, classes and data attributes named `answer` was confusing.
27 lines
887 B
Ruby
27 lines
887 B
Ruby
require "rails_helper"
|
|
|
|
describe "Poll Questions" do
|
|
scenario "Lists questions from proposals before regular questions" do
|
|
poll = create(:poll)
|
|
normal_question = create(:poll_question, poll: poll)
|
|
proposal_question = create(:poll_question, proposal: create(:proposal), poll: poll)
|
|
|
|
visit poll_path(poll)
|
|
|
|
expect(proposal_question.title).to appear_before(normal_question.title)
|
|
end
|
|
|
|
scenario "shows options with an image and no description" do
|
|
poll = create(:poll)
|
|
option = create(:poll_question_option, poll: poll, title: "Pedestrian road", description: "")
|
|
create(:image, imageable: option, title: "Trees on both sides of the road")
|
|
|
|
visit poll_path(poll)
|
|
|
|
within "#poll_more_info_options" do
|
|
expect(page).to have_content "Pedestrian road"
|
|
expect(page).to have_css "img[alt='Trees on both sides of the road']"
|
|
end
|
|
end
|
|
end
|