Files
nairobi/spec/system/polls/questions_spec.rb
Javi Martín 0cec581ec0 Add and apply Capybara/RSpec/HaveSelector rule
This rule was added in rubocop-capybara 2.19.0. We were following it
about 85% of the time.

Now we won't have to check both have_css and have_selector when
searching the code.
2023-11-08 14:18:16 +01:00

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 answers with an image and no description" do
poll = create(:poll)
answer = create(:poll_question_answer, poll: poll, title: "Pedestrian road", description: "")
create(:image, imageable: answer, title: "Trees on both sides of the road")
visit poll_path(poll)
within "#poll_more_info_answers" 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