summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2017-08-01 14:51:52 -0400
committerRobert Speicher <rspeicher@gmail.com>2017-08-01 14:51:52 -0400
commit9513bd18c43b749c8856d6ad89635d97c8fb73b5 (patch)
treeb55d7fb920f0d6a8e10eabae1cafa5126fa03203 /spec/models
parent4c77c30fbfb3734fd893f7cfe540fa595ea6539c (diff)
downloadgitlab-ce-9513bd18c43b749c8856d6ad89635d97c8fb73b5.tar.gz
Ensure all project factories use `:repository` trait or `:empty_project`rs-empty_project-cleanup
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/blob_viewer/composer_json_spec.rb2
-rw-r--r--spec/models/blob_viewer/gemspec_spec.rb2
-rw-r--r--spec/models/blob_viewer/gitlab_ci_yml_spec.rb2
-rw-r--r--spec/models/blob_viewer/package_json_spec.rb2
-rw-r--r--spec/models/blob_viewer/podspec_json_spec.rb2
-rw-r--r--spec/models/blob_viewer/podspec_spec.rb2
-rw-r--r--spec/models/blob_viewer/route_map_spec.rb2
-rw-r--r--spec/models/concerns/participable_spec.rb6
-rw-r--r--spec/models/concerns/resolvable_note_spec.rb2
-rw-r--r--spec/models/concerns/routable_spec.rb2
-rw-r--r--spec/models/container_repository_spec.rb4
-rw-r--r--spec/models/deployment_spec.rb2
-rw-r--r--spec/models/diff_discussion_spec.rb2
-rw-r--r--spec/models/environment_spec.rb2
-rw-r--r--spec/models/forked_project_link_spec.rb2
-rw-r--r--spec/models/gpg_signature_spec.rb2
-rw-r--r--spec/models/issue_spec.rb2
-rw-r--r--spec/models/project_group_link_spec.rb2
-rw-r--r--spec/models/project_services/chat_notification_service_spec.rb2
-rw-r--r--spec/models/project_services/issue_tracker_service_spec.rb2
-rw-r--r--spec/models/project_services/jira_service_spec.rb2
-rw-r--r--spec/models/project_spec.rb16
-rw-r--r--spec/models/project_team_spec.rb2
-rw-r--r--spec/models/repository_spec.rb2
-rw-r--r--spec/models/sent_notification_spec.rb4
25 files changed, 36 insertions, 36 deletions
diff --git a/spec/models/blob_viewer/composer_json_spec.rb b/spec/models/blob_viewer/composer_json_spec.rb
index 82f6f7e5046..35e7e1805d4 100644
--- a/spec/models/blob_viewer/composer_json_spec.rb
+++ b/spec/models/blob_viewer/composer_json_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe BlobViewer::ComposerJson do
include FakeBlobHelpers
- let(:project) { build(:project) }
+ let(:project) { build_stubbed(:empty_project) }
let(:data) do
<<-SPEC.strip_heredoc
{
diff --git a/spec/models/blob_viewer/gemspec_spec.rb b/spec/models/blob_viewer/gemspec_spec.rb
index 14cc5f3c0fd..5406ff552f8 100644
--- a/spec/models/blob_viewer/gemspec_spec.rb
+++ b/spec/models/blob_viewer/gemspec_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe BlobViewer::Gemspec do
include FakeBlobHelpers
- let(:project) { build(:project) }
+ let(:project) { build_stubbed(:empty_project) }
let(:data) do
<<-SPEC.strip_heredoc
Gem::Specification.new do |s|
diff --git a/spec/models/blob_viewer/gitlab_ci_yml_spec.rb b/spec/models/blob_viewer/gitlab_ci_yml_spec.rb
index 7a4f9866375..344fcdeb9b6 100644
--- a/spec/models/blob_viewer/gitlab_ci_yml_spec.rb
+++ b/spec/models/blob_viewer/gitlab_ci_yml_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe BlobViewer::GitlabCiYml do
include FakeBlobHelpers
- let(:project) { build(:project) }
+ let(:project) { build_stubbed(:empty_project) }
let(:data) { File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml')) }
let(:blob) { fake_blob(path: '.gitlab-ci.yml', data: data) }
subject { described_class.new(blob) }
diff --git a/spec/models/blob_viewer/package_json_spec.rb b/spec/models/blob_viewer/package_json_spec.rb
index 96fb1b08c99..976c2ed3639 100644
--- a/spec/models/blob_viewer/package_json_spec.rb
+++ b/spec/models/blob_viewer/package_json_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe BlobViewer::PackageJson do
include FakeBlobHelpers
- let(:project) { build(:project) }
+ let(:project) { build_stubbed(:empty_project) }
let(:data) do
<<-SPEC.strip_heredoc
{
diff --git a/spec/models/blob_viewer/podspec_json_spec.rb b/spec/models/blob_viewer/podspec_json_spec.rb
index f510077a87b..b98360ea7b7 100644
--- a/spec/models/blob_viewer/podspec_json_spec.rb
+++ b/spec/models/blob_viewer/podspec_json_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe BlobViewer::PodspecJson do
include FakeBlobHelpers
- let(:project) { build(:project) }
+ let(:project) { build_stubbed(:empty_project) }
let(:data) do
<<-SPEC.strip_heredoc
{
diff --git a/spec/models/blob_viewer/podspec_spec.rb b/spec/models/blob_viewer/podspec_spec.rb
index 7c38083550c..ad2bbe034ea 100644
--- a/spec/models/blob_viewer/podspec_spec.rb
+++ b/spec/models/blob_viewer/podspec_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe BlobViewer::Podspec do
include FakeBlobHelpers
- let(:project) { build(:project) }
+ let(:project) { build_stubbed(:empty_project) }
let(:data) do
<<-SPEC.strip_heredoc
Pod::Spec.new do |spec|
diff --git a/spec/models/blob_viewer/route_map_spec.rb b/spec/models/blob_viewer/route_map_spec.rb
index 115731b4970..12b6519a344 100644
--- a/spec/models/blob_viewer/route_map_spec.rb
+++ b/spec/models/blob_viewer/route_map_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe BlobViewer::RouteMap do
include FakeBlobHelpers
- let(:project) { build(:project) }
+ let(:project) { build_stubbed(:empty_project) }
let(:data) do
<<-MAP.strip_heredoc
# Team data
diff --git a/spec/models/concerns/participable_spec.rb b/spec/models/concerns/participable_spec.rb
index 431f1482615..6c4b5a9e9d6 100644
--- a/spec/models/concerns/participable_spec.rb
+++ b/spec/models/concerns/participable_spec.rb
@@ -24,7 +24,7 @@ describe Participable do
user1 = build(:user)
user2 = build(:user)
user3 = build(:user)
- project = build(:project, :public)
+ project = build(:empty_project, :public)
instance = model.new
expect(instance).to receive(:foo).and_return(user2)
@@ -57,7 +57,7 @@ describe Participable do
other = other_model.new
user1 = build(:user)
user2 = build(:user)
- project = build(:project, :public)
+ project = build(:empty_project, :public)
expect(instance).to receive(:foo).and_return(other)
expect(other).to receive(:bar).and_return(user2)
@@ -69,7 +69,7 @@ describe Participable do
context 'when using a Proc as an attribute' do
it 'calls the supplied Proc' do
user1 = build(:user)
- project = build(:project, :public)
+ project = build(:empty_project, :public)
user_arg = nil
ext_arg = nil
diff --git a/spec/models/concerns/resolvable_note_spec.rb b/spec/models/concerns/resolvable_note_spec.rb
index 53eaa6f8461..d00faa4f8be 100644
--- a/spec/models/concerns/resolvable_note_spec.rb
+++ b/spec/models/concerns/resolvable_note_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe Note, ResolvableNote do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request, source_project: project) }
subject { create(:discussion_note_on_merge_request, noteable: merge_request, project: project) }
diff --git a/spec/models/concerns/routable_spec.rb b/spec/models/concerns/routable_spec.rb
index 36aedd2f701..866a835d62a 100644
--- a/spec/models/concerns/routable_spec.rb
+++ b/spec/models/concerns/routable_spec.rb
@@ -27,7 +27,7 @@ describe Group, 'Routable' do
it 'ensure route path uniqueness across different objects' do
create(:group, parent: group, path: 'xyz')
- duplicate = build(:project, namespace: group, path: 'xyz')
+ duplicate = build(:empty_project, namespace: group, path: 'xyz')
expect { duplicate.save! }.to raise_error(ActiveRecord::RecordInvalid, 'Validation failed: Route path has already been taken, Route is invalid')
end
diff --git a/spec/models/container_repository_spec.rb b/spec/models/container_repository_spec.rb
index eff41d85972..bae88cb1d24 100644
--- a/spec/models/container_repository_spec.rb
+++ b/spec/models/container_repository_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe ContainerRepository do
let(:group) { create(:group, name: 'group') }
- let(:project) { create(:project, path: 'test', group: group) }
+ let(:project) { create(:project, :repository, path: 'test', group: group) }
let(:repository) do
create(:container_repository, name: 'my_image', project: project)
@@ -41,7 +41,7 @@ describe ContainerRepository do
end
context 'when path contains uppercase letters' do
- let(:project) { create(:project, path: 'MY_PROJECT', group: group) }
+ let(:project) { create(:project, :repository, path: 'MY_PROJECT', group: group) }
it 'returns a full path without capital letters' do
expect(repository.path).to eq('group/my_project/my_image')
diff --git a/spec/models/deployment_spec.rb b/spec/models/deployment_spec.rb
index 6447095078b..c5708e70ef9 100644
--- a/spec/models/deployment_spec.rb
+++ b/spec/models/deployment_spec.rb
@@ -91,7 +91,7 @@ describe Deployment do
end
describe '#additional_metrics' do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:deployment) { create(:deployment, project: project) }
subject { deployment.additional_metrics }
diff --git a/spec/models/diff_discussion_spec.rb b/spec/models/diff_discussion_spec.rb
index 2704698f6c9..fa02434b0fd 100644
--- a/spec/models/diff_discussion_spec.rb
+++ b/spec/models/diff_discussion_spec.rb
@@ -5,7 +5,7 @@ describe DiffDiscussion do
subject { described_class.new([diff_note]) }
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
let(:diff_note) { create(:diff_note_on_merge_request, noteable: merge_request, project: project) }
diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb
index ebf2c070116..9a35213c98d 100644
--- a/spec/models/environment_spec.rb
+++ b/spec/models/environment_spec.rb
@@ -21,7 +21,7 @@ describe Environment do
it { is_expected.to validate_uniqueness_of(:external_url).scoped_to(:project_id) }
describe '.order_by_last_deployed_at' do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let!(:environment1) { create(:environment, project: project) }
let!(:environment2) { create(:environment, project: project) }
let!(:environment3) { create(:environment, project: project) }
diff --git a/spec/models/forked_project_link_spec.rb b/spec/models/forked_project_link_spec.rb
index 38fbdd2536a..7dbeb4d2e74 100644
--- a/spec/models/forked_project_link_spec.rb
+++ b/spec/models/forked_project_link_spec.rb
@@ -41,7 +41,7 @@ describe ForkedProjectLink, "add link on fork" do
end
describe '#forked?' do
- let(:project_to) { create(:project, forked_project_link: forked_project_link) }
+ let(:project_to) { create(:project, :repository, forked_project_link: forked_project_link) }
let(:forked_project_link) { create(:forked_project_link) }
before do
diff --git a/spec/models/gpg_signature_spec.rb b/spec/models/gpg_signature_spec.rb
index 9a9b1900aa5..c58fd46762a 100644
--- a/spec/models/gpg_signature_spec.rb
+++ b/spec/models/gpg_signature_spec.rb
@@ -16,7 +16,7 @@ RSpec.describe GpgSignature do
describe '#commit' do
it 'fetches the commit through the project' do
commit_sha = '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'
- project = create :project
+ project = create :project, :repository
commit = create :commit, project: project
gpg_signature = create :gpg_signature, commit_sha: commit_sha
diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb
index d72790eefe5..eaf06668327 100644
--- a/spec/models/issue_spec.rb
+++ b/spec/models/issue_spec.rb
@@ -724,7 +724,7 @@ describe Issue do
end
describe '#check_for_spam' do
- let(:project) { create :project, visibility_level: visibility_level }
+ let(:project) { create :empty_project, visibility_level: visibility_level }
let(:issue) { create :issue, project: project }
subject do
diff --git a/spec/models/project_group_link_spec.rb b/spec/models/project_group_link_spec.rb
index d68d8b719cd..0938a7b1b6d 100644
--- a/spec/models/project_group_link_spec.rb
+++ b/spec/models/project_group_link_spec.rb
@@ -9,7 +9,7 @@ describe ProjectGroupLink do
describe "Validation" do
let(:parent_group) { create(:group) }
let(:group) { create(:group, parent: parent_group) }
- let(:project) { create(:project, group: group) }
+ let(:project) { create(:empty_project, group: group) }
let!(:project_group_link) { create(:project_group_link, project: project) }
it { is_expected.to validate_presence_of(:project_id) }
diff --git a/spec/models/project_services/chat_notification_service_spec.rb b/spec/models/project_services/chat_notification_service_spec.rb
index 413ceed73bf..ae80c4ae002 100644
--- a/spec/models/project_services/chat_notification_service_spec.rb
+++ b/spec/models/project_services/chat_notification_service_spec.rb
@@ -20,7 +20,7 @@ describe ChatNotificationService do
context 'with repository' do
it 'returns true' do
- subject.project = create(:project)
+ subject.project = create(:project, :repository)
expect(subject.can_test?).to be true
end
diff --git a/spec/models/project_services/issue_tracker_service_spec.rb b/spec/models/project_services/issue_tracker_service_spec.rb
index e6a1752576b..3ca123cb75d 100644
--- a/spec/models/project_services/issue_tracker_service_spec.rb
+++ b/spec/models/project_services/issue_tracker_service_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe IssueTrackerService do
describe 'Validations' do
- let(:project) { create :project }
+ let(:project) { create :empty_project }
describe 'only one issue tracker per project' do
let(:service) { RedmineService.new(project: project, active: true) }
diff --git a/spec/models/project_services/jira_service_spec.rb b/spec/models/project_services/jira_service_spec.rb
index bc9374d6dbb..69bb8f1c725 100644
--- a/spec/models/project_services/jira_service_spec.rb
+++ b/spec/models/project_services/jira_service_spec.rb
@@ -190,7 +190,7 @@ describe JiraService do
describe '#test_settings' do
let(:jira_service) do
described_class.new(
- project: create(:project),
+ project: create(:empty_project),
url: 'http://jira.example.com',
username: 'jira_username',
password: 'jira_password'
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 29cc9d35fc9..3bc6fb09778 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -261,27 +261,27 @@ describe Project do
describe 'path validation' do
it 'allows paths reserved on the root namespace' do
- project = build(:project, path: 'api')
+ project = build(:empty_project, path: 'api')
expect(project).to be_valid
end
it 'rejects paths reserved on another level' do
- project = build(:project, path: 'tree')
+ project = build(:empty_project, path: 'tree')
expect(project).not_to be_valid
end
it 'rejects nested paths' do
parent = create(:group, :nested, path: 'environments')
- project = build(:project, path: 'folders', namespace: parent)
+ project = build(:empty_project, path: 'folders', namespace: parent)
expect(project).not_to be_valid
end
it 'allows a reserved group name' do
parent = create(:group)
- project = build(:project, path: 'avatar', namespace: parent)
+ project = build(:empty_project, path: 'avatar', namespace: parent)
expect(project).to be_valid
end
@@ -2045,7 +2045,7 @@ describe Project do
end
describe '#route_map_for' do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:route_map) do
<<-MAP.strip_heredoc
- source: /source/(.*)/
@@ -2082,7 +2082,7 @@ describe Project do
end
describe '#public_path_for_source_path' do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:route_map) do
Gitlab::RouteMap.new(<<-MAP.strip_heredoc)
- source: /source/(.*)/
@@ -2196,7 +2196,7 @@ describe Project do
end
describe '#pipeline_status' do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
it 'builds a pipeline status' do
expect(project.pipeline_status).to be_a(Gitlab::Cache::Ci::ProjectPipelineStatus)
end
@@ -2207,7 +2207,7 @@ describe Project do
end
describe '#append_or_update_attribute' do
- let(:project) { create(:project) }
+ let(:project) { create(:empty_project) }
it 'shows full error updating an invalid MR' do
error_message = 'Failed to replace merge_requests because one or more of the new records could not be saved.'\
diff --git a/spec/models/project_team_spec.rb b/spec/models/project_team_spec.rb
index 68228a038a8..9ccd366a48e 100644
--- a/spec/models/project_team_spec.rb
+++ b/spec/models/project_team_spec.rb
@@ -330,7 +330,7 @@ describe ProjectTeam do
end
shared_examples 'max member access for users' do
- let(:project) { create(:project) }
+ let(:project) { create(:empty_project) }
let(:group) { create(:group) }
let(:second_group) { create(:group) }
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index 0fd3a4d622a..3107037925b 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -300,7 +300,7 @@ describe Repository do
end
context "when committing to another project" do
- let(:forked_project) { create(:project) }
+ let(:forked_project) { create(:project, :repository) }
it "creates a fork and commit to the forked project" do
expect do
diff --git a/spec/models/sent_notification_spec.rb b/spec/models/sent_notification_spec.rb
index 8b6b02916ae..8f05deb8b15 100644
--- a/spec/models/sent_notification_spec.rb
+++ b/spec/models/sent_notification_spec.rb
@@ -21,7 +21,7 @@ describe SentNotification do
end
context "when the noteable project and discussion project match" do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:issue) { create(:issue, project: project) }
let(:discussion_id) { create(:note, project: project, noteable: issue).discussion_id }
subject { build(:sent_notification, project: project, noteable: issue, in_reply_to_discussion_id: discussion_id) }
@@ -128,7 +128,7 @@ describe SentNotification do
end
context 'for commit' do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:commit) { project.commit }
subject { described_class.record(commit, project.creator.id) }