Commit ab0b0a5d authored by Tim Zallmann's avatar Tim Zallmann

Fixing Test for on Premise

parent 24ee0715
...@@ -68,9 +68,9 @@ module LicenseHelper ...@@ -68,9 +68,9 @@ module LicenseHelper
end end
def upgrade_plan_url def upgrade_plan_url
if (@project.owner.present? && @project.owner == @current_user) if @project.owner.present? && @project.owner == @current_user
profile_billings_path profile_billings_path
else @project.group&.has_owner?(@current_user) else
group_billings_path(@project.group) group_billings_path(@project.group)
end end
end end
......
= current_application_settings.should_check_namespace_plan?
- if current_application_settings.should_check_namespace_plan? - if current_application_settings.should_check_namespace_plan?
- if (@project.owner.present? && @project.owner == @current_user) || @project.group&.has_owner?(@current_user) - if (@project.owner.present? && @project.owner == @current_user) || @project.group&.has_owner?(@current_user)
= link_to 'Upgrade your plan', upgrade_plan_url, class: 'btn btn-primary' = link_to 'Upgrade your plan', upgrade_plan_url, class: 'btn btn-primary'
...@@ -7,7 +8,6 @@ ...@@ -7,7 +8,6 @@
- owner = @project.namespace.owner - owner = @project.namespace.owner
%p Contact owner #{ link_to(simple_sanitize(owner.name), user_path(owner)) } to upgrade the license. %p Contact owner #{ link_to(simple_sanitize(owner.name), user_path(owner)) } to upgrade the license.
- elsif current_user.admin? - elsif current_user.admin?
= 'URL ' + upgrade_plan_url
- if License.current&.expired? - if License.current&.expired?
= link_to 'Buy GitLab Enterprise Edition', Gitlab::SUBSCRIPTIONS_PLANS_URL, class: 'btn btn-primary' = link_to 'Buy GitLab Enterprise Edition', Gitlab::SUBSCRIPTIONS_PLANS_URL, class: 'btn btn-primary'
- else - else
......
...@@ -4,15 +4,15 @@ describe 'Promotions', js: true do ...@@ -4,15 +4,15 @@ describe 'Promotions', js: true do
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:developer) { create(:user) } let(:developer) { create(:user) }
let(:project) { create(:project, path: 'gitlab', name: 'sample') } let(:project) { create(:project, :public, path: 'gitlab', name: 'sample') }
describe 'if you have a license' do describe 'if you have a license' do
before do before do
sign_in(user)
project.team << [user, :master] project.team << [user, :master]
end end
it 'should show no promotion at all' do it 'should show no promotion at all' do
sign_in(user)
visit edit_project_path(project) visit edit_project_path(project)
expect(page).not_to have_selector('#promote_service_desk') expect(page).not_to have_selector('#promote_service_desk')
end end
...@@ -22,6 +22,7 @@ describe 'Promotions', js: true do ...@@ -22,6 +22,7 @@ describe 'Promotions', js: true do
context 'no license installed' do context 'no license installed' do
before do before do
License.destroy_all License.destroy_all
stub_application_setting(check_namespace_plan: false)
project.team << [user, :master] project.team << [user, :master]
end end
...@@ -39,23 +40,23 @@ describe 'Promotions', js: true do ...@@ -39,23 +40,23 @@ describe 'Promotions', js: true do
end end
end end
describe 'for project features in general for .com', js: true do describe 'for project features in general', js: true do
context 'for .com' do context 'for .com' do
before do before do
stub_application_setting(check_namespace_plan: true) stub_application_setting(check_namespace_plan: true)
allow(Gitlab).to receive(:com?) { true } allow(Gitlab).to receive(:com?) { true }
project.team << [developer, :developer]
project.team << [user, :master] project.team << [user, :master]
project.team << [developer, :developer]
end end
it 'should have the Upgrade your plan button' do it 'should have the Upgrade your plan button' do
sign_in(user) sign_in(user)
visit edit_project_path(project) visit edit_project_path(project)
expect(find('#promote_service_desk')).to have_content 'Upgrade your plan' expect(find('#promote_service_desk')).to have_content 'Upgrade your plan'
end end
it 'should have the contact owner line' do it 'should have the contact owner line' do
sign_in(developer) sign_in(developer)
visit edit_project_path(project) visit edit_project_path(project)
expect(find('#promote_service_desk')).to have_content 'Contact owner' expect(find('#promote_service_desk')).to have_content 'Contact owner'
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