diff options
author | Robert Speicher <robert@gitlab.com> | 2017-02-06 20:00:46 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-02-06 20:00:46 +0300 |
commit | b0f5d1a9b90645274f78c6d497871f382ed90eb0 (patch) | |
tree | 4c4104bc75a96a6961e7c2a21306e168cf76b03c /spec/lib | |
parent | 7c8033e025d3b9e35be1e0ce2e3747319d5cb915 (diff) | |
parent | 3deb66ea569cde62c3213b2671532c0db3c7263d (diff) |
Merge branch 'traits-for-featurs' into 'master'
Add traits for ProjectFeatures to Project factory
Closes #24007
See merge request !8925
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/contributions_calendar_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/git_access_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/git_access_wiki_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/github_import/importer_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/import_export/project_tree_restorer_spec.rb | 14 | ||||
-rw-r--r-- | spec/lib/gitlab/import_export/project_tree_saver_spec.rb | 7 | ||||
-rw-r--r-- | spec/lib/gitlab/project_search_results_spec.rb | 4 |
7 files changed, 14 insertions, 19 deletions
diff --git a/spec/lib/gitlab/contributions_calendar_spec.rb b/spec/lib/gitlab/contributions_calendar_spec.rb index 01b2a55b63c..e18a219ef36 100644 --- a/spec/lib/gitlab/contributions_calendar_spec.rb +++ b/spec/lib/gitlab/contributions_calendar_spec.rb @@ -17,7 +17,7 @@ describe Gitlab::ContributionsCalendar do end let(:feature_project) do - create(:empty_project, :public, issues_access_level: ProjectFeature::PRIVATE) do |project| + create(:empty_project, :public, :issues_private) do |project| create(:project_member, user: contributor, project: project).project end end diff --git a/spec/lib/gitlab/git_access_spec.rb b/spec/lib/gitlab/git_access_spec.rb index 116ab16ae74..a55bd4387e0 100644 --- a/spec/lib/gitlab/git_access_spec.rb +++ b/spec/lib/gitlab/git_access_spec.rb @@ -94,8 +94,6 @@ describe Gitlab::GitAccess, lib: true do context 'when repository is enabled' do it 'give access to download code' do - public_project.project_feature.update_attribute(:repository_access_level, ProjectFeature::ENABLED) - expect(subject.allowed?).to be_truthy end end diff --git a/spec/lib/gitlab/git_access_wiki_spec.rb b/spec/lib/gitlab/git_access_wiki_spec.rb index 4a0cdc6887e..1ae293416e4 100644 --- a/spec/lib/gitlab/git_access_wiki_spec.rb +++ b/spec/lib/gitlab/git_access_wiki_spec.rb @@ -36,8 +36,6 @@ describe Gitlab::GitAccessWiki, lib: true do context 'when wiki feature is enabled' do it 'give access to download wiki code' do - project.project_feature.update_attribute(:wiki_access_level, ProjectFeature::ENABLED) - expect(subject.allowed?).to be_truthy end end diff --git a/spec/lib/gitlab/github_import/importer_spec.rb b/spec/lib/gitlab/github_import/importer_spec.rb index 72421832ffc..afd78abdc9b 100644 --- a/spec/lib/gitlab/github_import/importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer_spec.rb @@ -202,7 +202,7 @@ describe Gitlab::GithubImport::Importer, lib: true do end end - let(:project) { create(:project, import_url: "#{repo_root}/octocat/Hello-World.git", wiki_access_level: ProjectFeature::DISABLED) } + let(:project) { create(:project, :wiki_disabled, import_url: "#{repo_root}/octocat/Hello-World.git") } let(:credentials) { { user: 'joe' } } context 'when importing a GitHub project' do diff --git a/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb b/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb index 40d7d59f03b..0af13ba8e47 100644 --- a/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb +++ b/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb @@ -6,7 +6,7 @@ describe Gitlab::ImportExport::ProjectTreeRestorer, services: true do let(:user) { create(:user) } let(:namespace) { create(:namespace, owner: user) } let(:shared) { Gitlab::ImportExport::Shared.new(relative_path: "", project_path: 'path') } - let!(:project) { create(:empty_project, name: 'project', path: 'project', builds_access_level: ProjectFeature::DISABLED, issues_access_level: ProjectFeature::DISABLED) } + let!(:project) { create(:empty_project, :builds_disabled, :issues_disabled, name: 'project', path: 'project') } let(:project_tree_restorer) { described_class.new(user: user, shared: shared, project: project) } let(:restored_project_json) { project_tree_restorer.restore } @@ -121,13 +121,13 @@ describe Gitlab::ImportExport::ProjectTreeRestorer, services: true do end context 'with group' do - let!(:project) do + let!(:project) do create(:empty_project, - name: 'project', - path: 'project', - builds_access_level: ProjectFeature::DISABLED, - issues_access_level: ProjectFeature::DISABLED, - group: create(:group)) + :builds_disabled, + :issues_disabled, + name: 'project', + path: 'project', + group: create(:group)) end it 'has group labels' do diff --git a/spec/lib/gitlab/import_export/project_tree_saver_spec.rb b/spec/lib/gitlab/import_export/project_tree_saver_spec.rb index 1d65b24c2c9..550daa44010 100644 --- a/spec/lib/gitlab/import_export/project_tree_saver_spec.rb +++ b/spec/lib/gitlab/import_export/project_tree_saver_spec.rb @@ -152,6 +152,9 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do project = create(:project, :public, :repository, + :issues_disabled, + :wiki_enabled, + :builds_private, issues: [issue], snippets: [snippet], releases: [release], @@ -185,10 +188,6 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do create(:event, :created, target: milestone, project: project, author: user) create(:service, project: project, type: 'CustomIssueTrackerService', category: 'issue_tracker') - project.project_feature.update_attribute(:issues_access_level, ProjectFeature::DISABLED) - project.project_feature.update_attribute(:wiki_access_level, ProjectFeature::ENABLED) - project.project_feature.update_attribute(:builds_access_level, ProjectFeature::PRIVATE) - project end diff --git a/spec/lib/gitlab/project_search_results_spec.rb b/spec/lib/gitlab/project_search_results_spec.rb index 92e3624a8d8..9a8096208db 100644 --- a/spec/lib/gitlab/project_search_results_spec.rb +++ b/spec/lib/gitlab/project_search_results_spec.rb @@ -163,7 +163,7 @@ describe Gitlab::ProjectSearchResults, lib: true do end it "doesn't list issue notes when access is restricted" do - project = create(:empty_project, :public, issues_access_level: ProjectFeature::PRIVATE) + project = create(:empty_project, :public, :issues_private) note = create(:note_on_issue, project: project) results = described_class.new(user, project, note.note) @@ -172,7 +172,7 @@ describe Gitlab::ProjectSearchResults, lib: true do end it "doesn't list merge_request notes when access is restricted" do - project = create(:empty_project, :public, merge_requests_access_level: ProjectFeature::PRIVATE) + project = create(:empty_project, :public, :merge_requests_private) note = create(:note_on_merge_request, project: project) results = described_class.new(user, project, note.note) |