Files
grecia/spec/system/sdg_management/targets_spec.rb
Javi Martín 1b19e33e55 Add and apply Naming/VariableName rubocop rule
We forgot to use it in one place, and we've found out other institutions
using CONSUL whose developers aren't so familiar with Ruby also break
this rule, so it might be better to add it explicitly.
2021-09-03 11:49:53 +02:00

36 lines
1.1 KiB
Ruby

require "rails_helper"
describe "Targets" do
before do
login_as(create(:administrator).user)
Setting["feature.sdg"] = true
end
describe "Index" do
scenario "Visit the index" do
visit sdg_management_goals_path
click_link "Targets"
expect(page).to have_title "SDG content - Targets"
within("table") { expect(page).to have_content "By 2030, eradicate extreme poverty" }
end
scenario "Show targets grouped by goal and sorted asc by code" do
goal_8 = SDG::Goal[8]
goal_8_target_2 = SDG::Target["8.2"]
goal_8_target_10 = SDG::Target["8.10"]
goal_16 = SDG::Goal[16]
goal_16_target_10 = SDG::Target["16.10"]
goal_16_target_a = SDG::Target["16.A"]
visit sdg_management_targets_path
expect(goal_8.title).to appear_before(goal_8_target_2.title)
expect(goal_8_target_2.title).to appear_before(goal_8_target_10.title)
expect(goal_8_target_10.title).to appear_before(goal_16.title)
expect(goal_16.title).to appear_before(goal_16_target_10.title)
expect(goal_16_target_10.title).to appear_before(goal_16_target_a.title)
end
end
end