diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-06 21:08:40 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-06 21:08:40 +0300 |
commit | 1f5e09ed6082d079dfebef92f69630c10f78c844 (patch) | |
tree | 5ef925fe6d08f2a042e47c2a9e1c40238ca8211c /spec | |
parent | 78782cd1eb5273265668ca3e438bb8cbb1344004 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
15 files changed, 204 insertions, 67 deletions
diff --git a/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb b/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb index 0bdb5930f30..d281944d3a1 100644 --- a/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb +++ b/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb @@ -33,7 +33,7 @@ RSpec.describe 'Resolving all open threads in a merge request from an issue', :j find('.discussions-counter .dropdown-toggle').click within('.discussions-counter') do - expect(page).to have_link(_("Create issue to resolve all threads"), href: new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid)) + expect(page).to have_link(_("Resolve all with new issue"), href: new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid)) end end @@ -44,7 +44,7 @@ RSpec.describe 'Resolving all open threads in a merge request from an issue', :j it 'hides the link for creating a new issue' do expect(page).not_to have_selector resolve_all_discussions_link_selector - expect(page).not_to have_content "Create issue to resolve all threads" + expect(page).not_to have_content "Resolve all with new issue" end end @@ -69,7 +69,7 @@ RSpec.describe 'Resolving all open threads in a merge request from an issue', :j end it 'does not show a link to create a new issue' do - expect(page).not_to have_link 'Create issue to resolve all threads' + expect(page).not_to have_link 'Resolve all with new issue' end end @@ -83,13 +83,13 @@ RSpec.describe 'Resolving all open threads in a merge request from an issue', :j end it 'has a link to resolve all threads by creating an issue' do - expect(page).to have_link 'Create issue to resolve all threads', href: new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid) + expect(page).to have_link 'Resolve all with new issue', href: new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid) end context 'creating an issue for threads' do before do page.within '.mr-state-widget' do - page.click_link 'Create issue to resolve all threads', href: new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid) + page.click_link 'Resolve all with new issue', href: new_project_issue_path(project, merge_request_to_resolve_discussions_of: merge_request.iid) wait_for_all_requests end diff --git a/spec/frontend/vue_merge_request_widget/components/states/mr_widget_unresolved_discussions_spec.js b/spec/frontend/vue_merge_request_widget/components/states/mr_widget_unresolved_discussions_spec.js index 58b9f162815..fe916fcf6cb 100644 --- a/spec/frontend/vue_merge_request_widget/components/states/mr_widget_unresolved_discussions_spec.js +++ b/spec/frontend/vue_merge_request_widget/components/states/mr_widget_unresolved_discussions_spec.js @@ -40,7 +40,7 @@ describe('UnresolvedDiscussions', () => { expect(text).toContain('all threads must be resolved.'); expect(wrapper.element.innerText).toContain('Jump to first unresolved thread'); - expect(wrapper.element.innerText).toContain('Create issue to resolve all threads'); + expect(wrapper.element.innerText).toContain('Resolve all with new issue'); expect(wrapper.element.querySelector('.js-create-issue').getAttribute('href')).toEqual( TEST_HOST, ); @@ -54,7 +54,7 @@ describe('UnresolvedDiscussions', () => { expect(text).toContain('all threads must be resolved.'); expect(wrapper.element.innerText).toContain('Jump to first unresolved thread'); - expect(wrapper.element.innerText).not.toContain('Create issue to resolve all threads'); + expect(wrapper.element.innerText).not.toContain('Resolve all with new issue'); expect(wrapper.element.querySelector('.js-create-issue')).toEqual(null); }); }); diff --git a/spec/lib/backup/manager_spec.rb b/spec/lib/backup/manager_spec.rb index d8835bf0e37..1733d21c23f 100644 --- a/spec/lib/backup/manager_spec.rb +++ b/spec/lib/backup/manager_spec.rb @@ -664,8 +664,8 @@ RSpec.describe Backup::Manager, feature_category: :backup_restore do it 'prints the list of available backups' do expect { subject.create }.to raise_error SystemExit # rubocop:disable Rails/SaveBang - expect(progress).to have_received(:puts) - .with(a_string_matching('1451606400_2016_01_01_1.2.3\n 1451520000_2015_12_31')) + expect(progress).to have_received(:puts).with(a_string_matching('1451606400_2016_01_01_1.2.3')) + expect(progress).to have_received(:puts).with(a_string_matching('1451520000_2015_12_31')) end it 'fails the operation and prints an error' do @@ -981,8 +981,8 @@ RSpec.describe Backup::Manager, feature_category: :backup_restore do it 'prints the list of available backups' do expect { subject.restore }.to raise_error SystemExit - expect(progress).to have_received(:puts) - .with(a_string_matching('1451606400_2016_01_01_1.2.3\n 1451520000_2015_12_31')) + expect(progress).to have_received(:puts).with(a_string_matching('1451606400_2016_01_01_1.2.3')) + expect(progress).to have_received(:puts).with(a_string_matching('1451520000_2015_12_31')) end it 'fails the operation and prints an error' do diff --git a/spec/mailers/emails/profile_spec.rb b/spec/mailers/emails/profile_spec.rb index c796801fdf9..140b067f7aa 100644 --- a/spec/mailers/emails/profile_spec.rb +++ b/spec/mailers/emails/profile_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require 'email_spec' -RSpec.describe Emails::Profile do +RSpec.describe Emails::Profile, feature_category: :user_profile do include EmailSpec::Matchers include_context 'gitlab email notification' @@ -541,4 +541,31 @@ RSpec.describe Emails::Profile do is_expected.to have_body_text /#{profile_emails_path}/ end end + + describe 'awarded a new achievement' do + let(:user) { build(:user) } + let(:achievement) { build(:achievement) } + + subject { Notify.new_achievement_email(user, achievement) } + + it_behaves_like 'an email sent from GitLab' + it_behaves_like 'it should not have Gmail Actions links' + it_behaves_like 'a user cannot unsubscribe through footer link' + + it 'is sent to the user' do + is_expected.to deliver_to user.email + end + + it 'has the correct subject' do + is_expected.to have_subject("#{achievement.namespace.full_path} awarded you the #{achievement.name} achievement") + end + + it 'includes a link to the profile page' do + is_expected.to have_body_text(group_url(achievement.namespace)) + end + + it 'includes a link to the awarding group' do + is_expected.to have_body_text(user_url(user)) + end + end end diff --git a/spec/migrations/ensure_suggestions_note_id_bigint_backfill_is_finished_for_gitlab_dot_com_spec.rb b/spec/migrations/ensure_suggestions_note_id_bigint_backfill_is_finished_for_gitlab_dot_com_spec.rb new file mode 100644 index 00000000000..f8dd700b160 --- /dev/null +++ b/spec/migrations/ensure_suggestions_note_id_bigint_backfill_is_finished_for_gitlab_dot_com_spec.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +require 'spec_helper' +require_migration! + +RSpec.describe EnsureSuggestionsNoteIdBigintBackfillIsFinishedForGitlabDotCom, feature_category: :database do + describe '#up' do + let(:migration_arguments) do + { + job_class_name: 'CopyColumnUsingBackgroundMigrationJob', + table_name: 'suggestions', + column_name: 'id', + job_arguments: [['note_id'], ['note_id_convert_to_bigint']] + } + end + + it 'ensures the migration is completed for GitLab.com, dev, or test' do + expect_next_instance_of(described_class) do |instance| + expect(instance).to receive(:com_or_dev_or_test_but_not_jh?).and_return(true) + expect(instance).to receive(:ensure_batched_background_migration_is_finished).with(migration_arguments) + end + + migrate! + end + + it 'skips the check for other instances' do + expect_next_instance_of(described_class) do |instance| + expect(instance).to receive(:com_or_dev_or_test_but_not_jh?).and_return(false) + expect(instance).not_to receive(:ensure_batched_background_migration_is_finished) + end + + migrate! + end + end +end diff --git a/spec/migrations/swap_suggestions_note_id_to_bigint_for_gitlab_dot_com_spec.rb b/spec/migrations/swap_suggestions_note_id_to_bigint_for_gitlab_dot_com_spec.rb new file mode 100644 index 00000000000..48d72ec151e --- /dev/null +++ b/spec/migrations/swap_suggestions_note_id_to_bigint_for_gitlab_dot_com_spec.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +require 'spec_helper' +require_migration! + +RSpec.describe SwapSuggestionsNoteIdToBigintForGitlabDotCom, feature_category: :database do + describe '#up' do + before do + # A we call `schema_migrate_down!` before each example, and for this migration + # `#down` is same as `#up`, we need to ensure we start from the expected state. + connection = described_class.new.connection + connection.execute('ALTER TABLE suggestions ALTER COLUMN note_id TYPE integer') + connection.execute('ALTER TABLE suggestions ALTER COLUMN note_id_convert_to_bigint TYPE bigint') + end + + # rubocop: disable RSpec/AnyInstanceOf + it 'swaps the integer and bigint columns for GitLab.com, dev, or test' do + allow_any_instance_of(described_class).to receive(:com_or_dev_or_test_but_not_jh?).and_return(true) + + suggestions = table(:suggestions) + + disable_migrations_output do + reversible_migration do |migration| + migration.before -> { + suggestions.reset_column_information + + expect(suggestions.columns.find { |c| c.name == 'note_id' }.sql_type).to eq('integer') + expect(suggestions.columns.find { |c| c.name == 'note_id_convert_to_bigint' }.sql_type).to eq('bigint') + } + + migration.after -> { + suggestions.reset_column_information + + expect(suggestions.columns.find { |c| c.name == 'note_id' }.sql_type).to eq('bigint') + expect(suggestions.columns.find { |c| c.name == 'note_id_convert_to_bigint' }.sql_type).to eq('integer') + } + end + end + end + + it 'is a no-op for other instances' do + allow_any_instance_of(described_class).to receive(:com_or_dev_or_test_but_not_jh?).and_return(false) + + suggestions = table(:suggestions) + + disable_migrations_output do + reversible_migration do |migration| + migration.before -> { + suggestions.reset_column_information + + expect(suggestions.columns.find { |c| c.name == 'note_id' }.sql_type).to eq('integer') + expect(suggestions.columns.find { |c| c.name == 'note_id_convert_to_bigint' }.sql_type).to eq('bigint') + } + + migration.after -> { + suggestions.reset_column_information + + expect(suggestions.columns.find { |c| c.name == 'note_id' }.sql_type).to eq('integer') + expect(suggestions.columns.find { |c| c.name == 'note_id_convert_to_bigint' }.sql_type).to eq('bigint') + } + end + end + end + # rubocop: enable RSpec/AnyInstanceOf + end +end diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb index fe49b2c2c7f..53a6a0e6a88 100644 --- a/spec/models/ci/runner_spec.rb +++ b/spec/models/ci/runner_spec.rb @@ -273,7 +273,7 @@ RSpec.describe Ci::Runner, type: :model, feature_category: :runner do end end - shared_examples '.belonging_to_parent_group_of_project' do + shared_examples '.belonging_to_parent_groups_of_project' do let_it_be(:group1) { create(:group) } let_it_be(:project1) { create(:project, group: group1) } let_it_be(:runner1) { create(:ci_runner, :group, groups: [group1]) } @@ -284,7 +284,7 @@ RSpec.describe Ci::Runner, type: :model, feature_category: :runner do let(:project_id) { project1.id } - subject(:result) { described_class.belonging_to_parent_group_of_project(project_id) } + subject(:result) { described_class.belonging_to_parent_groups_of_project(project_id) } it 'returns the group runner' do expect(result).to contain_exactly(runner1) @@ -310,7 +310,7 @@ RSpec.describe Ci::Runner, type: :model, feature_category: :runner do end context 'when use_traversal_ids* are enabled' do - it_behaves_like '.belonging_to_parent_group_of_project' + it_behaves_like '.belonging_to_parent_groups_of_project' end context 'when use_traversal_ids* are disabled' do @@ -322,7 +322,7 @@ RSpec.describe Ci::Runner, type: :model, feature_category: :runner do ) end - it_behaves_like '.belonging_to_parent_group_of_project' + it_behaves_like '.belonging_to_parent_groups_of_project' end context 'with instance runners sharing enabled' do diff --git a/spec/policies/ci/build_policy_spec.rb b/spec/policies/ci/build_policy_spec.rb index fee4d76ca8f..77cfcab5c3e 100644 --- a/spec/policies/ci/build_policy_spec.rb +++ b/spec/policies/ci/build_policy_spec.rb @@ -121,8 +121,7 @@ RSpec.describe Ci::BuildPolicy do context 'when no one can push or merge to the branch' do before do - create(:protected_branch, :no_one_can_push, - name: build.ref, project: project) + create(:protected_branch, :no_one_can_push, name: build.ref, project: project) end it 'does not include ability to update build' do @@ -132,8 +131,7 @@ RSpec.describe Ci::BuildPolicy do context 'when developers can push to the branch' do before do - create(:protected_branch, :developers_can_merge, - name: build.ref, project: project) + create(:protected_branch, :developers_can_merge, name: build.ref, project: project) end it 'includes ability to update build' do @@ -143,8 +141,7 @@ RSpec.describe Ci::BuildPolicy do context 'when no one can create the tag' do before do - create(:protected_tag, :no_one_can_create, - name: build.ref, project: project) + create(:protected_tag, :no_one_can_create, name: build.ref, project: project) build.update!(tag: true) end @@ -156,8 +153,7 @@ RSpec.describe Ci::BuildPolicy do context 'when no one can create the tag but it is not a tag' do before do - create(:protected_tag, :no_one_can_create, - name: build.ref, project: project) + create(:protected_tag, :no_one_can_create, name: build.ref, project: project) end it 'includes ability to update build' do @@ -181,8 +177,7 @@ RSpec.describe Ci::BuildPolicy do context 'when the build was created for a protected ref' do before do - create(:protected_branch, :developers_can_push, - name: build.ref, project: project) + create(:protected_branch, :developers_can_push, name: build.ref, project: project) end it { expect(policy).to be_disallowed :erase_build } @@ -204,8 +199,7 @@ RSpec.describe Ci::BuildPolicy do let(:owner) { user } before do - create(:protected_branch, :no_one_can_push, :no_one_can_merge, - name: build.ref, project: project) + create(:protected_branch, :no_one_can_push, :no_one_can_merge, name: build.ref, project: project) end it { expect(policy).to be_disallowed :erase_build } @@ -219,8 +213,7 @@ RSpec.describe Ci::BuildPolicy do context 'when maintainers can push to the branch' do before do - create(:protected_branch, :maintainers_can_push, - name: build.ref, project: project) + create(:protected_branch, :maintainers_can_push, name: build.ref, project: project) end context 'when the build was created by the maintainer' do @@ -240,8 +233,7 @@ RSpec.describe Ci::BuildPolicy do let(:owner) { user } before do - create(:protected_branch, :no_one_can_push, :no_one_can_merge, - name: build.ref, project: project) + create(:protected_branch, :no_one_can_push, :no_one_can_merge, name: build.ref, project: project) end it { expect(policy).to be_disallowed :erase_build } @@ -257,8 +249,7 @@ RSpec.describe Ci::BuildPolicy do context 'when the build was created for a protected branch' do before do - create(:protected_branch, :developers_can_push, - name: build.ref, project: project) + create(:protected_branch, :developers_can_push, name: build.ref, project: project) end it { expect(policy).to be_allowed :erase_build } @@ -266,8 +257,7 @@ RSpec.describe Ci::BuildPolicy do context 'when the build was created for a protected tag' do before do - create(:protected_tag, :developers_can_create, - name: build.ref, project: project) + create(:protected_tag, :developers_can_create, name: build.ref, project: project) end it { expect(policy).to be_allowed :erase_build } diff --git a/spec/policies/ci/pipeline_policy_spec.rb b/spec/policies/ci/pipeline_policy_spec.rb index b68bb966820..8a5b80e3051 100644 --- a/spec/policies/ci/pipeline_policy_spec.rb +++ b/spec/policies/ci/pipeline_policy_spec.rb @@ -20,8 +20,7 @@ RSpec.describe Ci::PipelinePolicy, :models do context 'when no one can push or merge to the branch' do before do - create(:protected_branch, :no_one_can_push, - name: pipeline.ref, project: project) + create(:protected_branch, :no_one_can_push, name: pipeline.ref, project: project) end it 'does not include ability to update pipeline' do @@ -31,8 +30,7 @@ RSpec.describe Ci::PipelinePolicy, :models do context 'when developers can push to the branch' do before do - create(:protected_branch, :developers_can_merge, - name: pipeline.ref, project: project) + create(:protected_branch, :developers_can_merge, name: pipeline.ref, project: project) end it 'includes ability to update pipeline' do @@ -42,8 +40,7 @@ RSpec.describe Ci::PipelinePolicy, :models do context 'when no one can create the tag' do before do - create(:protected_tag, :no_one_can_create, - name: pipeline.ref, project: project) + create(:protected_tag, :no_one_can_create, name: pipeline.ref, project: project) pipeline.update!(tag: true) end @@ -55,8 +52,7 @@ RSpec.describe Ci::PipelinePolicy, :models do context 'when no one can create the tag but it is not a tag' do before do - create(:protected_tag, :no_one_can_create, - name: pipeline.ref, project: project) + create(:protected_tag, :no_one_can_create, name: pipeline.ref, project: project) end it 'includes ability to update pipeline' do @@ -119,8 +115,7 @@ RSpec.describe Ci::PipelinePolicy, :models do before do project.add_developer(user) - create(:protected_branch, :developers_can_merge, - name: pipeline.ref, project: project) + create(:protected_branch, :developers_can_merge, name: pipeline.ref, project: project) end it 'is enabled' do @@ -133,8 +128,7 @@ RSpec.describe Ci::PipelinePolicy, :models do before do project.add_developer(user) - create(:protected_branch, :developers_can_merge, - name: pipeline.ref, project: project) + create(:protected_branch, :developers_can_merge, name: pipeline.ref, project: project) end it 'is disabled' do diff --git a/spec/policies/ci/pipeline_schedule_policy_spec.rb b/spec/policies/ci/pipeline_schedule_policy_spec.rb index 92ad37145c0..7025eda1ba1 100644 --- a/spec/policies/ci/pipeline_schedule_policy_spec.rb +++ b/spec/policies/ci/pipeline_schedule_policy_spec.rb @@ -19,8 +19,7 @@ RSpec.describe Ci::PipelineSchedulePolicy, :models, :clean_gitlab_redis_cache do context 'when no one can push or merge to the branch' do before do - create(:protected_branch, :no_one_can_push, - name: pipeline_schedule.ref, project: project) + create(:protected_branch, :no_one_can_push, name: pipeline_schedule.ref, project: project) end it 'does not include ability to play pipeline schedule' do @@ -30,8 +29,7 @@ RSpec.describe Ci::PipelineSchedulePolicy, :models, :clean_gitlab_redis_cache do context 'when developers can push to the branch' do before do - create(:protected_branch, :developers_can_merge, - name: pipeline_schedule.ref, project: project) + create(:protected_branch, :developers_can_merge, name: pipeline_schedule.ref, project: project) end it 'includes ability to update pipeline' do @@ -45,8 +43,7 @@ RSpec.describe Ci::PipelineSchedulePolicy, :models, :clean_gitlab_redis_cache do before do pipeline_schedule.update!(ref: tag) - create(:protected_tag, :no_one_can_create, - name: pipeline_schedule.ref, project: project) + create(:protected_tag, :no_one_can_create, name: pipeline_schedule.ref, project: project) end it 'does not include ability to play pipeline schedule' do @@ -56,8 +53,7 @@ RSpec.describe Ci::PipelineSchedulePolicy, :models, :clean_gitlab_redis_cache do context 'when no one can create the tag but it is not a tag' do before do - create(:protected_tag, :no_one_can_create, - name: pipeline_schedule.ref, project: project) + create(:protected_tag, :no_one_can_create, name: pipeline_schedule.ref, project: project) end it 'includes ability to play pipeline schedule' do diff --git a/spec/policies/environment_policy_spec.rb b/spec/policies/environment_policy_spec.rb index 701fc7ac9ae..f0957ff5cc9 100644 --- a/spec/policies/environment_policy_spec.rb +++ b/spec/policies/environment_policy_spec.rb @@ -50,8 +50,7 @@ RSpec.describe EnvironmentPolicy do with_them do before do project.add_member(user, access_level) unless access_level.nil? - create(:protected_branch, :no_one_can_push, - name: 'master', project: project) + create(:protected_branch, :no_one_can_push, name: 'master', project: project) end it { expect(policy).to be_disallowed :stop_environment } diff --git a/spec/policies/group_policy_spec.rb b/spec/policies/group_policy_spec.rb index 003ca2512dc..1103ea4eaad 100644 --- a/spec/policies/group_policy_spec.rb +++ b/spec/policies/group_policy_spec.rb @@ -735,10 +735,7 @@ RSpec.describe GroupPolicy, feature_category: :system_access do it_behaves_like 'clusterable policies' do let(:clusterable) { create(:group, :crm_enabled) } let(:cluster) do - create(:cluster, - :provided_by_gcp, - :group, - groups: [clusterable]) + create(:cluster, :provided_by_gcp, :group, groups: [clusterable]) end end diff --git a/spec/services/achievements/award_service_spec.rb b/spec/services/achievements/award_service_spec.rb index fb45a634ddd..c70c1d5c22d 100644 --- a/spec/services/achievements/award_service_spec.rb +++ b/spec/services/achievements/award_service_spec.rb @@ -32,8 +32,15 @@ RSpec.describe Achievements::AwardService, feature_category: :user_profile do context 'when user has permission' do let(:current_user) { maintainer } + let(:notification_service) { instance_double(NotificationService) } + let(:mail_message) { instance_double(ActionMailer::MessageDelivery) } + + it 'creates an achievement and sends an e-mail' do + allow(NotificationService).to receive(:new).and_return(notification_service) + expect(notification_service).to receive(:new_achievement_email).with(recipient, achievement) + .and_return(mail_message) + expect(mail_message).to receive(:deliver_later) - it 'creates an achievement' do expect(response).to be_success end diff --git a/spec/tasks/gitlab/gitaly_rake_spec.rb b/spec/tasks/gitlab/gitaly_rake_spec.rb index d2f4fa0b8ef..443e56e9934 100644 --- a/spec/tasks/gitlab/gitaly_rake_spec.rb +++ b/spec/tasks/gitlab/gitaly_rake_spec.rb @@ -66,7 +66,7 @@ RSpec.describe 'gitlab:gitaly namespace rake task', :silence_stdout do .with(%w[which gmake]) .and_return(['/usr/bin/gmake', 0]) expect(Gitlab::Popen).to receive(:popen) - .with(%w[gmake clean-build all], nil, { "BUNDLE_GEMFILE" => nil, "RUBYOPT" => nil }) + .with(%w[gmake clean all], nil, { "BUNDLE_GEMFILE" => nil, "RUBYOPT" => nil }) .and_return(['ok', 0]) subject @@ -78,7 +78,7 @@ RSpec.describe 'gitlab:gitaly namespace rake task', :silence_stdout do .with(%w[which gmake]) .and_return(['/usr/bin/gmake', 0]) expect(Gitlab::Popen).to receive(:popen) - .with(%w[gmake clean-build all], nil, { "BUNDLE_GEMFILE" => nil, "RUBYOPT" => nil }) + .with(%w[gmake clean all], nil, { "BUNDLE_GEMFILE" => nil, "RUBYOPT" => nil }) .and_return(['output', 1]) expect { subject }.to raise_error /Gitaly failed to compile: output/ @@ -95,14 +95,14 @@ RSpec.describe 'gitlab:gitaly namespace rake task', :silence_stdout do it 'calls make in the gitaly directory' do expect(Gitlab::Popen).to receive(:popen) - .with(%w[make clean-build all], nil, { "BUNDLE_GEMFILE" => nil, "RUBYOPT" => nil }) + .with(%w[make clean all], nil, { "BUNDLE_GEMFILE" => nil, "RUBYOPT" => nil }) .and_return(['output', 0]) subject end context 'when Rails.env is test' do - let(:command) { %w[make clean-build all] } + let(:command) { %w[make clean all] } before do stub_rails_env('test') diff --git a/spec/views/notify/new_achievement_email.html.haml_spec.rb b/spec/views/notify/new_achievement_email.html.haml_spec.rb new file mode 100644 index 00000000000..9f577e6c043 --- /dev/null +++ b/spec/views/notify/new_achievement_email.html.haml_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' +require 'email_spec' + +RSpec.describe 'notify/new_achievement_email.html.haml', feature_category: :user_profile do + let(:user) { build(:user) } + let(:achievement) { build(:achievement) } + + before do + allow(view).to receive(:message) { instance_double(Mail::Message, subject: 'Subject') } + assign(:user, user) + assign(:achievement, achievement) + end + + it 'contains achievement information' do + render + + expect(rendered).to have_content(achievement.namespace.full_path) + expect(rendered).to have_content(" awarded you the ") + expect(rendered).to have_content(achievement.name) + expect(rendered).to have_content(" achievement!") + + expect(rendered).to have_content("View your achievements on your profile") + end +end |