Commit 527ee20b authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'sh-fix-webmock' into 'master'

Properly disable WebMock and fix spec

Closes #4528

See merge request gitlab-org/gitlab-ee!3988
parents 6dc2e23c 2368fff5
......@@ -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
......
......@@ -8,6 +8,8 @@ class Spinach::Features::GlobalSearch < Spinach::FeatureSteps
include StubConfiguration
before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
Gitlab::Elastic::Helper.create_empty_index
end
......
......@@ -6,6 +6,8 @@ class Spinach::Features::ProjectSearch < Spinach::FeatureSteps
include StubConfiguration
before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
Gitlab::Elastic::Helper.create_empty_index
end
......
......@@ -6,6 +6,8 @@ class Spinach::Features::SnippetsSearch < Spinach::FeatureSteps
include StubConfiguration
before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
Gitlab::Elastic::Helper.create_empty_index
end
......
......@@ -10,7 +10,9 @@ if ENV['CI']
Knapsack::Adapters::SpinachAdapter.bind
end
%w(select2_helper test_env repo_helpers wait_for_requests sidekiq project_forks_helper).each do |f|
WebMock.enable!
%w(select2_helper test_env repo_helpers wait_for_requests sidekiq project_forks_helper webmock).each do |f|
require Rails.root.join('spec', 'support', f)
end
......@@ -21,8 +23,6 @@ end
Dir["#{Rails.root}/features/steps/shared/*.rb"].each { |file| require file }
WebMock.allow_net_connect!
Spinach.hooks.before_run do
include RSpec::Mocks::ExampleMethods
include ActiveJob::TestHelper
......
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