Commit a65e5d04 authored by Stan Hu's avatar Stan Hu

Properly disable WebMock and fix spec

Closes #4528
parent 738b63c7
......@@ -41,14 +41,12 @@ class Spinach::Features::GroupHooks < Spinach::FeatureSteps
end
step 'I click test hook button' do
WebMock.enable!
stub_request(:post, @hook.url).to_return(status: 200)
click_link 'Test'
WebMock.disable!
end
step 'I click test hook button with invalid URL' do
stub_request(:post, @hook.url).to_raise(SocketError)
stub_request(:post, @hook.url).to_raise(SocketError.new('Failed to open'))
click_link 'Test'
end
......
......@@ -21,7 +21,8 @@ end
Dir["#{Rails.root}/features/steps/shared/*.rb"].each { |file| require file }
WebMock.allow_net_connect!
WebMock.enable!
WebMock.disable_net_connect!(allow_localhost: true)
Spinach.hooks.before_run do
include RSpec::Mocks::ExampleMethods
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment