Files
nairobi/spec/system/official_positions_spec.rb
Javi Martín a1439d0790 Apply Layout/LineLength rubocop rule
Note we're excluding a few files:

* Configuration files that weren't generated by us
* Migration files that weren't generated by us
* The Gemfile, since it includes an important comment that must be on
  the same line as the gem declaration
* The Budget::Stats class, since the heading statistics are a mess and
  having shorter lines would require a lot of refactoring
2023-08-30 14:46:35 +02:00

62 lines
1.6 KiB
Ruby

require "rails_helper"
describe "Official positions" do
context "Badge" do
let(:user1) do
create(:user, official_level: 1, official_position: "Employee", official_position_badge: true)
end
let(:user2) { create(:user, official_level: 0, official_position: "") }
scenario "Comments" do
proposal = create(:proposal)
comment1 = create(:comment, commentable: proposal, user: user1)
comment2 = create(:comment, commentable: proposal, user: user2)
visit proposal_path(proposal)
expect_badge_for("comment", comment1)
expect_no_badge_for("comment", comment2)
end
context "Debates" do
let!(:debate1) { create(:debate, author: user1) }
let!(:debate2) { create(:debate, author: user2) }
scenario "Index" do
visit debates_path
expect_badge_for("debate", debate1)
expect_no_badge_for("debate", debate2)
end
scenario "Show" do
visit debate_path(debate1)
expect_badge_for("debate", debate1)
visit debate_path(debate2)
expect_no_badge_for("debate", debate2)
end
end
context "Proposals" do
let!(:proposal1) { create(:proposal, author: user1) }
let!(:proposal2) { create(:proposal, author: user2) }
scenario "Index" do
visit proposals_path
expect_badge_for("proposal", proposal1)
expect_no_badge_for("proposal", proposal2)
end
scenario "Show" do
visit proposal_path(proposal1)
expect_badge_for("proposal", proposal1)
visit proposal_path(proposal2)
expect_no_badge_for("proposal", proposal2)
end
end
end
end