Skip to content

Commit

Permalink
add stub request
Browse files Browse the repository at this point in the history
  • Loading branch information
jesusbv committed Nov 4, 2024
1 parent d5056a2 commit 736ed56
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@

context 'when verification provider returns false' do
before do
stub_request(:post, scc_activate_url)
.to_return(
status: 422,
body: { error: 'Unexpected instance verification error has occurred' }.to_json,
headers: {}
)

expect(InstanceVerification::Providers::Example).to receive(:new)
.with(be_a(ActiveSupport::Logger), be_a(ActionDispatch::Request), payload, instance_data).and_return(plugin_double)
expect(plugin_double).to receive(:instance_valid?).and_return(false)
Expand All @@ -86,6 +93,13 @@

context 'when verification provider raises an unhandled exception' do
before do
stub_request(:post, scc_activate_url)
.to_return(
status: 422,
body: { error: 'Unexpected instance verification error has occurred' }.to_json,
headers: {}
)

expect(InstanceVerification::Providers::Example).to receive(:new)
.with(be_a(ActiveSupport::Logger), be_a(ActionDispatch::Request), payload, instance_data).and_return(plugin_double)
expect(plugin_double).to receive(:instance_valid?).and_raise('Custom plugin error')
Expand Down

0 comments on commit 736ed56

Please sign in to comment.