diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-07-02 00:21:51 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-07-07 05:39:56 +0300 |
commit | cf7c57aaf53036483da35868da84596dcdae2aaf (patch) | |
tree | d978fa5013631d5cec87e8ed0858b94d8e36a570 /spec/services | |
parent | 4b4351a18c5cc31cc1365b24b8c00360730cd100 (diff) |
Use stub_application_setting in a few more specs
These specs also failed when run by themselves before this change, so
we've likely got some kind of cross-test contamination going on.
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/create_snippet_service_spec.rb | 6 | ||||
-rw-r--r-- | spec/services/git_push_service_spec.rb | 8 | ||||
-rw-r--r-- | spec/services/projects/create_service_spec.rb | 4 | ||||
-rw-r--r-- | spec/services/projects/update_service_spec.rb | 4 | ||||
-rw-r--r-- | spec/services/update_snippet_service_spec.rb | 6 |
5 files changed, 6 insertions, 22 deletions
diff --git a/spec/services/create_snippet_service_spec.rb b/spec/services/create_snippet_service_spec.rb index 08689c15ca8..8edabe9450b 100644 --- a/spec/services/create_snippet_service_spec.rb +++ b/spec/services/create_snippet_service_spec.rb @@ -14,11 +14,7 @@ describe CreateSnippetService do context 'When public visibility is restricted' do before do - allow_any_instance_of(ApplicationSetting).to( - receive(:restricted_visibility_levels).and_return( - [Gitlab::VisibilityLevel::PUBLIC] - ) - ) + stub_application_setting(restricted_visibility_levels: [Gitlab::VisibilityLevel::PUBLIC]) @opts.merge!(visibility_level: Gitlab::VisibilityLevel::PUBLIC) end diff --git a/spec/services/git_push_service_spec.rb b/spec/services/git_push_service_spec.rb index 3373b97bfd4..62cef9db534 100644 --- a/spec/services/git_push_service_spec.rb +++ b/spec/services/git_push_service_spec.rb @@ -124,9 +124,7 @@ describe GitPushService do end it "when pushing a branch for the first time with default branch protection disabled" do - allow(ApplicationSetting.current_application_settings). - to receive(:default_branch_protection). - and_return(Gitlab::Access::PROTECTION_NONE) + stub_application_setting(default_branch_protection: Gitlab::Access::PROTECTION_NONE) expect(project).to receive(:execute_hooks) expect(project.default_branch).to eq("master") @@ -135,9 +133,7 @@ describe GitPushService do end it "when pushing a branch for the first time with default branch protection set to 'developers can push'" do - allow(ApplicationSetting.current_application_settings). - to receive(:default_branch_protection). - and_return(Gitlab::Access::PROTECTION_DEV_CAN_PUSH) + stub_application_setting(default_branch_protection: Gitlab::Access::PROTECTION_DEV_CAN_PUSH) expect(project).to receive(:execute_hooks) expect(project.default_branch).to eq("master") diff --git a/spec/services/projects/create_service_spec.rb b/spec/services/projects/create_service_spec.rb index 337dae592dd..97b206c9854 100644 --- a/spec/services/projects/create_service_spec.rb +++ b/spec/services/projects/create_service_spec.rb @@ -58,9 +58,7 @@ describe Projects::CreateService do context 'restricted visibility level' do before do - allow_any_instance_of(ApplicationSetting).to( - receive(:restricted_visibility_levels).and_return([20]) - ) + stub_application_setting(restricted_visibility_levels: [Gitlab::VisibilityLevel::PUBLIC]) @opts.merge!( visibility_level: Gitlab::VisibilityLevel.options['Public'] diff --git a/spec/services/projects/update_service_spec.rb b/spec/services/projects/update_service_spec.rb index 0dd6980a44f..b347fa15f87 100644 --- a/spec/services/projects/update_service_spec.rb +++ b/spec/services/projects/update_service_spec.rb @@ -47,9 +47,7 @@ describe Projects::UpdateService do context 'respect configured visibility restrictions setting' do before(:each) do - allow_any_instance_of(ApplicationSetting).to( - receive(:restricted_visibility_levels).and_return([20]) - ) + stub_application_setting(restricted_visibility_levels: [Gitlab::VisibilityLevel::PUBLIC]) end context 'should be private when updated to private' do diff --git a/spec/services/update_snippet_service_spec.rb b/spec/services/update_snippet_service_spec.rb index 841ef9bfed1..d7c516e3934 100644 --- a/spec/services/update_snippet_service_spec.rb +++ b/spec/services/update_snippet_service_spec.rb @@ -14,11 +14,7 @@ describe UpdateSnippetService do context 'When public visibility is restricted' do before do - allow_any_instance_of(ApplicationSetting).to( - receive(:restricted_visibility_levels).and_return( - [Gitlab::VisibilityLevel::PUBLIC] - ) - ) + stub_application_setting(restricted_visibility_levels: [Gitlab::VisibilityLevel::PUBLIC]) @snippet = create_snippet(@project, @user, @opts) @opts.merge!(visibility_level: Gitlab::VisibilityLevel::PUBLIC) |