Commit 09639474 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Update specs for new permissions

And implement review feedback
parent 16862386
...@@ -579,7 +579,7 @@ module EE ...@@ -579,7 +579,7 @@ module EE
# Checking both feature availability on the license, as well as the feature # Checking both feature availability on the license, as well as the feature
# flag, because we don't want to enable design_management by default on # flag, because we don't want to enable design_management by default on
# on prem installs yet. # on prem installs yet.
feature_available?(:design_management) && ::Feature.enabled?(:design_management) feature_available?(:design_management) && ::Feature.enabled?(:design_management, self)
end end
private private
......
require 'spec_helper' require 'spec_helper'
describe 'User uploads new design', :js do describe 'User uploads new design', :js do
let(:user) { project.owner }
let(:project) { create(:project_empty_repo, :public) } let(:project) { create(:project_empty_repo, :public) }
let(:issue) { create(:issue, project: project) } let(:issue) { create(:issue, project: project) }
before do before do
visit project_issue_path(project, issue) sign_in(user)
end
context "when the feature is available" do
before do
stub_licensed_features(design_management: true)
visit project_issue_path(project, issue)
click_link 'Designs' click_link 'Designs'
wait_for_requests
end
wait_for_requests it 'uploads design' do
attach_file(:design_file, logo_fixture, make_visible: true)
expect(page).to have_selector('.js-design-list-item', count: 6)
within first('#designs-tab .card') do
expect(page).to have_content('dk.png')
expect(page).to have_content('Updated just now')
end
end
end end
it 'uploads design' do context 'when the feature is not available' do
attach_file(:design_file, logo_fixture, make_visible: true) before do
stub_licensed_features(design_management: false)
expect(page).to have_selector('.js-design-list-item', count: 6) visit project_issue_path(project, issue)
end
within first('#designs-tab .card') do it 'does not show the designs link' do
expect(page).to have_content('dk.png') expect(page).not_to have_link('Designs')
expect(page).to have_content('Updated just now')
end end
end end
......
...@@ -5,6 +5,8 @@ describe 'User views issue designs', :js do ...@@ -5,6 +5,8 @@ describe 'User views issue designs', :js do
let(:issue) { create(:issue, project: project) } let(:issue) { create(:issue, project: project) }
before do before do
stub_licensed_features(design_management: true)
visit project_issue_path(project, issue) visit project_issue_path(project, issue)
click_link 'Designs' click_link 'Designs'
......
...@@ -5,6 +5,8 @@ describe 'User views issue designs', :js do ...@@ -5,6 +5,8 @@ describe 'User views issue designs', :js do
let(:issue) { create(:issue, project: project) } let(:issue) { create(:issue, project: project) }
before do before do
stub_licensed_features(design_management: true)
visit project_issue_path(project, issue) visit project_issue_path(project, issue)
click_link 'Designs' click_link 'Designs'
......
...@@ -146,7 +146,7 @@ describe DesignManagement::DesignPolicy do ...@@ -146,7 +146,7 @@ describe DesignManagement::DesignPolicy do
context "for anonymous users" do context "for anonymous users" do
let(:current_user) { nil } let(:current_user) { nil }
it { is_expected.to be_disallowed(*design_abilities)} it { is_expected.to be_disallowed(*design_abilities) }
end end
end end
end end
......
...@@ -7,6 +7,8 @@ describe Types::PermissionTypes::Issue do ...@@ -7,6 +7,8 @@ describe Types::PermissionTypes::Issue do
:create_note, :reopen_issue :create_note, :reopen_issue
] ]
expect(described_class).to have_graphql_fields(expected_permissions) expected_permissions.each do |permission|
expect(described_class).to have_graphql_field(permission)
end
end end
end 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