diff --git a/.rubocop.yml b/.rubocop.yml index badaa0fa929db93c5895c40a43f5186654e5c47f..ee7a25c63d1e5f81585b3bbdf67355191e524860 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -541,7 +541,7 @@ Gitlab/RSpec/AvoidSetup: Enabled: true Include: - 'ee/spec/features/registrations/saas/**/*' - - 'ee/spec/features/trials/saas/**/*' + - 'ee/spec/features/gitlab_subscriptions/trials/creation_*' - 'ee/spec/features/gitlab_subscriptions/trials/duo_pro/**/*' - 'ee/spec/features/gitlab_subscriptions/trials/duo_enterprise/**/*' diff --git a/.rubocop_todo/gitlab/strong_memoize_attr.yml b/.rubocop_todo/gitlab/strong_memoize_attr.yml index 9b5f2147e57920d07331aa5b8fdf3ff0a1bf367f..7d4332cce1a08302f5eb2de9cde95cca8b423962 100644 --- a/.rubocop_todo/gitlab/strong_memoize_attr.yml +++ b/.rubocop_todo/gitlab/strong_memoize_attr.yml @@ -257,7 +257,7 @@ Gitlab/StrongMemoizeAttr: - 'ee/app/helpers/ee/preferences_helper.rb' - 'ee/app/helpers/ee/timeboxes_helper.rb' - 'ee/app/helpers/subscriptions_helper.rb' - - 'ee/app/helpers/trials_helper.rb' + - 'ee/app/helpers/gitlab_subscriptions/trials_helper.rb' - 'ee/app/models/approval_merge_request_rule.rb' - 'ee/app/models/approval_state.rb' - 'ee/app/models/approval_wrapped_any_approver_rule.rb' diff --git a/.rubocop_todo/layout/line_end_string_concatenation_indentation.yml b/.rubocop_todo/layout/line_end_string_concatenation_indentation.yml index 8410a2d1399d8ac1e18f6ea2fdab3146ad77cb6b..dcf2b67711c7ac4df5c46f50e99a9b7eb00dc825 100644 --- a/.rubocop_todo/layout/line_end_string_concatenation_indentation.yml +++ b/.rubocop_todo/layout/line_end_string_concatenation_indentation.yml @@ -398,7 +398,7 @@ Layout/LineEndStringConcatenationIndentation: - 'ee/spec/requests/api/projects_spec.rb' - 'ee/spec/requests/groups/protected_environments_controller_spec.rb' - 'ee/spec/requests/gitlab_subscriptions/trials/duo_pro_controller_spec.rb' - - 'ee/spec/requests/subscriptions/trials_controller_spec.rb' + - 'ee/spec/requests/gitlab_subscriptions/trials_controller_spec.rb' - 'ee/spec/requests/users/registrations_identity_verification_controller_spec.rb' - 'ee/spec/serializers/integrations/field_entity_spec.rb' - 'ee/spec/services/ai/store_repository_xray_service_spec.rb' diff --git a/.rubocop_todo/rails/strong_params.yml b/.rubocop_todo/rails/strong_params.yml index 393ef2a42f5b2a6dfc6dbee2a5cf9db7ecaa3f7d..50954f6eed22eb330a3534d22955dd6174a73db2 100644 --- a/.rubocop_todo/rails/strong_params.yml +++ b/.rubocop_todo/rails/strong_params.yml @@ -332,7 +332,7 @@ Rails/StrongParams: - 'ee/app/controllers/smartcard_controller.rb' - 'ee/app/controllers/subscriptions/groups_controller.rb' - 'ee/app/controllers/subscriptions/hand_raise_leads_controller.rb' - - 'ee/app/controllers/subscriptions/trials_controller.rb' + - 'ee/app/controllers/gitlab_subscriptions/trials_controller.rb' - 'ee/app/controllers/subscriptions_controller.rb' - 'ee/app/controllers/users/base_identity_verification_controller.rb' - 'ee/app/controllers/users/registrations_identity_verification_controller.rb' diff --git a/.rubocop_todo/rspec/factory_bot/avoid_create.yml b/.rubocop_todo/rspec/factory_bot/avoid_create.yml index 11d3bd34fbfb68ed7ba9a2d5ae3d64fcaf87c19f..3725d0c5a2f7604d95e4f7f3a34c58e3d0403b86 100644 --- a/.rubocop_todo/rspec/factory_bot/avoid_create.yml +++ b/.rubocop_todo/rspec/factory_bot/avoid_create.yml @@ -70,7 +70,7 @@ RSpec/FactoryBot/AvoidCreate: - 'ee/spec/helpers/security_helper_spec.rb' - 'ee/spec/helpers/subscriptions_helper_spec.rb' - 'ee/spec/helpers/timeboxes_helper_spec.rb' - - 'ee/spec/helpers/trials_helper_spec.rb' + - 'ee/spec/helpers/gitlab_subscriptions/trials_helper_spec.rb' - 'ee/spec/helpers/users/identity_verification_helper_spec.rb' - 'ee/spec/helpers/users_helper_spec.rb' - 'ee/spec/helpers/vulnerabilities_helper_spec.rb' diff --git a/.rubocop_todo/rspec/named_subject.yml b/.rubocop_todo/rspec/named_subject.yml index 61e3b8f9b307846c1e28d2a8adb731e1ecd300a2..a8e5194b6735090f1689155162c1d9a576fdb079 100644 --- a/.rubocop_todo/rspec/named_subject.yml +++ b/.rubocop_todo/rspec/named_subject.yml @@ -206,7 +206,7 @@ RSpec/NamedSubject: - 'ee/spec/helpers/projects_helper_spec.rb' - 'ee/spec/helpers/search_helper_spec.rb' - 'ee/spec/helpers/secrets_helper_spec.rb' - - 'ee/spec/helpers/trials_helper_spec.rb' + - 'ee/spec/helpers/gitlab_subscriptions/trials_helper_spec.rb' - 'ee/spec/helpers/users/group_callouts_helper_spec.rb' - 'ee/spec/helpers/users_helper_spec.rb' - 'ee/spec/helpers/vulnerabilities_helper_spec.rb' diff --git a/.rubocop_todo/style/inline_disable_annotation.yml b/.rubocop_todo/style/inline_disable_annotation.yml index fd15c534ebe46acd8dea5421937a166e97e04b7b..4e19b0cdcfa6d767bb7986bd198c9b6c00ba8e85 100644 --- a/.rubocop_todo/style/inline_disable_annotation.yml +++ b/.rubocop_todo/style/inline_disable_annotation.yml @@ -1758,9 +1758,6 @@ Style/InlineDisableAnnotation: - 'ee/spec/features/registrations/saas/standard_flow_with_2fa_spec.rb' - 'ee/spec/features/subscriptions/subscription_flow_for_existing_user_with_eligible_group_spec.rb' - 'ee/spec/features/trials/lead_creation_form_validation_spec.rb' - - 'ee/spec/features/trials/saas/creation_with_multiple_existing_namespace_flow_spec.rb' - - 'ee/spec/features/trials/saas/creation_with_no_existing_namespace_flow_spec.rb' - - 'ee/spec/features/trials/saas/creation_with_one_existing_namespace_flow_spec.rb' - 'ee/spec/finders/audit_event_finder_spec.rb' - 'ee/spec/finders/ee/group_members_finder_spec.rb' - 'ee/spec/helpers/analytics/analytics_dashboards_helper_spec.rb' diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml index b2022f9ae8eac4437b573af8baea670ed01a5e5b..8d01876cf2bfc61cffb68984de5d7a6b46c3613a 100644 --- a/app/views/groups/show.html.haml +++ b/app/views/groups/show.html.haml @@ -19,7 +19,7 @@ = render partial: 'flash_messages' -= render_if_exists 'subscriptions/trials/alert', namespace: @group += render_if_exists 'gitlab_subscriptions/trials/alert', namespace: @group = render 'groups/home_panel' diff --git a/ee/app/assets/javascripts/pages/subscriptions/trials/create/index.js b/ee/app/assets/javascripts/pages/gitlab_subscriptions/trials/create/index.js similarity index 100% rename from ee/app/assets/javascripts/pages/subscriptions/trials/create/index.js rename to ee/app/assets/javascripts/pages/gitlab_subscriptions/trials/create/index.js diff --git a/ee/app/assets/javascripts/pages/subscriptions/trials/new/index.js b/ee/app/assets/javascripts/pages/gitlab_subscriptions/trials/new/index.js similarity index 100% rename from ee/app/assets/javascripts/pages/subscriptions/trials/new/index.js rename to ee/app/assets/javascripts/pages/gitlab_subscriptions/trials/new/index.js diff --git a/ee/app/assets/javascripts/pages/subscriptions/trials/index.js b/ee/app/assets/javascripts/pages/subscriptions/trials/index.js deleted file mode 100644 index 680ebd19a9fc50f7d1ba90a6d852577a204e3d52..0000000000000000000000000000000000000000 --- a/ee/app/assets/javascripts/pages/subscriptions/trials/index.js +++ /dev/null @@ -1 +0,0 @@ -import '~/pages/sessions/index'; diff --git a/ee/app/controllers/subscriptions/trials_controller.rb b/ee/app/controllers/gitlab_subscriptions/trials_controller.rb similarity index 97% rename from ee/app/controllers/subscriptions/trials_controller.rb rename to ee/app/controllers/gitlab_subscriptions/trials_controller.rb index e4bbfaaaad3a1a3ae0c395ce80400bb24cb82529..45387132ee004e12c1c0f881d2c24591ec8fdec3 100644 --- a/ee/app/controllers/subscriptions/trials_controller.rb +++ b/ee/app/controllers/gitlab_subscriptions/trials_controller.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # EE:SaaS -module Subscriptions +module GitlabSubscriptions class TrialsController < ApplicationController include OneTrustCSP include GoogleAnalyticsCSP @@ -99,4 +99,4 @@ def check_feature_available! end end -Subscriptions::TrialsController.prepend_mod +GitlabSubscriptions::TrialsController.prepend_mod diff --git a/ee/app/helpers/gitlab_subscriptions/trials_helper.rb b/ee/app/helpers/gitlab_subscriptions/trials_helper.rb new file mode 100644 index 0000000000000000000000000000000000000000..a8af5837ef70a1460d9c29a2e089d60fdc714fac --- /dev/null +++ b/ee/app/helpers/gitlab_subscriptions/trials_helper.rb @@ -0,0 +1,178 @@ +# frozen_string_literal: true + +module GitlabSubscriptions + module TrialsHelper + TRIAL_ONBOARDING_SOURCE_URLS = %w[about.gitlab.com docs.gitlab.com learn.gitlab.com].freeze + + def create_lead_form_data + _lead_form_data.merge( + submit_path: trials_path( + step: GitlabSubscriptions::Trials::CreateService::LEAD, **params.permit(:namespace_id).merge(glm_params) + ), + submit_button_text: s_('Trial|Start free GitLab Ultimate trial') + ) + end + + def create_duo_pro_lead_form_data + _lead_form_data.merge( + submit_path: trials_duo_pro_path( + step: GitlabSubscriptions::Trials::CreateDuoProService::LEAD, + namespace_id: params[:namespace_id] + ), + submit_button_text: s_('Trial|Continue') + ) + end + + def create_duo_enterprise_lead_form_data(eligible_namespaces) + _lead_form_data.merge( + submit_path: trials_duo_enterprise_path( + step: GitlabSubscriptions::Trials::CreateDuoEnterpriseService::LEAD, + namespace_id: params[:namespace_id] + ), + submit_button_text: trial_submit_text(eligible_namespaces) + ) + end + + def create_company_form_data(onboarding_status) + submit_params = glm_params.merge(passed_through_params.to_unsafe_h) + { + submit_path: users_sign_up_company_path(submit_params), + first_name: current_user.first_name, + last_name: current_user.last_name, + initial_trial: onboarding_status.initial_trial?.to_s + } + end + + def should_ask_company_question? + TRIAL_ONBOARDING_SOURCE_URLS.exclude?(glm_params[:glm_source]) + end + + def glm_params + strong_memoize(:glm_params) do + params.slice(:glm_source, :glm_content).to_unsafe_h + end + end + + def trial_namespace_selector_data(namespace_create_errors) + namespace_selector_data(namespace_create_errors).merge( + any_trial_eligible_namespaces: any_trial_eligible_namespaces?.to_s, + items: namespace_options_for_listbox(trial_eligible_namespaces).to_json + ) + end + + def duo_trial_namespace_selector_data(namespaces, namespace_create_errors) + namespace_selector_data(namespace_create_errors).merge( + any_trial_eligible_namespaces: namespaces.any?.to_s, + items: current_namespaces_for_selector(namespaces).to_json + ) + end + + def glm_source + ::Gitlab.config.gitlab.host + end + + def trial_selection_intro_text + if any_trial_eligible_namespaces? + s_('Trials|You can apply your trial to a new group or an existing group.') + else + s_('Trials|Create a new group to start your GitLab Ultimate trial.') + end + end + + def show_tier_badge_for_new_trial?(namespace, user) + ::Gitlab::Saas.feature_available?(:subscriptions_trials) && + !namespace.paid? && + namespace.private? && + namespace.never_had_trial? && + can?(user, :read_billing, namespace) + end + + def namespace_options_for_listbox(namespaces) + group_options = current_namespaces_for_selector(namespaces) + options = [ + { + text: _('New'), + options: [ + { + text: _('Create group'), + value: '0' + } + ] + } + ] + + options.push(text: _('Groups'), options: group_options) unless group_options.empty? + + options + end + + def trial_form_errors_message(result) + unless result.reason == GitlabSubscriptions::Trials::BaseApplyTrialService::GENERIC_TRIAL_ERROR + return result.errors.to_sentence + end + + support_link_url = 'https://support.gitlab.com/hc/en-us' + support_link = link_to('', support_link_url, target: '_blank', + rel: 'noopener noreferrer') + safe_format( + _('Please try again or reach out to %{support_link_start}GitLab Support%{support_link_end}.'), + tag_pair(support_link, :support_link_start, :support_link_end) + ) + end + + private + + def trial_submit_text(eligible_namespaces) + if GitlabSubscriptions::Trials.single_eligible_namespace?(eligible_namespaces) + s_('Trial|Activate my trial') + else + s_('Trial|Continue') + end + end + + def current_namespaces_for_selector(namespaces) + namespaces.map { |n| { text: n.name, value: n.id.to_s } } + end + + def passed_through_params + params.slice( + :trial, + :role, + :registration_objective, + :jobs_to_be_done_other, + :opt_in + ) + end + + def trial_eligible_namespaces + current_user.manageable_namespaces_eligible_for_trial + end + + def any_trial_eligible_namespaces? + trial_eligible_namespaces.any? + end + + def _lead_form_data + { + first_name: current_user.first_name, + last_name: current_user.last_name, + company_name: current_user.organization + }.merge( + params.permit( + :first_name, :last_name, :company_name, :company_size, :phone_number, :country, :state + ).to_h.symbolize_keys + ) + end + + def namespace_selector_data(namespace_create_errors) + { + new_group_name: params[:new_group_name], + # This may allow through an unprivileged submission of trial since we don't validate access on the passed in + # namespace_id. + # That is ok since we validate this on submission. + initial_value: params[:namespace_id], + namespace_create_errors: namespace_create_errors + } + end + end +end diff --git a/ee/app/helpers/trials_helper.rb b/ee/app/helpers/trials_helper.rb deleted file mode 100644 index 5c5a08054c0abb5e405e8ff7a06e46b13f7cc7b2..0000000000000000000000000000000000000000 --- a/ee/app/helpers/trials_helper.rb +++ /dev/null @@ -1,176 +0,0 @@ -# frozen_string_literal: true - -module TrialsHelper - TRIAL_ONBOARDING_SOURCE_URLS = %w[about.gitlab.com docs.gitlab.com learn.gitlab.com].freeze - - def create_lead_form_data - _lead_form_data.merge( - submit_path: trials_path( - step: GitlabSubscriptions::Trials::CreateService::LEAD, **params.permit(:namespace_id).merge(glm_params) - ), - submit_button_text: s_('Trial|Start free GitLab Ultimate trial') - ) - end - - def create_duo_pro_lead_form_data - _lead_form_data.merge( - submit_path: trials_duo_pro_path( - step: GitlabSubscriptions::Trials::CreateDuoProService::LEAD, - namespace_id: params[:namespace_id] - ), - submit_button_text: s_('Trial|Continue') - ) - end - - def create_duo_enterprise_lead_form_data(eligible_namespaces) - _lead_form_data.merge( - submit_path: trials_duo_enterprise_path( - step: GitlabSubscriptions::Trials::CreateDuoEnterpriseService::LEAD, - namespace_id: params[:namespace_id] - ), - submit_button_text: trial_submit_text(eligible_namespaces) - ) - end - - def create_company_form_data(onboarding_status) - submit_params = glm_params.merge(passed_through_params.to_unsafe_h) - { - submit_path: users_sign_up_company_path(submit_params), - first_name: current_user.first_name, - last_name: current_user.last_name, - initial_trial: onboarding_status.initial_trial?.to_s - } - end - - def should_ask_company_question? - TRIAL_ONBOARDING_SOURCE_URLS.exclude?(glm_params[:glm_source]) - end - - def glm_params - strong_memoize(:glm_params) do - params.slice(:glm_source, :glm_content).to_unsafe_h - end - end - - def trial_namespace_selector_data(namespace_create_errors) - namespace_selector_data(namespace_create_errors).merge( - any_trial_eligible_namespaces: any_trial_eligible_namespaces?.to_s, - items: namespace_options_for_listbox(trial_eligible_namespaces).to_json - ) - end - - def duo_trial_namespace_selector_data(namespaces, namespace_create_errors) - namespace_selector_data(namespace_create_errors).merge( - any_trial_eligible_namespaces: namespaces.any?.to_s, - items: current_namespaces_for_selector(namespaces).to_json - ) - end - - def glm_source - ::Gitlab.config.gitlab.host - end - - def trial_selection_intro_text - if any_trial_eligible_namespaces? - s_('Trials|You can apply your trial to a new group or an existing group.') - else - s_('Trials|Create a new group to start your GitLab Ultimate trial.') - end - end - - def show_tier_badge_for_new_trial?(namespace, user) - ::Gitlab::Saas.feature_available?(:subscriptions_trials) && - !namespace.paid? && - namespace.private? && - namespace.never_had_trial? && - can?(user, :read_billing, namespace) - end - - def namespace_options_for_listbox(namespaces) - group_options = current_namespaces_for_selector(namespaces) - options = [ - { - text: _('New'), - options: [ - { - text: _('Create group'), - value: '0' - } - ] - } - ] - - options.push(text: _('Groups'), options: group_options) unless group_options.empty? - - options - end - - def trial_form_errors_message(result) - unless result.reason == GitlabSubscriptions::Trials::BaseApplyTrialService::GENERIC_TRIAL_ERROR - return result.errors.to_sentence - end - - support_link_url = 'https://support.gitlab.com/hc/en-us' - support_link = link_to('', support_link_url, target: '_blank', - rel: 'noopener noreferrer') - safe_format( - _('Please try again or reach out to %{support_link_start}GitLab Support%{support_link_end}.'), - tag_pair(support_link, :support_link_start, :support_link_end) - ) - end - - private - - def trial_submit_text(eligible_namespaces) - if GitlabSubscriptions::Trials.single_eligible_namespace?(eligible_namespaces) - s_('Trial|Activate my trial') - else - s_('Trial|Continue') - end - end - - def current_namespaces_for_selector(namespaces) - namespaces.map { |n| { text: n.name, value: n.id.to_s } } - end - - def passed_through_params - params.slice( - :trial, - :role, - :registration_objective, - :jobs_to_be_done_other, - :opt_in - ) - end - - def trial_eligible_namespaces - current_user.manageable_namespaces_eligible_for_trial - end - - def any_trial_eligible_namespaces? - trial_eligible_namespaces.any? - end - - def _lead_form_data - { - first_name: current_user.first_name, - last_name: current_user.last_name, - company_name: current_user.organization - }.merge( - params.permit( - :first_name, :last_name, :company_name, :company_size, :phone_number, :country, :state - ).to_h.symbolize_keys - ) - end - - def namespace_selector_data(namespace_create_errors) - { - new_group_name: params[:new_group_name], - # This may allow through an unprivileged submission of trial since we don't validate access on the passed in - # namespace_id. - # That is ok since we validate this on submission. - initial_value: params[:namespace_id], - namespace_create_errors: namespace_create_errors - } - end -end diff --git a/ee/app/views/subscriptions/trials/_alert.html.haml b/ee/app/views/gitlab_subscriptions/trials/_alert.html.haml similarity index 100% rename from ee/app/views/subscriptions/trials/_alert.html.haml rename to ee/app/views/gitlab_subscriptions/trials/_alert.html.haml diff --git a/ee/app/views/subscriptions/trials/_form_errors.html.haml b/ee/app/views/gitlab_subscriptions/trials/_form_errors.html.haml similarity index 100% rename from ee/app/views/subscriptions/trials/_form_errors.html.haml rename to ee/app/views/gitlab_subscriptions/trials/_form_errors.html.haml diff --git a/ee/app/views/subscriptions/trials/_lead_form.html.haml b/ee/app/views/gitlab_subscriptions/trials/_lead_form.html.haml similarity index 100% rename from ee/app/views/subscriptions/trials/_lead_form.html.haml rename to ee/app/views/gitlab_subscriptions/trials/_lead_form.html.haml diff --git a/ee/app/views/subscriptions/trials/_select_namespace_form.html.haml b/ee/app/views/gitlab_subscriptions/trials/_select_namespace_form.html.haml similarity index 100% rename from ee/app/views/subscriptions/trials/_select_namespace_form.html.haml rename to ee/app/views/gitlab_subscriptions/trials/_select_namespace_form.html.haml diff --git a/ee/app/views/subscriptions/trials/step_lead.html.haml b/ee/app/views/gitlab_subscriptions/trials/step_lead.html.haml similarity index 100% rename from ee/app/views/subscriptions/trials/step_lead.html.haml rename to ee/app/views/gitlab_subscriptions/trials/step_lead.html.haml diff --git a/ee/app/views/subscriptions/trials/step_lead_failed.html.haml b/ee/app/views/gitlab_subscriptions/trials/step_lead_failed.html.haml similarity index 100% rename from ee/app/views/subscriptions/trials/step_lead_failed.html.haml rename to ee/app/views/gitlab_subscriptions/trials/step_lead_failed.html.haml diff --git a/ee/app/views/subscriptions/trials/step_namespace.html.haml b/ee/app/views/gitlab_subscriptions/trials/step_namespace.html.haml similarity index 100% rename from ee/app/views/subscriptions/trials/step_namespace.html.haml rename to ee/app/views/gitlab_subscriptions/trials/step_namespace.html.haml diff --git a/ee/app/views/subscriptions/trials/step_namespace_failed.html.haml b/ee/app/views/gitlab_subscriptions/trials/step_namespace_failed.html.haml similarity index 100% rename from ee/app/views/subscriptions/trials/step_namespace_failed.html.haml rename to ee/app/views/gitlab_subscriptions/trials/step_namespace_failed.html.haml diff --git a/ee/app/views/subscriptions/trials/trial_failed.html.haml b/ee/app/views/gitlab_subscriptions/trials/trial_failed.html.haml similarity index 100% rename from ee/app/views/subscriptions/trials/trial_failed.html.haml rename to ee/app/views/gitlab_subscriptions/trials/trial_failed.html.haml diff --git a/ee/app/views/profiles/billings/_billing_plan_header.html.haml b/ee/app/views/profiles/billings/_billing_plan_header.html.haml index ae1a6bfe0dbb6af6fe94b1fe984ea269fe6c4a20..de3d22238fa53d12f4ce820bed20e62b584db90c 100644 --- a/ee/app/views/profiles/billings/_billing_plan_header.html.haml +++ b/ee/app/views/profiles/billings/_billing_plan_header.html.haml @@ -1,4 +1,4 @@ -= render 'subscriptions/trials/alert', namespace: namespace += render 'gitlab_subscriptions/trials/alert', namespace: namespace .billing-plan-header.content-block.gl-text-center .billing-plan-logo diff --git a/ee/config/routes/gitlab_subscriptions.rb b/ee/config/routes/gitlab_subscriptions.rb index d924d0c2c97df5a3929d9e26dd9ce492d22f710e..8c33d089eafa4cc26cf85ce06ead43f850c2057b 100644 --- a/ee/config/routes/gitlab_subscriptions.rb +++ b/ee/config/routes/gitlab_subscriptions.rb @@ -5,4 +5,6 @@ resource :duo_pro, only: [:new, :create] resource :duo_enterprise, only: [:new, :create] end + + resources :trials, only: [:new, :create] end diff --git a/ee/config/routes/subscription.rb b/ee/config/routes/subscription.rb index 469adfff2cc93ce42c6beeb3137e4e5480117f3b..aed89ba2f64ec595edb0b4cbe3db7bf6b394599c 100644 --- a/ee/config/routes/subscription.rb +++ b/ee/config/routes/subscription.rb @@ -12,7 +12,3 @@ resources :hand_raise_leads, only: :create end end - -scope module: :subscriptions do - resources :trials, only: [:new, :create] -end diff --git a/ee/spec/features/trials/saas/creation_with_multiple_existing_namespace_flow_spec.rb b/ee/spec/features/gitlab_subscriptions/trials/creation_with_multiple_existing_namespace_flow_spec.rb similarity index 98% rename from ee/spec/features/trials/saas/creation_with_multiple_existing_namespace_flow_spec.rb rename to ee/spec/features/gitlab_subscriptions/trials/creation_with_multiple_existing_namespace_flow_spec.rb index fb63b0d68550a0f9d656bb0fe83abe0d53b2b734..477e9a5d935a0a7980e1aea2aabf2e6336f006d1 100644 --- a/ee/spec/features/trials/saas/creation_with_multiple_existing_namespace_flow_spec.rb +++ b/ee/spec/features/gitlab_subscriptions/trials/creation_with_multiple_existing_namespace_flow_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' RSpec.describe 'Trial lead submission and creation with multiple eligible namespaces', :saas_trial, :js, feature_category: :acquisition do - let_it_be(:user) { create(:user) } # rubocop:disable Gitlab/RSpec/AvoidSetup - let_it_be(:group) do # rubocop:disable Gitlab/RSpec/AvoidSetup + let_it_be(:user) { create(:user) } # rubocop:disable Gitlab/RSpec/AvoidSetup -- to skip registration and creating group + let_it_be(:group) do # rubocop:disable Gitlab/RSpec/AvoidSetup -- to skip registration and creating group create(:group, owners: user) create(:group, name: 'gitlab', owners: user) end diff --git a/ee/spec/features/trials/saas/creation_with_no_existing_namespace_flow_spec.rb b/ee/spec/features/gitlab_subscriptions/trials/creation_with_no_existing_namespace_flow_spec.rb similarity index 100% rename from ee/spec/features/trials/saas/creation_with_no_existing_namespace_flow_spec.rb rename to ee/spec/features/gitlab_subscriptions/trials/creation_with_no_existing_namespace_flow_spec.rb diff --git a/ee/spec/features/trials/saas/creation_with_one_existing_namespace_flow_spec.rb b/ee/spec/features/gitlab_subscriptions/trials/creation_with_one_existing_namespace_flow_spec.rb similarity index 95% rename from ee/spec/features/trials/saas/creation_with_one_existing_namespace_flow_spec.rb rename to ee/spec/features/gitlab_subscriptions/trials/creation_with_one_existing_namespace_flow_spec.rb index cab3cf6d60fdf2151446d0b0195fdc0962edd34b..b64b04e065788a20e13c78ce3f65d074bc11cd6e 100644 --- a/ee/spec/features/trials/saas/creation_with_one_existing_namespace_flow_spec.rb +++ b/ee/spec/features/gitlab_subscriptions/trials/creation_with_one_existing_namespace_flow_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' RSpec.describe 'Trial lead submission and creation with one eligible namespace', :saas_trial, :js, feature_category: :plan_provisioning do - let_it_be(:user) { create(:user) } # rubocop:disable Gitlab/RSpec/AvoidSetup - let_it_be(:group) { create(:group, name: 'gitlab', owners: user) } # rubocop:disable Gitlab/RSpec/AvoidSetup + let_it_be(:user) { create(:user) } # rubocop:disable Gitlab/RSpec/AvoidSetup -- to skip registration and creating group + let_it_be(:group) { create(:group, name: 'gitlab', owners: user) } # rubocop:disable Gitlab/RSpec/AvoidSetup -- to skip registration and creating group context 'when creating lead and applying trial is successful' do it 'fills out form, submits and lands on the group page' do diff --git a/ee/spec/helpers/trials_helper_spec.rb b/ee/spec/helpers/gitlab_subscriptions/trials_helper_spec.rb similarity index 99% rename from ee/spec/helpers/trials_helper_spec.rb rename to ee/spec/helpers/gitlab_subscriptions/trials_helper_spec.rb index fde5156acf36a88276cf6c4e8680ac805431ba5a..5ddae7c651c50f5db5e35dfeec7d3a83f0066af8 100644 --- a/ee/spec/helpers/trials_helper_spec.rb +++ b/ee/spec/helpers/gitlab_subscriptions/trials_helper_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe TrialsHelper, feature_category: :acquisition do +RSpec.describe GitlabSubscriptions::TrialsHelper, feature_category: :acquisition do using RSpec::Parameterized::TableSyntax describe '#create_lead_form_data' do diff --git a/ee/spec/requests/subscriptions/trials_controller_spec.rb b/ee/spec/requests/gitlab_subscriptions/trials_controller_spec.rb similarity index 99% rename from ee/spec/requests/subscriptions/trials_controller_spec.rb rename to ee/spec/requests/gitlab_subscriptions/trials_controller_spec.rb index b482fb461e35f5e4c563032435a23333085fbe15..4dabbc421bb238fdfefa4f98ef637cbe6596a6d4 100644 --- a/ee/spec/requests/subscriptions/trials_controller_spec.rb +++ b/ee/spec/requests/gitlab_subscriptions/trials_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Subscriptions::TrialsController, feature_category: :plan_provisioning do +RSpec.describe GitlabSubscriptions::TrialsController, feature_category: :plan_provisioning do let_it_be(:user, reload: true) { create(:user) } let(:glm_params) { { glm_source: '_glm_source_', glm_content: '_glm_content_' } } let(:subscriptions_trials_enabled) { true } diff --git a/qa/qa/ee/page/alert/free_trial.rb b/qa/qa/ee/page/alert/free_trial.rb index 08d679c676292cd779c8bd7d5919f9fc4abd8373..2bfd54d85e50e1db6d96af38a95f1d85ed616e9f 100644 --- a/qa/qa/ee/page/alert/free_trial.rb +++ b/qa/qa/ee/page/alert/free_trial.rb @@ -10,7 +10,7 @@ module FreeTrial def self.included(base) super - base.view 'ee/app/views/subscriptions/trials/_alert.html.haml' do + base.view 'ee/app/views/gitlab_subscriptions/trials/_alert.html.haml' do element 'trial-activated-content' end end diff --git a/qa/qa/ee/page/trials/select.rb b/qa/qa/ee/page/trials/select.rb index cd57bfd030d1fc20623de47982b00811628faf62..09e12f97d49449fb2c47b919681ce4c3b965d57f 100644 --- a/qa/qa/ee/page/trials/select.rb +++ b/qa/qa/ee/page/trials/select.rb @@ -7,7 +7,7 @@ module Trials class Select < QA::Page::Base include QA::Page::Component::Dropdown - view 'ee/app/views/subscriptions/trials/_select_namespace_form.html.haml' do + view 'ee/app/views/gitlab_subscriptions/trials/_select_namespace_form.html.haml' do element 'trial-form' element 'start-your-free-trial-button' element 'trial-company-radio'