From b5469d1d6dfc7f03c634566d37af431e47c52a1d Mon Sep 17 00:00:00 2001 From: Daniel Illi Date: Wed, 16 Oct 2024 17:00:07 +0200 Subject: [PATCH] Add spec to validate correct loading of event participation dates. Fixes #135 --- .../event/participations_controller_spec.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spec/controllers/event/participations_controller_spec.rb b/spec/controllers/event/participations_controller_spec.rb index da356173..e3c1b96a 100644 --- a/spec/controllers/event/participations_controller_spec.rb +++ b/spec/controllers/event/participations_controller_spec.rb @@ -52,6 +52,18 @@ expect(assigns(:participations)).to eq [@participant] end + it "shows the correct timestamps on the participation instances" do + created_at = 2.days.ago.change(usec: 0) + updated_at = 1.day.ago.change(usec: 0) + Event::Participation.update_all(created_at:, updated_at:) + + get :index, params: {group_id: group.id, event_id: course.id} + + expect(assigns(:participations)).to eq [@leader, @participant] + expect(assigns(:participations).map(&:created_at)).to eq [created_at, created_at] + expect(assigns(:participations).map(&:updated_at)).to eq [updated_at, updated_at] + end + def create(*roles) roles.map do |role_class| role = Fabricate(:event_role, type: role_class.sti_name)