debian-mirror-gitlab/spec/features/projects/settings/packages_settings_spec.rb

35 lines
874 B
Ruby
Raw Normal View History

2020-10-24 23:57:45 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Projects > Settings > Packages', :js do
2021-06-08 01:23:25 +05:30
let_it_be(:project) { create(:project) }
let(:user) { project.owner }
2020-10-24 23:57:45 +05:30
before do
sign_in(user)
2021-06-08 01:23:25 +05:30
stub_config(packages: { enabled: packages_enabled })
visit edit_project_path(project)
2020-10-24 23:57:45 +05:30
end
context 'Packages enabled in config' do
2021-06-08 01:23:25 +05:30
let(:packages_enabled) { true }
2020-10-24 23:57:45 +05:30
it 'displays the packages toggle button' do
2021-12-11 22:18:48 +05:30
expect(page).to have_selector('[data-testid="toggle-label"]', text: 'Packages')
2020-10-24 23:57:45 +05:30
expect(page).to have_selector('input[name="project[packages_enabled]"] + button', visible: true)
end
end
context 'Packages disabled in config' do
2021-06-08 01:23:25 +05:30
let(:packages_enabled) { false }
2020-10-24 23:57:45 +05:30
it 'does not show up in UI' do
2021-12-11 22:18:48 +05:30
expect(page).not_to have_selector('[data-testid="toggle-label"]', text: 'Packages')
2020-10-24 23:57:45 +05:30
end
end
end