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
Feature.enabled?('protected_environments') && feature_available?(:protected_environments)
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
def set_override_pull_mirror_available
......@@ -592,14 +601,5 @@ module EE
old_path_with_namespace: full_path_before
).create
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
......@@ -14,7 +14,7 @@ describe 'Projects > Settings > Packages', :js do
allow(Gitlab.config.packages).to receive(:enabled).and_return(true)
end
it 'displays the correct elements' do
it 'displays the packages toggle button' do
visit edit_project_path(project)
expect(page).to have_content('Packages')
......@@ -27,10 +27,10 @@ describe 'Projects > Settings > Packages', :js do
allow(Gitlab.config.packages).to receive(:enabled).and_return(false)
end
it 'displays the correct elements' do
it 'does not show up in UI' do
visit edit_project_path(project)
expect(page).to_not have_content('Packages')
expect(page).not_to have_content('Packages')
end
end
end
......@@ -119,6 +119,7 @@ excluded_attributes:
- :mirror_overwrites_diverged_branches
- :description_html
- :repository_languages
- :packages_enabled
snippets:
- :expired_at
merge_request_diff:
......
......@@ -177,7 +177,7 @@ describe 'Edit Project Settings' do
click_button "Save changes"
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
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