Commit 3397ccd4 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'id-create-project-feature-in-factory' into 'master'

Create project-feature in project factory

See merge request gitlab-org/gitlab!40193
parents 85c3aeff 5287cf67
......@@ -40,7 +40,7 @@ FactoryBot.define do
forward_deployment_enabled { nil }
end
after(:create) do |project, evaluator|
before(:create) do |project, evaluator|
# Builds and MRs can't have higher visibility level than repository access level.
builds_access_level = [evaluator.builds_access_level, evaluator.repository_access_level].min
merge_requests_access_level = [evaluator.merge_requests_access_level, evaluator.repository_access_level].min
......@@ -56,8 +56,10 @@ FactoryBot.define do
pages_access_level: evaluator.pages_access_level
}
project.project_feature.update!(hash)
project.build_project_feature(hash)
end
after(:create) do |project, evaluator|
# Normally the class Projects::CreateService is used for creating
# projects, and this class takes care of making sure the owner and current
# user have access to the project. Our specs don't use said service class,
......
......@@ -38,16 +38,17 @@ RSpec.describe 'Projects::MetricsDashboardController' do
context 'with anonymous user and public dashboard visibility' do
let(:anonymous_user) { create(:user) }
let(:project) do
create(:project, :public, metrics_dashboard_access_level: 'enabled')
end
let(:project) { create(:project, :public) }
before do
project.update!(metrics_dashboard_access_level: 'enabled')
login_as(anonymous_user)
end
it 'returns 200' do
send_request
expect(response).to have_gitlab_http_status(:ok)
end
end
......
......@@ -16,6 +16,8 @@ RSpec.describe Projects::OverwriteProjectService do
subject { described_class.new(project_to, user) }
before do
project_to.project_feature.reload
allow(project_to).to receive(:import_data).and_return(double(data: { 'original_path' => project_from.path }))
end
......
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