summaryrefslogtreecommitdiff
path: root/spec/models/blob_viewer
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-09-07 22:37:37 +0200
committerMatija Čupić <matteeyah@gmail.com>2018-09-07 22:37:37 +0200
commit6a8133b943a8e06571f5497bea0f36c236b2bf90 (patch)
tree6541b565978f9571cbc41c42a8cfac34ac86c54f /spec/models/blob_viewer
parent3af363ecb2cdc764bb9034e81c7159f65c19cb44 (diff)
downloadgitlab-ce-6a8133b943a8e06571f5497bea0f36c236b2bf90.tar.gz
Stub http request on specs intead of mocking HTTParty
CE mirror of bb2a9fde8e6a4d1df13638fe336f641b9c72ef59
Diffstat (limited to 'spec/models/blob_viewer')
-rw-r--r--spec/models/blob_viewer/gitlab_ci_yml_spec.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/spec/models/blob_viewer/gitlab_ci_yml_spec.rb b/spec/models/blob_viewer/gitlab_ci_yml_spec.rb
index 4c8a5aae83a..48345b192d1 100644
--- a/spec/models/blob_viewer/gitlab_ci_yml_spec.rb
+++ b/spec/models/blob_viewer/gitlab_ci_yml_spec.rb
@@ -2,22 +2,24 @@ require 'spec_helper'
describe BlobViewer::GitlabCiYml do
include FakeBlobHelpers
+ include RepoHelpers
- let(:project) { build_stubbed(:project) }
+ let(:project) { build_stubbed(:project, :repository) }
let(:data) { File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml')) }
let(:blob) { fake_blob(path: '.gitlab-ci.yml', data: data) }
+ let(:sha) { sample_commit.id }
subject { described_class.new(blob) }
describe '#validation_message' do
it 'calls prepare! on the viewer' do
expect(subject).to receive(:prepare!)
- subject.validation_message(project, project.default_branch)
+ subject.validation_message(project, sha)
end
context 'when the configuration is valid' do
it 'returns nil' do
- expect(subject.validation_message(project, project.default_branch)).to be_nil
+ expect(subject.validation_message(project, sha)).to be_nil
end
end
@@ -25,7 +27,7 @@ describe BlobViewer::GitlabCiYml do
let(:data) { 'oof' }
it 'returns the error message' do
- expect(subject.validation_message(project, project.default_branch)).to eq('Invalid configuration format')
+ expect(subject.validation_message(project, sha)).to eq('Invalid configuration format')
end
end
end