Commit ab0b0a5d authored by Tim Zallmann's avatar Tim Zallmann

Fixing Test for on Premise

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