summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/models/project_services/gitlab_ci_service_spec.rb15
-rw-r--r--spec/models/project_services/hipchat_service_spec.rb4
-rw-r--r--spec/requests/api/files_spec.rb7
3 files changed, 11 insertions, 15 deletions
diff --git a/spec/models/project_services/gitlab_ci_service_spec.rb b/spec/models/project_services/gitlab_ci_service_spec.rb
index ce3dd3ec46c..fbe09327eb3 100644
--- a/spec/models/project_services/gitlab_ci_service_spec.rb
+++ b/spec/models/project_services/gitlab_ci_service_spec.rb
@@ -21,12 +21,9 @@
require 'spec_helper'
describe GitlabCiService do
- describe "Associations" do
- it { is_expected.to belong_to :project }
- it { is_expected.to have_one :service_hook }
- end
-
- describe "Mass assignment" do
+ describe 'associations' do
+ it { is_expected.to belong_to(:project) }
+ it { is_expected.to have_one(:service_hook) }
end
describe 'commits methods' do
@@ -56,9 +53,9 @@ describe GitlabCiService do
it "calls ci_yaml_file" do
service_hook = double
- service_hook.should_receive(:execute)
- @service.should_receive(:service_hook).and_return(service_hook)
- @service.should_receive(:ci_yaml_file).with(push_sample_data)
+ expect(service_hook).to receive(:execute)
+ expect(@service).to receive(:service_hook).and_return(service_hook)
+ expect(@service).to receive(:ci_yaml_file).with(push_sample_data)
@service.execute(push_sample_data)
end
diff --git a/spec/models/project_services/hipchat_service_spec.rb b/spec/models/project_services/hipchat_service_spec.rb
index 28b672983ec..8ed03dd1da8 100644
--- a/spec/models/project_services/hipchat_service_spec.rb
+++ b/spec/models/project_services/hipchat_service_spec.rb
@@ -48,7 +48,7 @@ describe HipchatService do
end
it 'should use v1 if version is provided' do
- hipchat.stub(api_version: 'v1')
+ allow(hipchat).to receive(:api_version).and_return('v1')
expect(HipChat::Client).to receive(:new).
with(token,
api_version: 'v1',
@@ -59,7 +59,7 @@ describe HipchatService do
end
it 'should use v2 as the version when nothing is provided' do
- hipchat.stub(api_version: '')
+ allow(hipchat).to receive(:api_version).and_return('')
expect(HipChat::Client).to receive(:new).
with(token,
api_version: 'v2',
diff --git a/spec/requests/api/files_spec.rb b/spec/requests/api/files_spec.rb
index 8f1fa11ff4e..8a6b4b8a170 100644
--- a/spec/requests/api/files_spec.rb
+++ b/spec/requests/api/files_spec.rb
@@ -60,9 +60,8 @@ describe API::API, api: true do
end
it "should return a 400 if editor fails to create file" do
- Repository.any_instance.stub(
- commit_file: false,
- )
+ allow_any_instance_of(Repository).to receive(:commit_file).
+ and_return(false)
post api("/projects/#{project.id}/repository/files", user), valid_params
expect(response.status).to eq(400)
@@ -112,7 +111,7 @@ describe API::API, api: true do
end
it "should return a 400 if satellite fails to create file" do
- Repository.any_instance.stub(remove_file: false)
+ allow_any_instance_of(Repository).to receive(:remove_file).and_return(false)
delete api("/projects/#{project.id}/repository/files", user), valid_params
expect(response.status).to eq(400)