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 ...@@ -41,14 +41,12 @@ class Spinach::Features::GroupHooks < Spinach::FeatureSteps
end end
step 'I click test hook button' do step 'I click test hook button' do
WebMock.enable!
stub_request(:post, @hook.url).to_return(status: 200) stub_request(:post, @hook.url).to_return(status: 200)
click_link 'Test' click_link 'Test'
WebMock.disable!
end end
step 'I click test hook button with invalid URL' do 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' click_link 'Test'
end end
......
...@@ -8,6 +8,8 @@ class Spinach::Features::GlobalSearch < Spinach::FeatureSteps ...@@ -8,6 +8,8 @@ class Spinach::Features::GlobalSearch < Spinach::FeatureSteps
include StubConfiguration include StubConfiguration
before do before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
Gitlab::Elastic::Helper.create_empty_index Gitlab::Elastic::Helper.create_empty_index
end end
......
...@@ -6,6 +6,8 @@ class Spinach::Features::ProjectSearch < Spinach::FeatureSteps ...@@ -6,6 +6,8 @@ class Spinach::Features::ProjectSearch < Spinach::FeatureSteps
include StubConfiguration include StubConfiguration
before do before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
Gitlab::Elastic::Helper.create_empty_index Gitlab::Elastic::Helper.create_empty_index
end end
......
...@@ -6,6 +6,8 @@ class Spinach::Features::SnippetsSearch < Spinach::FeatureSteps ...@@ -6,6 +6,8 @@ class Spinach::Features::SnippetsSearch < Spinach::FeatureSteps
include StubConfiguration include StubConfiguration
before do before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
Gitlab::Elastic::Helper.create_empty_index Gitlab::Elastic::Helper.create_empty_index
end end
......
...@@ -10,7 +10,9 @@ if ENV['CI'] ...@@ -10,7 +10,9 @@ if ENV['CI']
Knapsack::Adapters::SpinachAdapter.bind Knapsack::Adapters::SpinachAdapter.bind
end 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) require Rails.root.join('spec', 'support', f)
end end
...@@ -21,8 +23,6 @@ end ...@@ -21,8 +23,6 @@ end
Dir["#{Rails.root}/features/steps/shared/*.rb"].each { |file| require file } Dir["#{Rails.root}/features/steps/shared/*.rb"].each { |file| require file }
WebMock.allow_net_connect!
Spinach.hooks.before_run do Spinach.hooks.before_run do
include RSpec::Mocks::ExampleMethods include RSpec::Mocks::ExampleMethods
include ActiveJob::TestHelper 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