Skip to content

Commit

Permalink
Fix: off days contrast and agent can create RDV collectif (#4924 / #4923
Browse files Browse the repository at this point in the history
)

* Fix: flaky spec agent can create RDV collectif (#4923)

Co-authored-by: Adrien Di Pasquale <[email protected]>
  • Loading branch information
AntoineGirard and adipasquale authored Dec 26, 2024
1 parent 72dceab commit 9a3f37e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/helpers/absences_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module AbsencesHelper
CALENDAR_BACKGROUND_COLOR = "rgba(127, 140, 141, 0.7)".freeze
CALENDAR_BACKGROUND_COLOR = "rgba(52, 57, 58, 0.7)".freeze

def absence_tag(absence)
if absence.expired?
Expand Down
1 change: 1 addition & 0 deletions app/services/off_days.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def self.to_full_calendar_array
start: jour_ferie.beginning_of_day.as_json,
end: jour_ferie.end_of_day.as_json,
backgroundColor: AbsencesHelper::CALENDAR_BACKGROUND_COLOR,
textColor: "white",
}
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"title" => absence.title,
"start" => absence.starts_at.as_json,
"end" => absence.ends_at.as_json,
"backgroundColor" => "rgba(127, 140, 141, 0.7)",
"backgroundColor" => "rgba(52, 57, 58, 0.7)",
"url" => "/admin/organisations/#{organisation.id}/absences/#{absence.id}/edit",
},
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
stub_netsize_ok
travel_to(now)
login_as(agent, scope: :agent)
# Depuis que les jours fériés sont affichés sur la journée complète dans le calendrier,
# cela peut nous empêcher de cliquer sur une plage horaire et générer une flaky.
# On les retire pour ce test
allow(OffDays).to receive(:to_full_calendar_array).and_return([])
visit admin_organisation_agent_agenda_path(organisation, agent)
end

Expand Down
4 changes: 2 additions & 2 deletions spec/services/off_days_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
describe ".to_full_calendar_array" do
it "returns the proper format for full calendar" do
array = described_class.to_full_calendar_array
expect(array[0].keys).to match_array(%i[title start end backgroundColor])
expect(array[0][:backgroundColor]).to eq "rgba(127, 140, 141, 0.7)"
expect(array[0].keys).to match_array(%i[title start end backgroundColor textColor])
expect(array[0][:backgroundColor]).to eq "rgba(52, 57, 58, 0.7)"
end
end
end

0 comments on commit 9a3f37e

Please sign in to comment.