Commit 8ba4162b authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Make packages_enabled= method public

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 6e157c65
...@@ -539,6 +539,15 @@ module EE ...@@ -539,6 +539,15 @@ module EE
Feature.enabled?('protected_environments') && feature_available?(:protected_environments) Feature.enabled?('protected_environments') && feature_available?(:protected_environments)
end end
# Because we use default_value_for we need to be sure
# packages_enabled= method does exist even if we rollback migration.
# Otherwise many tests from spec/migrations will fail.
def packages_enabled=(value)
if has_attribute?(:packages_enabled)
write_attribute(:packages_enabled, value)
end
end
private private
def set_override_pull_mirror_available def set_override_pull_mirror_available
...@@ -592,14 +601,5 @@ module EE ...@@ -592,14 +601,5 @@ module EE
old_path_with_namespace: full_path_before old_path_with_namespace: full_path_before
).create ).create
end end
# Because we use default_value_for we need to be sure
# packages_enabled= method does exist even if we rollback migration.
# Otherwise many tests from spec/migrations will fail.
def packages_enabled=(value)
if has_attribute?(:packages_enabled)
write_attribute(:packages_enabled, value)
end
end
end end
end end
...@@ -14,7 +14,7 @@ describe 'Projects > Settings > Packages', :js do ...@@ -14,7 +14,7 @@ describe 'Projects > Settings > Packages', :js do
allow(Gitlab.config.packages).to receive(:enabled).and_return(true) allow(Gitlab.config.packages).to receive(:enabled).and_return(true)
end end
it 'displays the correct elements' do it 'displays the packages toggle button' do
visit edit_project_path(project) visit edit_project_path(project)
expect(page).to have_content('Packages') expect(page).to have_content('Packages')
...@@ -27,10 +27,10 @@ describe 'Projects > Settings > Packages', :js do ...@@ -27,10 +27,10 @@ describe 'Projects > Settings > Packages', :js do
allow(Gitlab.config.packages).to receive(:enabled).and_return(false) allow(Gitlab.config.packages).to receive(:enabled).and_return(false)
end end
it 'displays the correct elements' do it 'does not show up in UI' do
visit edit_project_path(project) visit edit_project_path(project)
expect(page).to_not have_content('Packages') expect(page).not_to have_content('Packages')
end end
end end
end end
...@@ -119,6 +119,7 @@ excluded_attributes: ...@@ -119,6 +119,7 @@ excluded_attributes:
- :mirror_overwrites_diverged_branches - :mirror_overwrites_diverged_branches
- :description_html - :description_html
- :repository_languages - :repository_languages
- :packages_enabled
snippets: snippets:
- :expired_at - :expired_at
merge_request_diff: merge_request_diff:
......
...@@ -177,7 +177,7 @@ describe 'Edit Project Settings' do ...@@ -177,7 +177,7 @@ describe 'Edit Project Settings' do
click_button "Save changes" click_button "Save changes"
end end
expect(find(".sharing-permissions")).to have_selector(".project-feature-toggle.is-disabled", count: 2) expect(find(".sharing-permissions")).to have_selector(".project-feature-toggle.is-disabled", count: 4)
end end
it "shows empty features project homepage" do it "shows empty features project homepage" do
......
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