Commit 22481b1a authored by Tim Zallmann's avatar Tim Zallmann

Fixed Linting problems + added more tests

parent db78e9a6
...@@ -13,5 +13,5 @@ ...@@ -13,5 +13,5 @@
%p %p
GitLab Service Desk is a simple way to allow people to create issues in your GitLab instance without needing their own user account. It provides a unique email address for end users to create issues in a project, and replies can be sent either through the GitLab interface or by email. End users will only see the thread through email. GitLab Service Desk is a simple way to allow people to create issues in your GitLab instance without needing their own user account. It provides a unique email address for end users to create issues in a project, and replies can be sent either through the GitLab interface or by email. End users will only see the thread through email.
%a{ href: '/help/user/project/service_desk.html', target: '_blank' } Read more %a{ href: '/help/user/project/service_desk.html', target: '_blank' } Read more
= render 'shared/promotions/promotion_link_project' = render 'shared/promotions/promotion_link_project'
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
= link_to 'Upgrade your plan', upgrade_plan_url, class: 'btn btn-primary' = link_to 'Upgrade your plan', upgrade_plan_url, class: 'btn btn-primary'
- elsif @project.group - elsif @project.group
%p Contact an owner of group #{ @project.group.name } to upgrade the license. %p Contact an owner of group #{ @project.group.name } to upgrade the license.
- else - else
- 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?
......
require 'spec_helper' require 'spec_helper'
describe 'Promotion', js: true do describe 'Promotions', js: true do
let(:admin) { create(:admin) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:developer) { create(:user) }
let(:project) { create(:empty_project, path: 'gitlab', name: 'sample') } let(:project) { create(:empty_project, path: 'gitlab', name: 'sample') }
before do describe 'no promotion shown at all if you have a license', js: true do
sign_in(user) sign_in(user)
project.team << [user, :master] project.team << [user, :master]
visit edit_project_path(project)
expect(page).not_to have_selector('#promote_service_desk')
end end
describe 'for project features in general on premise', js: true do
before do
allow(License).to receive(:current).and_return(nil)
sign_in(user)
project.team << [user, :master]
end
it 'should have the contact admin line' do
expect(find('#promote_service_desk')).to have_content 'Contact your Administrator to upgrade your license.'
end
it 'should have the start trial button' do
sign_in(admin)
visit edit_project_path(project)
expect(find('#promote_service_desk')).to have_content 'Start GitLab Enterprise Edition trial'
end
end
describe 'for project features in general for .com', js: true do
before do
allow(Gitlab).to receive(:com?).and_return(true)
end
it 'should have the Upgrade your plan button' do
sign_in(user)
project.team << [user, :master]
expect(find('#promote_service_desk')).to have_content 'Upgrade your plan'
end
it 'should have the contact owner line' do
sign_in(developer)
project.team << [developer, :developer]
expect(find('#promote_service_desk')).to have_content 'Upgrade your plan'
end
end
describe 'for service desk', js: true do describe 'for service desk', js: true do
before do
sign_in(user)
project.team << [user, :master]
end
it 'should appear in project edit page' do it 'should appear in project edit page' do
visit edit_project_path(project) visit edit_project_path(project)
expect(find('#promote_service_desk')).to have_content 'Improve customer support with GitLab Service Desk.' expect(find('#promote_service_desk')).to have_content 'Improve customer support with GitLab Service Desk.'
expect(find('#promote_service_desk')).to have_content 'GitLab Service Desk is a simple way to allow people to create issues in your GitLab instance without needing their own user account.'
end end
it 'does not show when cookie is set' do it 'does not show when cookie is set' 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