Skip to content

Commit

Permalink
Merge pull request #17391 from opf/fix/template-completed-spec
Browse files Browse the repository at this point in the history
Update spec to always use future time
  • Loading branch information
mrmir authored Dec 6, 2024
2 parents 9fe2a2f + 225a947 commit dff8e6f
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,17 @@
post template_completed_recurring_meeting_path(recurring_meeting)
end

subject do
Timecop.freeze("2024-12-04T10:00:00Z".to_datetime) { request }
end

before do
login_as(current_user)
end

context "when first occurrence is not existing" do
it "instantiates the first occurrence from template" do
expect { request }.to change(recurring_meeting.scheduled_meetings, :count).by(1)
expect { subject }.to change(recurring_meeting.scheduled_meetings, :count).by(1)
expect(response).to be_redirect

expect(recurring_meeting.scheduled_meetings.count).to eq(1)
Expand All @@ -81,7 +85,7 @@
end

it "does not create a new meeting" do
expect { request }.not_to change(recurring_meeting.scheduled_meetings, :count)
expect { subject }.not_to change(recurring_meeting.scheduled_meetings, :count)
expect(response).to be_redirect

expect(recurring_meeting.scheduled_meetings.count).to eq(1)
Expand All @@ -99,7 +103,7 @@
end

it "takes over that occurrence" do
expect { request }.to change(recurring_meeting.meetings, :count).by(1)
expect { subject }.to change(recurring_meeting.meetings, :count).by(1)
expect(response).to be_redirect

expect(recurring_meeting.scheduled_meetings.count).to eq(1)
Expand All @@ -113,7 +117,7 @@
let(:current_user) { create(:user) }

it "does not authorize" do
request
subject
expect(response).to have_http_status(:not_found)
end
end
Expand Down

0 comments on commit dff8e6f

Please sign in to comment.