Skip to content

Commit 96d14f8

Browse files
committed
1069: Add coverage to ensure the SchoolOnboardingService is called / not called int he school concept depending on the feature flag
1 parent 8f4804c commit 96d14f8

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

spec/concepts/school/create_spec.rb

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,44 @@
8282
expect(Sentry).to have_received(:capture_exception).with(kind_of(StandardError))
8383
end
8484
end
85+
86+
describe 'when immediate onboarding is enabled' do
87+
# TODO: Remove this block once the feature flag is retired
88+
around do |example|
89+
ClimateControl.modify(ENABLE_IMMEDIATE_SCHOOL_ONBOARDING: 'true') do
90+
example.run
91+
end
92+
end
93+
94+
let(:onboarding_service) { instance_spy(SchoolOnboardingService, onboard: true) }
95+
96+
before do
97+
allow(SchoolOnboardingService).to receive(:new).and_return(onboarding_service)
98+
end
99+
100+
it 'calls the onboarding service' do
101+
described_class.call(school_params:, creator_id:, token:)
102+
expect(onboarding_service).to have_received(:onboard).with(token:)
103+
end
104+
end
105+
106+
# TODO: Remove these examples once the feature flag is retired
107+
describe 'when immediate onboarding is disabled' do
108+
around do |example|
109+
ClimateControl.modify(ENABLE_IMMEDIATE_SCHOOL_ONBOARDING: nil) do
110+
example.run
111+
end
112+
end
113+
114+
let(:onboarding_service) { instance_spy(SchoolOnboardingService) }
115+
116+
before do
117+
allow(SchoolOnboardingService).to receive(:new).and_return(onboarding_service)
118+
end
119+
120+
it 'does not call the onboarding service' do
121+
described_class.call(school_params:, creator_id:, token:)
122+
expect(onboarding_service).not_to have_received(:onboard)
123+
end
124+
end
85125
end

0 commit comments

Comments
 (0)