Commit b0f5d1a9 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'traits-for-featurs' into 'master'

Add traits for ProjectFeatures to Project factory

Closes #24007

See merge request !8925
parents 7c8033e0 3deb66ea
...@@ -2,7 +2,6 @@ require 'spec_helper' ...@@ -2,7 +2,6 @@ require 'spec_helper'
describe SearchController do describe SearchController do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:empty_project, :public) }
before do before do
sign_in(user) sign_in(user)
...@@ -22,7 +21,7 @@ describe SearchController do ...@@ -22,7 +21,7 @@ describe SearchController do
before { sign_out(user) } before { sign_out(user) }
it "doesn't expose comments on issues" do it "doesn't expose comments on issues" 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) note = create(:note_on_issue, project: project)
get :show, project_id: project.id, scope: 'notes', search: note.note get :show, project_id: project.id, scope: 'notes', search: note.note
...@@ -31,17 +30,8 @@ describe SearchController do ...@@ -31,17 +30,8 @@ describe SearchController do
end end
end end
it "doesn't expose comments on issues" do
project = create(:empty_project, :public, issues_access_level: ProjectFeature::PRIVATE)
note = create(:note_on_issue, project: project)
get :show, project_id: project.id, scope: 'notes', search: note.note
expect(assigns[:search_objects].count).to eq(0)
end
it "doesn't expose comments on merge_requests" do it "doesn't expose comments on merge_requests" 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) note = create(:note_on_merge_request, project: project)
get :show, project_id: project.id, scope: 'notes', search: note.note get :show, project_id: project.id, scope: 'notes', search: note.note
...@@ -50,7 +40,7 @@ describe SearchController do ...@@ -50,7 +40,7 @@ describe SearchController do
end end
it "doesn't expose comments on snippets" do it "doesn't expose comments on snippets" do
project = create(:empty_project, :public, snippets_access_level: ProjectFeature::PRIVATE) project = create(:empty_project, :public, :snippets_private)
note = create(:note_on_project_snippet, project: project) note = create(:note_on_project_snippet, project: project)
get :show, project_id: project.id, scope: 'notes', search: note.note get :show, project_id: project.id, scope: 'notes', search: note.note
......
...@@ -56,6 +56,25 @@ FactoryGirl.define do ...@@ -56,6 +56,25 @@ FactoryGirl.define do
end end
end end
trait(:wiki_enabled) { wiki_access_level ProjectFeature::ENABLED }
trait(:wiki_disabled) { wiki_access_level ProjectFeature::DISABLED }
trait(:wiki_private) { wiki_access_level ProjectFeature::PRIVATE }
trait(:builds_enabled) { builds_access_level ProjectFeature::ENABLED }
trait(:builds_disabled) { builds_access_level ProjectFeature::DISABLED }
trait(:builds_private) { builds_access_level ProjectFeature::PRIVATE }
trait(:snippets_enabled) { snippets_access_level ProjectFeature::ENABLED }
trait(:snippets_disabled) { snippets_access_level ProjectFeature::DISABLED }
trait(:snippets_private) { snippets_access_level ProjectFeature::PRIVATE }
trait(:issues_disabled) { issues_access_level ProjectFeature::DISABLED }
trait(:issues_enabled) { issues_access_level ProjectFeature::ENABLED }
trait(:issues_private) { issues_access_level ProjectFeature::PRIVATE }
trait(:merge_requests_enabled) { merge_requests_access_level ProjectFeature::ENABLED }
trait(:merge_requests_disabled) { merge_requests_access_level ProjectFeature::DISABLED }
trait(:merge_requests_private) { merge_requests_access_level ProjectFeature::PRIVATE }
trait(:repository_enabled) { repository_access_level ProjectFeature::ENABLED }
trait(:repository_disabled) { repository_access_level ProjectFeature::DISABLED }
trait(:repository_private) { repository_access_level ProjectFeature::PRIVATE }
# Nest Project Feature attributes # Nest Project Feature attributes
transient do transient do
wiki_access_level ProjectFeature::ENABLED wiki_access_level ProjectFeature::ENABLED
......
...@@ -7,7 +7,7 @@ feature 'Group merge requests page', feature: true do ...@@ -7,7 +7,7 @@ feature 'Group merge requests page', feature: true do
include_examples 'project features apply to issuables', MergeRequest include_examples 'project features apply to issuables', MergeRequest
context 'archived issuable' do context 'archived issuable' do
let(:project_archived) { create(:project, :archived, group: group, merge_requests_access_level: ProjectFeature::ENABLED) } let(:project_archived) { create(:project, :archived, :merge_requests_enabled, group: group) }
let(:issuable_archived) { create(:merge_request, source_project: project_archived, target_project: project_archived, title: 'issuable of an archived project') } let(:issuable_archived) { create(:merge_request, source_project: project_archived, target_project: project_archived, title: 'issuable of an archived project') }
let(:access_level) { ProjectFeature::ENABLED } let(:access_level) { ProjectFeature::ENABLED }
let(:user) { user_in_group } let(:user) { user_in_group }
......
...@@ -12,13 +12,8 @@ feature 'Project settings > Merge Requests', feature: true, js: true do ...@@ -12,13 +12,8 @@ feature 'Project settings > Merge Requests', feature: true, js: true do
end end
context 'when Merge Request and Pipelines are initially enabled' do context 'when Merge Request and Pipelines are initially enabled' do
before do
project.project_feature.update_attribute('merge_requests_access_level', ProjectFeature::ENABLED)
end
context 'when Pipelines are initially enabled' do context 'when Pipelines are initially enabled' do
before do before do
project.project_feature.update_attribute('builds_access_level', ProjectFeature::ENABLED)
visit edit_project_path(project) visit edit_project_path(project)
end end
......
...@@ -2,7 +2,6 @@ require 'spec_helper' ...@@ -2,7 +2,6 @@ require 'spec_helper'
describe 'Projects > Wiki > User views wiki in project page', feature: true do describe 'Projects > Wiki > User views wiki in project page', feature: true do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:empty_project) }
before do before do
project.team << [user, :master] project.team << [user, :master]
...@@ -10,12 +9,11 @@ describe 'Projects > Wiki > User views wiki in project page', feature: true do ...@@ -10,12 +9,11 @@ describe 'Projects > Wiki > User views wiki in project page', feature: true do
end end
context 'when repository is disabled for project' do context 'when repository is disabled for project' do
before do let(:project) do
project.project_feature.update!( create(:empty_project,
repository_access_level: ProjectFeature::DISABLED, :repository_disabled,
merge_requests_access_level: ProjectFeature::DISABLED, :merge_requests_disabled,
builds_access_level: ProjectFeature::DISABLED :builds_disabled)
)
end end
context 'when wiki homepage contains a link' do context 'when wiki homepage contains a link' do
......
...@@ -224,7 +224,7 @@ describe IssuesFinder do ...@@ -224,7 +224,7 @@ describe IssuesFinder do
let(:scope) { nil } let(:scope) { nil }
it "doesn't return team-only issues to non team members" do it "doesn't return team-only issues to non team members" do
project = create(:empty_project, :public, issues_access_level: ProjectFeature::PRIVATE) project = create(:empty_project, :public, :issues_private)
issue = create(:issue, project: project) issue = create(:issue, project: project)
expect(issues).not_to include(issue) expect(issues).not_to include(issue)
......
...@@ -9,8 +9,6 @@ describe NotesFinder do ...@@ -9,8 +9,6 @@ describe NotesFinder do
end end
describe '#execute' do describe '#execute' do
it 'finds notes on snippets when project is public and user isnt a member'
it 'finds notes on merge requests' do it 'finds notes on merge requests' do
create(:note_on_merge_request, project: project) create(:note_on_merge_request, project: project)
...@@ -45,9 +43,11 @@ describe NotesFinder do ...@@ -45,9 +43,11 @@ describe NotesFinder do
context 'on restricted projects' do context 'on restricted projects' do
let(:project) do let(:project) do
create(:empty_project, :public, issues_access_level: ProjectFeature::PRIVATE, create(:empty_project,
snippets_access_level: ProjectFeature::PRIVATE, :public,
merge_requests_access_level: ProjectFeature::PRIVATE) :issues_private,
:snippets_private,
:merge_requests_private)
end end
it 'publicly excludes notes on merge requests' do it 'publicly excludes notes on merge requests' do
......
...@@ -203,7 +203,6 @@ describe ProjectsHelper do ...@@ -203,7 +203,6 @@ describe ProjectsHelper do
context "when project moves from public to private" do context "when project moves from public to private" do
before do before do
project.project_feature.update_attributes(issues_access_level: ProjectFeature::ENABLED)
project.update_attributes(visibility_level: Gitlab::VisibilityLevel::PRIVATE) project.update_attributes(visibility_level: Gitlab::VisibilityLevel::PRIVATE)
end end
......
...@@ -17,7 +17,7 @@ describe Gitlab::ContributionsCalendar do ...@@ -17,7 +17,7 @@ describe Gitlab::ContributionsCalendar do
end end
let(:feature_project) do 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 create(:project_member, user: contributor, project: project).project
end end
end end
......
...@@ -94,8 +94,6 @@ describe Gitlab::GitAccess, lib: true do ...@@ -94,8 +94,6 @@ describe Gitlab::GitAccess, lib: true do
context 'when repository is enabled' do context 'when repository is enabled' do
it 'give access to download code' 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 expect(subject.allowed?).to be_truthy
end end
end end
......
...@@ -36,8 +36,6 @@ describe Gitlab::GitAccessWiki, lib: true do ...@@ -36,8 +36,6 @@ describe Gitlab::GitAccessWiki, lib: true do
context 'when wiki feature is enabled' do context 'when wiki feature is enabled' do
it 'give access to download wiki code' 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 expect(subject.allowed?).to be_truthy
end end
end end
......
...@@ -202,7 +202,7 @@ describe Gitlab::GithubImport::Importer, lib: true do ...@@ -202,7 +202,7 @@ describe Gitlab::GithubImport::Importer, lib: true do
end end
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' } } let(:credentials) { { user: 'joe' } }
context 'when importing a GitHub project' do context 'when importing a GitHub project' do
......
...@@ -6,7 +6,7 @@ describe Gitlab::ImportExport::ProjectTreeRestorer, services: true do ...@@ -6,7 +6,7 @@ describe Gitlab::ImportExport::ProjectTreeRestorer, services: true do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:namespace) { create(:namespace, owner: user) } let(:namespace) { create(:namespace, owner: user) }
let(:shared) { Gitlab::ImportExport::Shared.new(relative_path: "", project_path: 'path') } 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(:project_tree_restorer) { described_class.new(user: user, shared: shared, project: project) }
let(:restored_project_json) { project_tree_restorer.restore } let(:restored_project_json) { project_tree_restorer.restore }
...@@ -123,10 +123,10 @@ describe Gitlab::ImportExport::ProjectTreeRestorer, services: true do ...@@ -123,10 +123,10 @@ describe Gitlab::ImportExport::ProjectTreeRestorer, services: true do
context 'with group' do context 'with group' do
let!(:project) do let!(:project) do
create(:empty_project, create(:empty_project,
:builds_disabled,
:issues_disabled,
name: 'project', name: 'project',
path: 'project', path: 'project',
builds_access_level: ProjectFeature::DISABLED,
issues_access_level: ProjectFeature::DISABLED,
group: create(:group)) group: create(:group))
end end
......
...@@ -152,6 +152,9 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do ...@@ -152,6 +152,9 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do
project = create(:project, project = create(:project,
:public, :public,
:repository, :repository,
:issues_disabled,
:wiki_enabled,
:builds_private,
issues: [issue], issues: [issue],
snippets: [snippet], snippets: [snippet],
releases: [release], releases: [release],
...@@ -185,10 +188,6 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do ...@@ -185,10 +188,6 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do
create(:event, :created, target: milestone, project: project, author: user) create(:event, :created, target: milestone, project: project, author: user)
create(:service, project: project, type: 'CustomIssueTrackerService', category: 'issue_tracker') 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 project
end end
......
...@@ -163,7 +163,7 @@ describe Gitlab::ProjectSearchResults, lib: true do ...@@ -163,7 +163,7 @@ describe Gitlab::ProjectSearchResults, lib: true do
end end
it "doesn't list issue notes when access is restricted" do 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) note = create(:note_on_issue, project: project)
results = described_class.new(user, project, note.note) results = described_class.new(user, project, note.note)
...@@ -172,7 +172,7 @@ describe Gitlab::ProjectSearchResults, lib: true do ...@@ -172,7 +172,7 @@ describe Gitlab::ProjectSearchResults, lib: true do
end end
it "doesn't list merge_request notes when access is restricted" do 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) note = create(:note_on_merge_request, project: project)
results = described_class.new(user, project, note.note) results = described_class.new(user, project, note.note)
......
...@@ -247,7 +247,7 @@ describe Ability, lib: true do ...@@ -247,7 +247,7 @@ describe Ability, lib: true do
end end
describe '.project_disabled_features_rules' do describe '.project_disabled_features_rules' do
let(:project) { create(:empty_project, wiki_access_level: ProjectFeature::DISABLED) } let(:project) { create(:empty_project, :wiki_disabled) }
subject { described_class.allowed(project.owner, project) } subject { described_class.allowed(project.owner, project) }
......
...@@ -37,8 +37,6 @@ describe Guest, lib: true do ...@@ -37,8 +37,6 @@ describe Guest, lib: true do
context 'when repository is enabled' do context 'when repository is enabled' do
it 'allows to pull the repo' do it 'allows to pull the repo' do
public_project.project_feature.update_attribute(:repository_access_level, ProjectFeature::ENABLED)
expect(Guest.can?(:download_code, public_project)).to eq(true) expect(Guest.can?(:download_code, public_project)).to eq(true)
end end
end end
......
...@@ -57,7 +57,6 @@ describe ProjectFeature do ...@@ -57,7 +57,6 @@ describe ProjectFeature do
context 'when feature is enabled for everyone' do context 'when feature is enabled for everyone' do
it "returns true" do it "returns true" do
features.each do |feature| features.each do |feature|
project.project_feature.update_attribute("#{feature}_access_level".to_sym, ProjectFeature::ENABLED)
expect(project.feature_available?(:issues, user)).to eq(true) expect(project.feature_available?(:issues, user)).to eq(true)
end end
end end
...@@ -104,7 +103,6 @@ describe ProjectFeature do ...@@ -104,7 +103,6 @@ describe ProjectFeature do
it "returns true when feature is enabled for everyone" do it "returns true when feature is enabled for everyone" do
features.each do |feature| features.each do |feature|
project.project_feature.update_attribute("#{feature}_access_level".to_sym, ProjectFeature::ENABLED)
expect(project.public_send("#{feature}_enabled?")).to eq(true) expect(project.public_send("#{feature}_enabled?")).to eq(true)
end end
end end
......
...@@ -632,7 +632,7 @@ describe Project, models: true do ...@@ -632,7 +632,7 @@ describe Project, models: true do
end end
describe '#has_wiki?' do describe '#has_wiki?' do
let(:no_wiki_project) { create(:empty_project, wiki_access_level: ProjectFeature::DISABLED, has_external_wiki: false) } let(:no_wiki_project) { create(:empty_project, :wiki_disabled, has_external_wiki: false) }
let(:wiki_enabled_project) { create(:empty_project) } let(:wiki_enabled_project) { create(:empty_project) }
let(:external_wiki_project) { create(:empty_project, has_external_wiki: true) } let(:external_wiki_project) { create(:empty_project, has_external_wiki: true) }
......
...@@ -1232,7 +1232,7 @@ describe User, models: true do ...@@ -1232,7 +1232,7 @@ describe User, models: true do
end end
it 'does not include projects for which issues are disabled' do it 'does not include projects for which issues are disabled' do
project = create(:empty_project, issues_access_level: ProjectFeature::DISABLED) project = create(:empty_project, :issues_disabled)
expect(user.projects_where_can_admin_issues.to_a).to be_empty expect(user.projects_where_can_admin_issues.to_a).to be_empty
expect(user.can?(:admin_issue, project)).to eq(false) expect(user.can?(:admin_issue, project)).to eq(false)
......
...@@ -425,7 +425,7 @@ describe API::Issues, api: true do ...@@ -425,7 +425,7 @@ describe API::Issues, api: true do
end end
it 'returns no issues when user has access to project but not issues' do it 'returns no issues when user has access to project but not issues' do
restricted_project = create(:empty_project, :public, issues_access_level: ProjectFeature::PRIVATE) restricted_project = create(:empty_project, :public, :issues_private)
create(:issue, project: restricted_project) create(:issue, project: restricted_project)
get api("/projects/#{restricted_project.id}/issues", non_member) get api("/projects/#{restricted_project.id}/issues", non_member)
......
...@@ -57,7 +57,7 @@ describe 'Git HTTP requests', lib: true do ...@@ -57,7 +57,7 @@ describe 'Git HTTP requests', lib: true do
end end
context 'but the repo is disabled' do context 'but the repo is disabled' do
let(:project) { create(:project, repository_access_level: ProjectFeature::DISABLED, wiki_access_level: ProjectFeature::ENABLED) } let(:project) { create(:project, :repository_disabled, :wiki_enabled) }
let(:wiki) { ProjectWiki.new(project) } let(:wiki) { ProjectWiki.new(project) }
let(:path) { "/#{wiki.repository.path_with_namespace}.git" } let(:path) { "/#{wiki.repository.path_with_namespace}.git" }
...@@ -141,7 +141,7 @@ describe 'Git HTTP requests', lib: true do ...@@ -141,7 +141,7 @@ describe 'Git HTTP requests', lib: true do
context 'when the repo is public' do context 'when the repo is public' do
context 'but the repo is disabled' do context 'but the repo is disabled' do
it 'does not allow to clone the repo' do it 'does not allow to clone the repo' do
project = create(:project, :public, repository_access_level: ProjectFeature::DISABLED) project = create(:project, :public, :repository_disabled)
download("#{project.path_with_namespace}.git", {}) do |response| download("#{project.path_with_namespace}.git", {}) do |response|
expect(response).to have_http_status(:unauthorized) expect(response).to have_http_status(:unauthorized)
...@@ -151,7 +151,7 @@ describe 'Git HTTP requests', lib: true do ...@@ -151,7 +151,7 @@ describe 'Git HTTP requests', lib: true do
context 'but the repo is enabled' do context 'but the repo is enabled' do
it 'allows to clone the repo' do it 'allows to clone the repo' do
project = create(:project, :public, repository_access_level: ProjectFeature::ENABLED) project = create(:project, :public, :repository_enabled)
download("#{project.path_with_namespace}.git", {}) do |response| download("#{project.path_with_namespace}.git", {}) do |response|
expect(response).to have_http_status(:ok) expect(response).to have_http_status(:ok)
...@@ -161,7 +161,7 @@ describe 'Git HTTP requests', lib: true do ...@@ -161,7 +161,7 @@ describe 'Git HTTP requests', lib: true do
context 'but only project members are allowed' do context 'but only project members are allowed' do
it 'does not allow to clone the repo' do it 'does not allow to clone the repo' do
project = create(:project, :public, repository_access_level: ProjectFeature::PRIVATE) project = create(:project, :public, :repository_private)
download("#{project.path_with_namespace}.git", {}) do |response| download("#{project.path_with_namespace}.git", {}) do |response|
expect(response).to have_http_status(:unauthorized) expect(response).to have_http_status(:unauthorized)
...@@ -360,10 +360,6 @@ describe 'Git HTTP requests', lib: true do ...@@ -360,10 +360,6 @@ describe 'Git HTTP requests', lib: true do
let(:project) { build.project } let(:project) { build.project }
let(:other_project) { create(:empty_project) } let(:other_project) { create(:empty_project) }
before do
project.project_feature.update_attributes(builds_access_level: ProjectFeature::ENABLED)
end
context 'when build created by system is authenticated' do context 'when build created by system is authenticated' do
it "downloads get status 200" do it "downloads get status 200" do
clone_get "#{project.path_with_namespace}.git", user: 'gitlab-ci-token', password: build.token clone_get "#{project.path_with_namespace}.git", user: 'gitlab-ci-token', password: build.token
......
...@@ -90,10 +90,6 @@ describe Projects::CreateService, '#execute', services: true do ...@@ -90,10 +90,6 @@ describe Projects::CreateService, '#execute', services: true do
end end
context 'global builds_enabled true does enable CI by default' do context 'global builds_enabled true does enable CI by default' do
before do
project.project_feature.update_attribute(:builds_access_level, ProjectFeature::ENABLED)
end
it { is_expected.to be_truthy } it { is_expected.to be_truthy }
end end
end end
......
...@@ -31,8 +31,8 @@ shared_examples 'issuable create service' do ...@@ -31,8 +31,8 @@ shared_examples 'issuable create service' do
context "when issuable feature is private" do context "when issuable feature is private" do
before do before do
project.project_feature.update(issues_access_level: ProjectFeature::PRIVATE) project.project_feature.update(issues_access_level: ProjectFeature::PRIVATE,
project.project_feature.update(merge_requests_access_level: ProjectFeature::PRIVATE) merge_requests_access_level: ProjectFeature::PRIVATE)
end end
levels = [Gitlab::VisibilityLevel::INTERNAL, Gitlab::VisibilityLevel::PUBLIC] levels = [Gitlab::VisibilityLevel::INTERNAL, Gitlab::VisibilityLevel::PUBLIC]
......
...@@ -5,7 +5,7 @@ describe RepositoryCheck::SingleRepositoryWorker do ...@@ -5,7 +5,7 @@ describe RepositoryCheck::SingleRepositoryWorker do
subject { described_class.new } subject { described_class.new }
it 'passes when the project has no push events' do it 'passes when the project has no push events' do
project = create(:project_empty_repo, wiki_access_level: ProjectFeature::DISABLED) project = create(:project_empty_repo, :wiki_disabled)
project.events.destroy_all project.events.destroy_all
break_repo(project) break_repo(project)
...@@ -25,7 +25,7 @@ describe RepositoryCheck::SingleRepositoryWorker do ...@@ -25,7 +25,7 @@ describe RepositoryCheck::SingleRepositoryWorker do
end end
it 'fails if the wiki repository is broken' do it 'fails if the wiki repository is broken' do
project = create(:project_empty_repo, wiki_access_level: ProjectFeature::ENABLED) project = create(:project_empty_repo, :wiki_enabled)
project.create_wiki project.create_wiki
# Test sanity: everything should be fine before the wiki repo is broken # Test sanity: everything should be fine before the wiki repo is broken
...@@ -39,7 +39,7 @@ describe RepositoryCheck::SingleRepositoryWorker do ...@@ -39,7 +39,7 @@ describe RepositoryCheck::SingleRepositoryWorker do
end end
it 'skips wikis when disabled' do it 'skips wikis when disabled' do
project = create(:project_empty_repo, wiki_access_level: ProjectFeature::DISABLED) project = create(:project_empty_repo, :wiki_disabled)
# Make sure the test would fail if the wiki repo was checked # Make sure the test would fail if the wiki repo was checked
break_wiki(project) break_wiki(project)
...@@ -49,7 +49,7 @@ describe RepositoryCheck::SingleRepositoryWorker do ...@@ -49,7 +49,7 @@ describe RepositoryCheck::SingleRepositoryWorker do
end end
it 'creates missing wikis' do it 'creates missing wikis' do
project = create(:project_empty_repo, wiki_access_level: ProjectFeature::ENABLED) project = create(:project_empty_repo, :wiki_enabled)
FileUtils.rm_rf(wiki_path(project)) FileUtils.rm_rf(wiki_path(project))
subject.perform(project.id) subject.perform(project.id)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment