Commit e8af443a authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'jswain_jobs_to_be_done_shuffle' into 'master'

Shuffle jobs_to_be_done questions

See merge request gitlab-org/gitlab!70446
parents f5729999 8e4c3715
......@@ -10,6 +10,10 @@ module EE
super.merge(api_path: suggestion_path)
end
def shuffled_jobs_to_be_done_options
jobs_to_be_done_options.shuffle.append([_('A different reason'), 'other'])
end
private
def redirect_path
......@@ -18,5 +22,16 @@ module EE
URI.parse(redirect_to).path if redirect_to
end
end
def jobs_to_be_done_options
[
_('I want to learn the basics of Git'),
_('I want to move my repository to GitLab from somewhere else'),
_('I want to store my code'),
_('I want to explore GitLab to see if it’s worth switching to'),
_('I want to use GitLab CI with my existing repository'),
_('I’m joining my team who’s already on GitLab')
]
end
end
end
......@@ -4,13 +4,7 @@
.form-group.col-sm-12
= label_tag :jobs_to_be_done, _("I'm signing up for GitLab because:")
= select_tag :jobs_to_be_done,
options_for_select([_('I want to learn the basics of Git'),
_('I want to move my repository to GitLab from somewhere else'),
_('I want to store my code'),
_('I want to explore GitLab to see if it’s worth switching to'),
_('I want to use GitLab CI with my existing repository'),
_('I’m joining my team who’s already on GitLab'),
[_('A different reason'), 'other']]),
options_for_select(shuffled_jobs_to_be_done_options),
include_blank: _('Please select...'), class: 'form-control js-jobs-to-be-done-dropdown'
.row
.form-group.col-sm-12.js-jobs-to-be-done-other-group.hidden
......
......@@ -8,4 +8,26 @@ RSpec.describe EE::RegistrationsHelper do
expect(helper.signup_username_data_attributes.keys).to include(:api_path)
end
end
describe '#shuffled_jobs_to_be_done_options' do
subject { helper.shuffled_jobs_to_be_done_options }
let(:array_double) { double(:array) }
it 'uses shuffle' do
allow(helper).to receive(:jobs_to_be_done_options).and_return(array_double)
expect(array_double).to receive(:shuffle).and_return([])
subject
end
it 'has a number of options' do
expect(subject.count).to eq(7)
end
it '"other" is always the last option' do
expect(subject.last).to eq(['A different reason', 'other'])
end
end
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