diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /spec/lib/gitlab/email/message/in_product_marketing/experience_spec.rb | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'spec/lib/gitlab/email/message/in_product_marketing/experience_spec.rb')
-rw-r--r-- | spec/lib/gitlab/email/message/in_product_marketing/experience_spec.rb | 69 |
1 files changed, 60 insertions, 9 deletions
diff --git a/spec/lib/gitlab/email/message/in_product_marketing/experience_spec.rb b/spec/lib/gitlab/email/message/in_product_marketing/experience_spec.rb index b742eff3f56..8cd2345822e 100644 --- a/spec/lib/gitlab/email/message/in_product_marketing/experience_spec.rb +++ b/spec/lib/gitlab/email/message/in_product_marketing/experience_spec.rb @@ -22,14 +22,36 @@ RSpec.describe Gitlab::Email::Message::InProductMarketing::Experience do expect(message.cta_text).to be_nil end - describe '#feedback_link' do - let(:member_count) { 2 } + describe 'feedback URL' do + before do + allow(message).to receive(:onboarding_progress).and_return(1) + allow(message).to receive(:show_invite_link).and_return(true) + end + + subject do + message.feedback_link(1) + end + + it { is_expected.to start_with(Gitlab::Saas.com_url) } + + context 'when in development' do + let(:root_url) { 'http://example.com' } + + before do + allow(message).to receive(:root_url).and_return(root_url) + stub_rails_env('development') + end + + it { is_expected.to start_with(root_url) } + end + end + + describe 'feedback URL show_invite_link query param' do let(:user_access) { GroupMember::DEVELOPER } let(:preferred_language) { 'en' } before do allow(message).to receive(:onboarding_progress).and_return(1) - allow(group).to receive(:member_count).and_return(member_count) allow(group).to receive(:max_member_access_for_user).and_return(user_access) allow(user).to receive(:preferred_language).and_return(preferred_language) end @@ -41,12 +63,6 @@ RSpec.describe Gitlab::Email::Message::InProductMarketing::Experience do it { is_expected.to eq('true') } - context 'with only one member' do - let(:member_count) { 1 } - - it { is_expected.to eq('false') } - end - context 'with less than developer access' do let(:user_access) { GroupMember::GUEST } @@ -59,6 +75,41 @@ RSpec.describe Gitlab::Email::Message::InProductMarketing::Experience do it { is_expected.to eq('false') } end end + + describe 'feedback URL show_incentive query param' do + let(:show_invite_link) { true } + let(:member_count) { 2 } + let(:query) do + uri = URI.parse(message.feedback_link(1)) + Rack::Utils.parse_query(uri.query).with_indifferent_access + end + + before do + allow(message).to receive(:onboarding_progress).and_return(1) + allow(message).to receive(:show_invite_link).and_return(show_invite_link) + allow(group).to receive(:member_count).and_return(member_count) + end + + subject { query[:show_incentive] } + + it { is_expected.to eq('true') } + + context 'with only one member' do + let(:member_count) { 1 } + + it "is not present" do + expect(query).not_to have_key(:show_incentive) + end + end + + context 'show_invite_link is false' do + let(:show_invite_link) { false } + + it "is not present" do + expect(query).not_to have_key(:show_incentive) + end + end + end end end end |