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
This commit is contained in:
Javi Martín
2023-07-19 21:37:59 +02:00
parent 75d2782061
commit a1439d0790
156 changed files with 1330 additions and 503 deletions

View File

@@ -5,7 +5,9 @@ describe Poll::Shift do
let(:booth) { create(:poll_booth) }
let(:user) { create(:user, username: "Ana", email: "ana@example.com") }
let(:officer) { create(:poll_officer, user: user) }
let(:recount_shift) { build(:poll_shift, booth: booth, officer: officer, date: Date.current, task: :recount_scrutiny) }
let(:recount_shift) do
build(:poll_shift, booth: booth, officer: officer, date: Date.current, task: :recount_scrutiny)
end
describe "validations" do
let(:shift) { build(:poll_shift) }
@@ -37,19 +39,28 @@ describe Poll::Shift do
it "is not valid with same booth, officer, date and task" do
recount_shift.save!
expect(build(:poll_shift, booth: booth, officer: officer, date: Date.current, task: :recount_scrutiny)).not_to be_valid
expect(build(:poll_shift, booth: booth,
officer: officer,
date: Date.current,
task: :recount_scrutiny)).not_to be_valid
end
it "is valid with same booth, officer and date but different task" do
recount_shift.save!
expect(build(:poll_shift, booth: booth, officer: officer, date: Date.current, task: :vote_collection)).to be_valid
expect(build(:poll_shift, booth: booth,
officer: officer,
date: Date.current,
task: :vote_collection)).to be_valid
end
it "is valid with same booth, officer and task but different date" do
recount_shift.save!
expect(build(:poll_shift, booth: booth, officer: officer, date: Date.tomorrow, task: :recount_scrutiny)).to be_valid
expect(build(:poll_shift, booth: booth,
officer: officer,
date: Date.tomorrow,
task: :recount_scrutiny)).to be_valid
end
end
@@ -58,7 +69,9 @@ describe Poll::Shift do
booth_assignment1 = create(:poll_booth_assignment, booth: booth)
booth_assignment2 = create(:poll_booth_assignment, booth: booth)
expect { create(:poll_shift, booth: booth, officer: officer, date: Date.current) }.to change { Poll::OfficerAssignment.all.count }.by(2)
expect do
create(:poll_shift, booth: booth, officer: officer, date: Date.current)
end.to change { Poll::OfficerAssignment.all.count }.by(2)
officer_assignments = Poll::OfficerAssignment.all
oa1 = officer_assignments.first
@@ -74,7 +87,9 @@ describe Poll::Shift do
expect(oa2.booth_assignment).to eq(booth_assignment2)
expect(oa2.final).to be_falsey
create(:poll_officer_assignment, officer: officer, booth_assignment: booth_assignment1, date: Date.tomorrow)
create(:poll_officer_assignment, officer: officer,
booth_assignment: booth_assignment1,
date: Date.tomorrow)
expect { Poll::Shift.last.destroy }.to change { Poll::OfficerAssignment.all.count }.by(-2)
end