diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-20 00:10:15 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-20 00:10:15 +0000 |
commit | f0e9d20cd8b273b2bbefd8c2cde3f63247feb61c (patch) | |
tree | e1407bcdcaeac8348bc64fdc03800b9ed034bceb /spec | |
parent | 0ea2d99b0bf43878a889cc6aa91443245d05356d (diff) | |
download | gitlab-ce-f0e9d20cd8b273b2bbefd8c2cde3f63247feb61c.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
7 files changed, 3 insertions, 187 deletions
diff --git a/spec/fixtures/product_intelligence/survey_response_schema.json b/spec/fixtures/product_intelligence/survey_response_schema.json deleted file mode 100644 index 03d2d170137..00000000000 --- a/spec/fixtures/product_intelligence/survey_response_schema.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "description": "Schema for a Gitlab survey_response event", - "self": { - "vendor": "com.gitlab", - "name": "survey_response", - "version": "1-0-1", - "format": "jsonschema" - }, - "type": "object", - "additionalProperties": false, - "required": ["survey_id", "response"], - "properties": { - "survey_id": { - "description": "Survey ID", - "type": "integer", - "minimum": 0, - "maximum": 2147483647 - }, - "response": { - "description": "Response", - "type": "string", - "maxLength": 10000 - }, - "instance_id": { - "description": "Instance ID", - "type": ["integer", "null"], - "minimum": 0, - "maximum": 2147483647 - }, - "user_id": { - "description": "User ID", - "type": ["integer", "null"], - "minimum": 0, - "maximum": 2147483647 - }, - "email": { - "description": "Email", - "type": ["string", "null"], - "maxLength": 255 - }, - "name": { - "description": "Name", - "type": ["string", "null"], - "maxLength": 255 - }, - "username": { - "description": "Username", - "type": ["string", "null"], - "maxLength": 255 - }, - "onboarding_progress": { - "description": "Onboarding progress", - "type": ["integer", "null"], - "minimum": 0, - "maximum": 2147483647 - } - } -} diff --git a/spec/lib/gitlab/email/message/in_product_marketing/base_spec.rb b/spec/lib/gitlab/email/message/in_product_marketing/base_spec.rb index dfa18c27d5e..ab6b1cd6171 100644 --- a/spec/lib/gitlab/email/message/in_product_marketing/base_spec.rb +++ b/spec/lib/gitlab/email/message/in_product_marketing/base_spec.rb @@ -99,7 +99,6 @@ RSpec.describe Gitlab::Email::Message::InProductMarketing::Base do :verify | true :trial | true :team | true - :experience | true end with_them do 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 deleted file mode 100644 index 8cd2345822e..00000000000 --- a/spec/lib/gitlab/email/message/in_product_marketing/experience_spec.rb +++ /dev/null @@ -1,115 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Gitlab::Email::Message::InProductMarketing::Experience do - let_it_be(:group) { build(:group) } - let_it_be(:user) { build(:user) } - - subject(:message) { described_class.new(group: group, user: user, series: series)} - - describe 'public methods' do - context 'with series 0' do - let(:series) { 0 } - - it 'returns value for series', :aggregate_failures do - expect(message.subject_line).to be_present - expect(message.tagline).to be_nil - expect(message.title).to be_present - expect(message.subtitle).to be_present - expect(message.body_line1).to be_present - expect(message.body_line2).to be_present - expect(message.cta_text).to be_nil - end - - 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(:max_member_access_for_user).and_return(user_access) - allow(user).to receive(:preferred_language).and_return(preferred_language) - end - - subject do - uri = URI.parse(message.feedback_link(1)) - Rack::Utils.parse_query(uri.query).with_indifferent_access[:show_invite_link] - end - - it { is_expected.to eq('true') } - - context 'with less than developer access' do - let(:user_access) { GroupMember::GUEST } - - it { is_expected.to eq('false') } - end - - context 'with preferred language other than English' do - let(:preferred_language) { 'nl' } - - 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 diff --git a/spec/lib/gitlab/email/message/in_product_marketing_spec.rb b/spec/lib/gitlab/email/message/in_product_marketing_spec.rb index 40351bef8b9..1c59d9c8208 100644 --- a/spec/lib/gitlab/email/message/in_product_marketing_spec.rb +++ b/spec/lib/gitlab/email/message/in_product_marketing_spec.rb @@ -17,7 +17,6 @@ RSpec.describe Gitlab::Email::Message::InProductMarketing do :verify | described_class::Verify :trial | described_class::Trial :team | described_class::Team - :experience | described_class::Experience end with_them do diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb index 21b9a1b9455..6eb00053b17 100644 --- a/spec/lib/gitlab/usage_data_spec.rb +++ b/spec/lib/gitlab/usage_data_spec.rb @@ -1309,8 +1309,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do "in_product_marketing_email_team_1_sent" => -1, "in_product_marketing_email_team_1_cta_clicked" => -1, "in_product_marketing_email_team_2_sent" => -1, - "in_product_marketing_email_team_2_cta_clicked" => -1, - "in_product_marketing_email_experience_0_sent" => -1 + "in_product_marketing_email_team_2_cta_clicked" => -1 } expect(subject).to eq(expected_data) @@ -1355,8 +1354,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do "in_product_marketing_email_team_1_sent" => 0, "in_product_marketing_email_team_1_cta_clicked" => 0, "in_product_marketing_email_team_2_sent" => 0, - "in_product_marketing_email_team_2_cta_clicked" => 0, - "in_product_marketing_email_experience_0_sent" => 0 + "in_product_marketing_email_team_2_cta_clicked" => 0 } expect(subject).to eq(expected_data) diff --git a/spec/mailers/emails/in_product_marketing_spec.rb b/spec/mailers/emails/in_product_marketing_spec.rb index 7f3896a3d51..7c21e161ffe 100644 --- a/spec/mailers/emails/in_product_marketing_spec.rb +++ b/spec/mailers/emails/in_product_marketing_spec.rb @@ -65,7 +65,6 @@ RSpec.describe Emails::InProductMarketing do :team | 0 :team | 1 :team | 2 - :experience | 0 :team_short | 0 :trial_short | 0 :admin_verify | 0 @@ -83,12 +82,7 @@ RSpec.describe Emails::InProductMarketing do is_expected.to have_subject(message.subject_line) is_expected.to have_body_text(message.title) is_expected.to have_body_text(message.subtitle) - - if track == :experience - is_expected.to have_body_text(CGI.unescapeHTML(message.feedback_link(1))) - else - is_expected.to have_body_text(CGI.unescapeHTML(message.cta_link)) - end + is_expected.to have_body_text(CGI.unescapeHTML(message.cta_link)) if track =~ /(create|verify)/ is_expected.to have_body_text(message.invite_text) diff --git a/spec/services/namespaces/in_product_marketing_emails_service_spec.rb b/spec/services/namespaces/in_product_marketing_emails_service_spec.rb index de84666ca1d..b44c256802f 100644 --- a/spec/services/namespaces/in_product_marketing_emails_service_spec.rb +++ b/spec/services/namespaces/in_product_marketing_emails_service_spec.rb @@ -54,7 +54,6 @@ RSpec.describe Namespaces::InProductMarketingEmailsService, '#execute' do :team | 1 | { created_at: frozen_time - 2.days, git_write_at: frozen_time - 2.days, pipeline_created_at: frozen_time - 2.days, trial_started_at: frozen_time - 2.days } :team | 5 | { created_at: frozen_time - 6.days, git_write_at: frozen_time - 6.days, pipeline_created_at: frozen_time - 6.days, trial_started_at: frozen_time - 6.days } :team | 10 | { created_at: frozen_time - 11.days, git_write_at: frozen_time - 11.days, pipeline_created_at: frozen_time - 11.days, trial_started_at: frozen_time - 11.days } - :experience | 30 | { created_at: frozen_time - 31.days, git_write_at: frozen_time - 31.days } end with_them do |