Commit 9761c317 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'fix-hardcoded-i18n-text-in-specs' into 'master'

Fix hardcoded I18n text in specs, part 1

See merge request gitlab-org/gitlab!18275
parents ff992244 318454ef
......@@ -5,9 +5,9 @@ describe EE::GeoHelper do
describe '.current_node_human_status' do
where(:primary, :secondary, :result) do
[
[true, false, 'primary'],
[false, true, 'secondary'],
[false, false, 'misconfigured']
[true, false, s_('Geo|primary')],
[false, true, s_('Geo|secondary')],
[false, false, s_('Geo|misconfigured')]
]
end
......
......@@ -24,7 +24,7 @@ describe AbuseReportsController do
get :new, params: { user_id: user_id }
expect(response).to redirect_to root_path
expect(flash[:alert]).to eq('Cannot create the abuse report. The user has been deleted.')
expect(flash[:alert]).to eq(_('Cannot create the abuse report. The user has been deleted.'))
end
end
......@@ -35,7 +35,7 @@ describe AbuseReportsController do
get :new, params: { user_id: user.id }
expect(response).to redirect_to user
expect(flash[:alert]).to eq('Cannot create the abuse report. This user has been blocked.')
expect(flash[:alert]).to eq(_('Cannot create the abuse report. This user has been blocked.'))
end
end
end
......
......@@ -155,7 +155,7 @@ describe Admin::UsersController do
put :block, params: { id: user.username }
user.reload
expect(user.blocked?).to be_truthy
expect(flash[:notice]).to eq 'Successfully blocked'
expect(flash[:notice]).to eq _('Successfully blocked')
end
end
......@@ -171,7 +171,7 @@ describe Admin::UsersController do
put :unblock, params: { id: user.username }
user.reload
expect(user.blocked?).to be_truthy
expect(flash[:alert]).to eq 'This user cannot be unlocked manually from GitLab'
expect(flash[:alert]).to eq _('This user cannot be unlocked manually from GitLab')
end
end
......@@ -184,7 +184,7 @@ describe Admin::UsersController do
put :unblock, params: { id: user.username }
user.reload
expect(user.blocked?).to be_falsey
expect(flash[:notice]).to eq 'Successfully unblocked'
expect(flash[:notice]).to eq _('Successfully unblocked')
end
end
end
......@@ -234,7 +234,7 @@ describe Admin::UsersController do
go
expect(flash[:notice])
.to eq 'Two-factor Authentication has been disabled for this user'
.to eq _('Two-factor Authentication has been disabled for this user')
end
def go
......@@ -249,7 +249,9 @@ describe Admin::UsersController do
it 'shows only one error message for an invalid email' do
post :create, params: { user: attributes_for(:user, email: 'bogus') }
expect(assigns[:user].errors).to contain_exactly("Email is invalid")
errors = assigns[:user].errors
expect(errors).to contain_exactly(errors.full_message(:email, I18n.t('errors.messages.invalid')))
end
end
......@@ -346,7 +348,7 @@ describe Admin::UsersController do
it "shows a notice" do
post :impersonate, params: { id: user.username }
expect(flash[:alert]).to eq("You cannot impersonate a blocked user")
expect(flash[:alert]).to eq(_('You cannot impersonate a blocked user'))
end
it "doesn't sign us in as the user" do
......
......@@ -16,7 +16,7 @@ describe PasswordsController do
post :create
expect(response).to have_gitlab_http_status(302)
expect(flash[:alert]).to eq 'Password authentication is unavailable.'
expect(flash[:alert]).to eq _('Password authentication is unavailable.')
end
end
......@@ -26,7 +26,7 @@ describe PasswordsController do
it 'prevents a password reset' do
post :create, params: { user: { email: user.email } }
expect(flash[:alert]).to eq 'Password authentication is unavailable.'
expect(flash[:alert]).to eq _('Password authentication is unavailable.')
end
end
end
......
......@@ -37,7 +37,7 @@ describe Profiles::PreferencesController do
context 'on successful update' do
it 'sets the flash' do
go
expect(flash[:notice]).to eq 'Preferences saved.'
expect(flash[:notice]).to eq _('Preferences saved.')
end
it "changes the user's preferences" do
......@@ -62,7 +62,7 @@ describe Profiles::PreferencesController do
go
expect(flash[:alert]).to eq('Failed to save preferences.')
expect(flash[:alert]).to eq(_('Failed to save preferences.'))
end
end
......
......@@ -70,7 +70,7 @@ describe Profiles::TwoFactorAuthsController do
it 'assigns error' do
go
expect(assigns[:error]).to eq 'Invalid pin code'
expect(assigns[:error]).to eq _('Invalid pin code')
end
it 'assigns qr_code' do
......
......@@ -118,7 +118,7 @@ describe ProfilesController, :request_store do
format: :json
expect(response.status).to eq(200)
expect(json_response['message']).to eq('Username successfully changed')
expect(json_response['message']).to eq(s_('Profiles|Username successfully changed'))
end
it 'renders an error message when the username was not updated' do
......
......@@ -97,7 +97,7 @@ describe Projects::ArtifactsController do
it 'sets the notice' do
subject
expect(flash[:notice]).to eq('Artifact was successfully deleted.')
expect(flash[:notice]).to eq(_('Artifact was successfully deleted.'))
end
context 'when artifact deletion fails' do
......@@ -114,7 +114,7 @@ describe Projects::ArtifactsController do
it 'sets the notice' do
subject
expect(flash[:notice]).to eq('Artifact could not be deleted.')
expect(flash[:notice]).to eq(_('Artifact could not be deleted.'))
end
end
......
......@@ -86,8 +86,8 @@ describe Projects::Environments::PrometheusApiController do
it 'returns 204 no_content' do
get :proxy, params: environment_params
expect(json_response['status']).to eq('processing')
expect(json_response['message']).to eq('Not ready yet. Try again later.')
expect(json_response['status']).to eq(_('processing'))
expect(json_response['message']).to eq(_('Not ready yet. Try again later.'))
expect(response).to have_gitlab_http_status(:no_content)
end
end
......
......@@ -170,7 +170,7 @@ describe Projects::IssuesController do
it 'redirects to signin if not logged in' do
get :new, params: { namespace_id: project.namespace, project_id: project }
expect(flash[:alert]).to eq 'You need to sign in or sign up before continuing.'
expect(flash[:alert]).to eq I18n.t('devise.failure.unauthenticated')
expect(response).to redirect_to(new_user_session_path)
end
......@@ -926,7 +926,7 @@ describe Projects::IssuesController do
it 'sets a flash message' do
post_issue(title: 'Hello')
expect(flash[:notice]).to eq('Resolved all discussions.')
expect(flash[:notice]).to eq(_('Resolved all discussions.'))
end
describe "resolving a single discussion" do
......@@ -940,7 +940,7 @@ describe Projects::IssuesController do
end
it 'sets a flash message that one discussion was resolved' do
expect(flash[:notice]).to eq('Resolved 1 discussion.')
expect(flash[:notice]).to eq(_('Resolved 1 discussion.'))
end
end
end
......@@ -1314,7 +1314,7 @@ describe Projects::IssuesController do
it "returns 302 for project members with developer role" do
import_csv
expect(flash[:notice]).to include('Your issues are being imported')
expect(flash[:notice]).to eq(_("Your issues are being imported. Once finished, you'll get a confirmation email."))
expect(response).to redirect_to(project_issues_path(project))
end
......@@ -1325,7 +1325,7 @@ describe Projects::IssuesController do
import_csv
expect(flash[:alert]).to include('File upload error.')
expect(flash[:alert]).to include(_('File upload error.'))
expect(response).to redirect_to(project_issues_path(project))
end
end
......
......@@ -416,7 +416,7 @@ describe Projects::PipelineSchedulesController do
end
expect(flash.to_a.size).to eq(2)
expect(flash[:alert]).to eq 'You cannot play this scheduled pipeline at the moment. Please wait a minute.'
expect(flash[:alert]).to eq _('You cannot play this scheduled pipeline at the moment. Please wait a minute.')
expect(response).to have_gitlab_http_status(302)
end
end
......
......@@ -59,7 +59,7 @@ describe Projects::RawController do
it 'prevents from accessing the raw file' do
execute_raw_requests(requests: 6, project: project, file_path: file_path)
expect(flash[:alert]).to eq('You cannot access the raw file. Please wait a minute.')
expect(flash[:alert]).to eq(_('You cannot access the raw file. Please wait a minute.'))
expect(response).to have_gitlab_http_status(429)
end
......@@ -109,7 +109,7 @@ describe Projects::RawController do
execute_raw_requests(requests: 3, project: project, file_path: modified_path)
expect(flash[:alert]).to eq('You cannot access the raw file. Please wait a minute.')
expect(flash[:alert]).to eq(_('You cannot access the raw file. Please wait a minute.'))
expect(response).to have_gitlab_http_status(429)
end
end
......@@ -137,7 +137,7 @@ describe Projects::RawController do
# Accessing downcase version of readme
execute_raw_requests(requests: 6, project: project, file_path: file_path)
expect(flash[:alert]).to eq('You cannot access the raw file. Please wait a minute.')
expect(flash[:alert]).to eq(_('You cannot access the raw file. Please wait a minute.'))
expect(response).to have_gitlab_http_status(429)
# Accessing upcase version of readme
......
......@@ -35,7 +35,7 @@ describe Projects::UploadsController do
post_authorize
expect(response).to have_gitlab_http_status(500)
expect(response.body).to eq('Error uploading file')
expect(response.body).to eq(_('Error uploading file'))
end
end
......
......@@ -114,7 +114,7 @@ describe Projects::WikisController do
subject
expect(response).to have_http_status(:ok)
expect(flash[:notice]).to eq('The content of this page is not encoded in UTF-8. Edits can only be made via the Git repository.')
expect(flash[:notice]).to eq(_('The content of this page is not encoded in UTF-8. Edits can only be made via the Git repository.'))
end
end
end
......@@ -205,7 +205,7 @@ describe Projects::WikisController do
subject
expect(response).to have_http_status(:ok)
expect(response.body).to include('Edit Page')
expect(response.body).to include(s_('Wiki|Edit Page'))
end
end
end
......
......@@ -506,7 +506,7 @@ describe ProjectsController do
expect { update_project path: 'renamed_path' }
.not_to change { project.reload.path }
expect(controller).to set_flash.now[:alert].to(/container registry tags/)
expect(controller).to set_flash.now[:alert].to(s_('UpdateProject|Cannot rename project because it contains container registry tags!'))
expect(response).to have_gitlab_http_status(200)
end
end
......@@ -645,7 +645,7 @@ describe ProjectsController do
expect(project.namespace).to eq(old_namespace)
expect(response).to have_gitlab_http_status(200)
expect(flash[:alert]).to eq 'Please select a new namespace for your project.'
expect(flash[:alert]).to eq s_('TransferProject|Please select a new namespace for your project.')
end
end
end
......@@ -797,7 +797,7 @@ describe ProjectsController do
format: :js)
expect(forked_project.reload.forked?).to be_falsey
expect(flash[:notice]).to eq('The fork relationship has been removed.')
expect(flash[:notice]).to eq(s_('The fork relationship has been removed.'))
expect(response).to render_template(:remove_fork)
end
end
......
......@@ -136,13 +136,13 @@ describe RegistrationsController do
post(:create, params: user_params)
expect(response).to render_template(:new)
expect(flash[:alert]).to include 'There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.'
expect(flash[:alert]).to eq(_('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.'))
end
it 'redirects to the dashboard when the recaptcha is solved' do
post(:create, params: user_params)
expect(flash[:notice]).to include 'Welcome! You have signed up successfully.'
expect(flash[:notice]).to eq(I18n.t('devise.registrations.signed_up'))
end
it 'does not require reCAPTCHA if disabled by feature flag' do
......@@ -152,7 +152,7 @@ describe RegistrationsController do
expect(controller).not_to receive(:verify_recaptcha)
expect(flash[:alert]).to be_nil
expect(flash[:notice]).to include 'Welcome! You have signed up successfully.'
expect(flash[:notice]).to eq(I18n.t('devise.registrations.signed_up'))
end
end
......@@ -220,7 +220,7 @@ describe RegistrationsController do
expect(Gitlab::AuthLogger).to receive(:error).with(auth_log_attributes).once
expect { post(:create, params: user_params, session: session_params) }.not_to change(User, :count)
expect(response).to redirect_to(new_user_session_path)
expect(flash[:alert]).to include 'That was a bit too quick! Please resubmit.'
expect(flash[:alert]).to eq(I18n.t('invisible_captcha.timestamp_error_message'))
end
end
end
......@@ -236,7 +236,7 @@ describe RegistrationsController do
expect(Gitlab::AuthLogger).to receive(:error).with(auth_log_attributes).once
expect { post(:create, params: user_params, session: session_params) }.not_to change(User, :count)
expect(response).to redirect_to(new_user_session_path)
expect(flash[:alert]).to include 'That was a bit too quick! Please resubmit.'
expect(flash[:alert]).to eq(I18n.t('invisible_captcha.timestamp_error_message'))
end
end
end
......@@ -251,7 +251,7 @@ describe RegistrationsController do
it 'redirects back with a notice when the checkbox was not checked' do
post :create, params: user_params
expect(flash[:alert]).to match /you must accept our terms/i
expect(flash[:alert]).to eq(_('You must accept our Terms of Service and privacy policy in order to register an account'))
end
it 'creates the user with agreement when terms are accepted' do
......@@ -322,15 +322,15 @@ describe RegistrationsController do
end
def expect_password_failure
expect_failure('Invalid password')
expect_failure(s_('Profiles|Invalid password'))
end
def expect_username_failure
expect_failure('Invalid username')
expect_failure(s_('Profiles|Invalid username'))
end
def expect_success
expect(flash[:notice]).to eq 'Account scheduled for removal.'
expect(flash[:notice]).to eq s_('Profiles|Account scheduled for removal.')
expect(response.status).to eq(303)
expect(response).to redirect_to new_user_session_path
end
......
......@@ -49,7 +49,7 @@ describe IssuablesHelper do
let(:label2_entity) { LabelEntity.represent(label2).as_json }
it 'returns label text with no labels' do
expect(issuable_labels_tooltip([])).to eq("Labels")
expect(issuable_labels_tooltip([])).to eq(_('Labels'))
end
it 'returns label text with labels within max limit' do
......
......@@ -131,7 +131,7 @@ describe LabelsHelper do
context 'with a group as subject' do
it 'returns "Create group label"' do
expect(create_label_title(group)).to eq 'Create group label'
expect(create_label_title(group)).to eq _('Create group label')
end
end
......@@ -139,13 +139,13 @@ describe LabelsHelper do
set(:project) { create(:project, namespace: group) }
it 'returns "Create project label"' do
expect(create_label_title(project)).to eq 'Create project label'
expect(create_label_title(project)).to eq _('Create project label')
end
end
context 'with no subject' do
it 'returns "Create new label"' do
expect(create_label_title(nil)).to eq 'Create new label'
expect(create_label_title(nil)).to eq _('Create new label')
end
end
end
......@@ -155,7 +155,7 @@ describe LabelsHelper do
context 'with a group as subject' do
it 'returns "Manage group labels"' do
expect(manage_labels_title(group)).to eq 'Manage group labels'
expect(manage_labels_title(group)).to eq _('Manage group labels')
end
end
......@@ -163,13 +163,13 @@ describe LabelsHelper do
set(:project) { create(:project, namespace: group) }
it 'returns "Manage project labels"' do
expect(manage_labels_title(project)).to eq 'Manage project labels'
expect(manage_labels_title(project)).to eq _('Manage project labels')
end
end
context 'with no subject' do
it 'returns "Manage labels"' do
expect(manage_labels_title(nil)).to eq 'Manage labels'
expect(manage_labels_title(nil)).to eq _('Manage labels')
end
end
end
......@@ -179,7 +179,7 @@ describe LabelsHelper do
context 'with a group as subject' do
it 'returns "View group labels"' do
expect(view_labels_title(group)).to eq 'View group labels'
expect(view_labels_title(group)).to eq _('View group labels')
end
end
......@@ -187,13 +187,13 @@ describe LabelsHelper do
set(:project) { create(:project, namespace: group) }
it 'returns "View project labels"' do
expect(view_labels_title(project)).to eq 'View project labels'
expect(view_labels_title(project)).to eq _('View project labels')
end
end
context 'with no subject' do
it 'returns "View labels"' do
expect(view_labels_title(nil)).to eq 'View labels'
expect(view_labels_title(nil)).to eq _('View labels')
end
end
end
......
......@@ -59,29 +59,29 @@ describe VisibilityLevelHelper do
describe "#project_visibility_level_description" do
it "describes private projects" do
expect(project_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE))
.to eq "Project access must be granted explicitly to each user."
.to eq _('Project access must be granted explicitly to each user.')
end
it "describes public projects" do
expect(project_visibility_level_description(Gitlab::VisibilityLevel::PUBLIC))
.to eq "The project can be accessed without any authentication."
.to eq _('The project can be accessed without any authentication.')
end
end
describe "#snippet_visibility_level_description" do
it 'describes visibility only for me' do
expect(snippet_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE, personal_snippet))
.to eq "The snippet is visible only to me."
.to eq _('The snippet is visible only to me.')
end
it 'describes visibility for project members' do
expect(snippet_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE, project_snippet))
.to eq "The snippet is visible only to project members."
.to eq _('The snippet is visible only to project members.')
end
it 'defaults to personal snippet' do
expect(snippet_visibility_level_description(Gitlab::VisibilityLevel::PRIVATE))
.to eq "The snippet is visible only to me."
.to eq _('The snippet is visible only to me.')
end
end
......
......@@ -31,10 +31,10 @@ describe Gitlab::Ci::Status::Build::Factory do
end
it 'fabricates status with correct details' do
expect(status.text).to eq 'passed'
expect(status.text).to eq s_('CiStatusText|passed')
expect(status.icon).to eq 'status_success'
expect(status.favicon).to eq 'favicon_status_success'
expect(status.label).to eq 'passed'
expect(status.label).to eq s_('CiStatusLabel|passed')
expect(status).to have_details
expect(status).to have_action
end
......@@ -58,10 +58,10 @@ describe Gitlab::Ci::Status::Build::Factory do
end
it 'fabricates status with correct details' do
expect(status.text).to eq 'passed'
expect(status.text).to eq s_('CiStatusText|passed')
expect(status.icon).to eq 'status_success'
expect(status.favicon).to eq 'favicon_status_success'
expect(status.label).to eq 'passed'
expect(status.label).to eq s_('CiStatusLabel|passed')
expect(status).to have_details
expect(status).to have_action
end
......@@ -86,11 +86,11 @@ describe Gitlab::Ci::Status::Build::Factory do
end
it 'fabricates status with correct details' do
expect(status.text).to eq 'failed'
expect(status.text).to eq s_('CiStatusText|failed')
expect(status.icon).to eq 'status_failed'
expect(status.favicon).to eq 'favicon_status_failed'
expect(status.label).to eq 'failed'
expect(status.status_tooltip).to eq 'failed - (unknown failure)'
expect(status.label).to eq s_('CiStatusLabel|failed')
expect(status.status_tooltip).to eq "#{s_('CiStatusText|failed')} - (unknown failure)"
expect(status).to have_details
expect(status).to have_action
end
......@@ -115,7 +115,7 @@ describe Gitlab::Ci::Status::Build::Factory do
end
it 'fabricates status with correct details' do
expect(status.text).to eq 'failed'
expect(status.text).to eq s_('CiStatusText|failed')
expect(status.icon).to eq 'status_warning'
expect(status.favicon).to eq 'favicon_status_failed'
expect(status.label).to eq 'failed (allowed to fail)'
......@@ -144,10 +144,10 @@ describe Gitlab::Ci::Status::Build::Factory do
end
it 'fabricates status with correct details' do
expect(status.text).to eq 'failed'
expect(status.text).to eq s_('CiStatusText|failed')
expect(status.icon).to eq 'status_failed'
expect(status.favicon).to eq 'favicon_status_failed'
expect(status.label).to eq 'failed'
expect(status.label).to eq s_('CiStatusLabel|failed')
expect(status).to have_details
expect(status).to have_action
expect(status.action_title).to include 'Retry'
......@@ -173,11 +173,11 @@ describe Gitlab::Ci::Status::Build::Factory do
end
it 'fabricates status with correct details' do
expect(status.text).to eq 'canceled'
expect(status.text).to eq s_('CiStatusText|canceled')
expect(status.icon).to eq 'status_canceled'
expect(status.favicon).to eq 'favicon_status_canceled'
expect(status.illustration).to include(:image, :size, :title)
expect(status.label).to eq 'canceled'
expect(status.label).to eq s_('CiStatusLabel|canceled')
expect(status).to have_details
expect(status).to have_action
end
......@@ -200,10 +200,10 @@ describe Gitlab::Ci::Status::Build::Factory do
end
it 'fabricates status with correct details' do
expect(status.text).to eq 'running'
expect(status.text).to eq s_('CiStatus|running')
expect(status.icon).to eq 'status_running'
expect(status.favicon).to eq 'favicon_status_running'
expect(status.label).to eq 'running'
expect(status.label).to eq s_('CiStatus|running')
expect(status).to have_details
expect(status).to have_action
end
......@@ -226,11 +226,11 @@ describe Gitlab::Ci::Status::Build::Factory do
end
it 'fabricates status with correct details' do
expect(status.text).to eq 'pending'
expect(status.text).to eq s_('CiStatusText|pending')
expect(status.icon).to eq 'status_pending'
expect(status.favicon).to eq 'favicon_status_pending'
expect(status.illustration).to include(:image, :size, :title, :content)
expect(status.label).to eq 'pending'
expect(status.label).to eq s_('CiStatusLabel|pending')
expect(status).to have_details
expect(status).to have_action
end
......@@ -252,11 +252,11 @@ describe Gitlab::Ci::Status::Build::Factory do
end
it 'fabricates status with correct details' do
expect(status.text).to eq 'skipped'
expect(status.text).to eq s_('CiStatusText|skipped')
expect(status.icon).to eq 'status_skipped'
expect(status.favicon).to eq 'favicon_status_skipped'
expect(status.illustration).to include(:image, :size, :title)
expect(status.label).to eq 'skipped'
expect(status.label).to eq s_('CiStatusLabel|skipped')
expect(status).to have_details
expect(status).not_to have_action
end
......@@ -282,7 +282,7 @@ describe Gitlab::Ci::Status::Build::Factory do
end
it 'fabricates status with correct details' do
expect(status.text).to eq 'manual'
expect(status.text).to eq s_('CiStatusText|manual')
expect(status.group).to eq 'manual'
expect(status.icon).to eq 'status_manual'
expect(status.favicon).to eq 'favicon_status_manual'
......@@ -339,7 +339,7 @@ describe Gitlab::Ci::Status::Build::Factory do
end
it 'fabricates status with correct details' do
expect(status.text).to eq 'manual'
expect(status.text).to eq s_('CiStatusText|manual')
expect(status.group).to eq 'manual'
expect(status.icon).to eq 'status_manual'
expect(status.favicon).to eq 'favicon_status_manual'
......@@ -370,7 +370,7 @@ describe Gitlab::Ci::Status::Build::Factory do
end
it 'fabricates status with correct details' do
expect(status.text).to eq 'delayed'
expect(status.text).to eq s_('CiStatusText|delayed')
expect(status.group).to eq 'scheduled'
expect(status.icon).to eq 'status_scheduled'
expect(status.favicon).to eq 'favicon_status_scheduled'
......
......@@ -135,7 +135,7 @@ describe Ci::LegacyStage do
let!(:stage_build) { create_job(:ci_build, status: :created) }
it 'returns detailed status for created stage' do
expect(subject.text).to eq 'created'
expect(subject.text).to eq s_('CiStatusText|created')
end
end
......@@ -143,7 +143,7 @@ describe Ci::LegacyStage do
let!(:stage_build) { create_job(:ci_build, status: :pending) }
it 'returns detailed status for pending stage' do
expect(subject.text).to eq 'pending'
expect(subject.text).to eq s_('CiStatusText|pending')
end
end
......@@ -151,7 +151,7 @@ describe Ci::LegacyStage do
let!(:stage_build) { create_job(:ci_build, status: :running) }
it 'returns detailed status for running stage' do
expect(subject.text).to eq 'running'
expect(subject.text).to eq s_('CiStatus|running')
end
end
......@@ -159,7 +159,7 @@ describe Ci::LegacyStage do
let!(:stage_build) { create_job(:ci_build, status: :success) }
it 'returns detailed status for successful stage' do
expect(subject.text).to eq 'passed'
expect(subject.text).to eq s_('CiStatusText|passed')
end
end
......@@ -167,7 +167,7 @@ describe Ci::LegacyStage do
let!(:stage_build) { create_job(:ci_build, status: :failed) }
it 'returns detailed status for failed stage' do
expect(subject.text).to eq 'failed'
expect(subject.text).to eq s_('CiStatusText|failed')
end
end
......@@ -175,7 +175,7 @@ describe Ci::LegacyStage do
let!(:stage_build) { create_job(:ci_build, status: :canceled) }
it 'returns detailed status for canceled stage' do
expect(subject.text).to eq 'canceled'
expect(subject.text).to eq s_('CiStatusText|canceled')
end
end
......@@ -183,7 +183,7 @@ describe Ci::LegacyStage do
let!(:stage_build) { create_job(:ci_build, status: :skipped) }
it 'returns detailed status for skipped stage' do
expect(subject.text).to eq 'skipped'
expect(subject.text).to eq s_('CiStatusText|skipped')
end
end
end
......
......@@ -1894,7 +1894,7 @@ describe Ci::Pipeline, :mailer do
let(:pipeline) { create(:ci_pipeline, status: :created) }
it 'returns detailed status for created pipeline' do
expect(subject.text).to eq 'created'
expect(subject.text).to eq s_('CiStatusText|created')
end
end
......@@ -1902,7 +1902,7 @@ describe Ci::Pipeline, :mailer do
let(:pipeline) { create(:ci_pipeline, status: :pending) }
it 'returns detailed status for pending pipeline' do
expect(subject.text).to eq 'pending'
expect(subject.text).to eq s_('CiStatusText|pending')
end
end
......@@ -1910,7 +1910,7 @@ describe Ci::Pipeline, :mailer do
let(:pipeline) { create(:ci_pipeline, status: :running) }
it 'returns detailed status for running pipeline' do
expect(subject.text).to eq 'running'
expect(subject.text).to eq s_('CiStatus|running')
end
end
......@@ -1918,7 +1918,7 @@ describe Ci::Pipeline, :mailer do
let(:pipeline) { create(:ci_pipeline, status: :success) }
it 'returns detailed status for successful pipeline' do
expect(subject.text).to eq 'passed'
expect(subject.text).to eq s_('CiStatusText|passed')
end
end
......@@ -1926,7 +1926,7 @@ describe Ci::Pipeline, :mailer do
let(:pipeline) { create(:ci_pipeline, status: :failed) }
it 'returns detailed status for failed pipeline' do
expect(subject.text).to eq 'failed'
expect(subject.text).to eq s_('CiStatusText|failed')
end
end
......@@ -1934,7 +1934,7 @@ describe Ci::Pipeline, :mailer do
let(:pipeline) { create(:ci_pipeline, status: :canceled) }
it 'returns detailed status for canceled pipeline' do
expect(subject.text).to eq 'canceled'
expect(subject.text).to eq s_('CiStatusText|canceled')
end
end
......@@ -1942,7 +1942,7 @@ describe Ci::Pipeline, :mailer do
let(:pipeline) { create(:ci_pipeline, status: :skipped) }
it 'returns detailed status for skipped pipeline' do
expect(subject.text).to eq 'skipped'
expect(subject.text).to eq s_('CiStatusText|skipped')
end
end
......@@ -1950,7 +1950,7 @@ describe Ci::Pipeline, :mailer do
let(:pipeline) { create(:ci_pipeline, status: :manual) }
it 'returns detailed status for blocked pipeline' do
expect(subject.text).to eq 'blocked'
expect(subject.text).to eq s_('CiStatusText|blocked')
end
end
......@@ -1962,7 +1962,7 @@ describe Ci::Pipeline, :mailer do
end
it 'retruns detailed status for successful pipeline with warnings' do
expect(subject.label).to eq 'passed with warnings'
expect(subject.label).to eq(s_('CiStatusLabel|passed with warnings'))
end
end
end
......
......@@ -65,7 +65,7 @@ describe Ci::Stage, :models do
it 'updates stage status correctly' do
expect { stage.update_status }
.to change { stage.reload.status }
.to 'running'
.to eq 'running'
end
end
......@@ -89,7 +89,7 @@ describe Ci::Stage, :models do
it 'updates status to skipped' do
expect { stage.update_status }
.to change { stage.reload.status }
.to 'skipped'
.to eq 'skipped'
end
end
......@@ -109,7 +109,7 @@ describe Ci::Stage, :models do
it 'updates status to skipped' do
expect { stage.update_status }
.to change { stage.reload.status }
.to 'skipped'
.to eq('skipped')
end
end
......@@ -171,7 +171,7 @@ describe Ci::Stage, :models do
end
it 'has a correct label' do
expect(subject.label).to eq label.to_s
expect(subject.label).to eq(label.to_s)
end
end
......@@ -187,7 +187,7 @@ describe Ci::Stage, :models do
end
it 'is passed with warnings' do
expect(subject.label).to eq 'passed with warnings'
expect(subject.label).to eq s_('CiStatusLabel|passed with warnings')
end
end
end
......
......@@ -344,7 +344,7 @@ describe JiraService do
it 'returns default values' do
expect(service.title).to eq('Jira')
expect(service.description).to eq('Jira issue tracker')
expect(service.description).to eq(s_('JiraService|Jira issue tracker'))
end
end
end
......@@ -606,7 +606,7 @@ describe JiraService do
service = create(:jira_service)
expect(service.title).to eq('Jira')
expect(service.description).to eq('Jira issue tracker')
expect(service.description).to eq(s_('JiraService|Jira issue tracker'))
end
end
......
......@@ -79,7 +79,7 @@ describe YoutrackService do
it 'returns default values' do
expect(service.title).to eq('YouTrack')
expect(service.description).to eq('YouTrack issue tracker')
expect(service.description).to eq(s_('IssueTracker|YouTrack issue tracker'))
end
end
end
......
......@@ -244,7 +244,7 @@ describe Project do
new_project = build_stubbed(:project, namespace_id: project.namespace_id, path: "#{project.path}.wiki")
expect(new_project).not_to be_valid
expect(new_project.errors[:name].first).to eq('has already been taken')
expect(new_project.errors[:name].first).to eq(_('has already been taken'))
end
end
......@@ -254,7 +254,7 @@ describe Project do
new_project = build_stubbed(:project, namespace_id: project_with_wiki_suffix.namespace_id, path: 'foo')
expect(new_project).not_to be_valid
expect(new_project.errors[:name].first).to eq('has already been taken')
expect(new_project.errors[:name].first).to eq(_('has already been taken'))
end
end
end
......@@ -385,7 +385,7 @@ describe Project do
end
it 'contains errors related to the project being deleted' do
expect(new_project.errors.full_messages.first).to eq('The project is still being deleted. Please try again later.')
expect(new_project.errors.full_messages.first).to eq(_('The project is still being deleted. Please try again later.'))
end
end
......@@ -2270,7 +2270,7 @@ describe Project do
it 'returns the right human import status' do
project = create(:project, :import_started)
expect(project.human_import_status_name).to eq('started')
expect(project.human_import_status_name).to eq(_('started'))
end
end
......
......@@ -142,7 +142,7 @@ describe User, :do_not_mock_admin_mode do
expect(user.namespace).to receive(:any_project_has_container_registry_tags?).and_return(true)
user.username = 'new_path'
expect(user).to be_invalid
expect(user.errors.messages[:username].first).to match('cannot be changed if a personal project has container registry tags')
expect(user.errors.messages[:username].first).to eq(_('cannot be changed if a personal project has container registry tags.'))
end
end
......@@ -3214,7 +3214,7 @@ describe User, :do_not_mock_admin_mode do
it 'causes the user save to fail' do
expect(user.update(username: new_username)).to be_falsey
expect(user.namespace.errors.messages[:path].first).to eq('has already been taken')
expect(user.namespace.errors.messages[:path].first).to eq(_('has already been taken'))
end
it 'adds the namespace errors to the user' do
......
......@@ -636,7 +636,7 @@ describe API::Files do
put api(route(file_path), user), params: params_with_stale_id
expect(response).to have_gitlab_http_status(400)
expect(json_response['message']).to eq('You are attempting to update a file that has changed since you started editing it.')
expect(json_response['message']).to eq(_('You are attempting to update a file that has changed since you started editing it.'))
end
it "updates existing file in project repo with accepts correct last commit id" do
......
......@@ -261,7 +261,7 @@ describe API::GroupClusters do
it 'responds with 400' do
expect(response).to have_gitlab_http_status(400)
expect(json_response['message']['base'].first).to include('Instance does not support multiple Kubernetes clusters')
expect(json_response['message']['base'].first).to eq(_('Instance does not support multiple Kubernetes clusters'))
end
end
......@@ -372,7 +372,7 @@ describe API::GroupClusters do
end
it 'returns validation error' do
expect(json_response['message']['platform_kubernetes.base'].first).to eq('Cannot modify managed Kubernetes cluster')
expect(json_response['message']['platform_kubernetes.base'].first).to eq(_('Cannot modify managed Kubernetes cluster'))
end
end
......
......@@ -453,7 +453,7 @@ describe API::Issues do
params: { to_project_id: project.id }
expect(response).to have_gitlab_http_status(400)
expect(json_response['message']).to eq('Cannot move issue to project it originates from!')
expect(json_response['message']).to eq(s_('MoveIssue|Cannot move issue to project it originates from!'))
end
end
......@@ -463,7 +463,7 @@ describe API::Issues do
params: { to_project_id: target_project2.id }
expect(response).to have_gitlab_http_status(400)
expect(json_response['message']).to eq('Cannot move issue due to insufficient permissions!')
expect(json_response['message']).to eq(s_('MoveIssue|Cannot move issue due to insufficient permissions!'))
end
end
......
......@@ -260,7 +260,7 @@ describe API::ProjectClusters do
it 'responds with 400' do
expect(response).to have_gitlab_http_status(400)
expect(json_response['message']['base'].first).to eq('Instance does not support multiple Kubernetes clusters')
expect(json_response['message']['base'].first).to eq(_('Instance does not support multiple Kubernetes clusters'))
end
end
......@@ -376,7 +376,7 @@ describe API::ProjectClusters do
end
it 'returns validation error' do
expect(json_response['message']['platform_kubernetes.base'].first).to eq('Cannot modify managed Kubernetes cluster')
expect(json_response['message']['platform_kubernetes.base'].first).to eq(_('Cannot modify managed Kubernetes cluster'))
end
end
......
......@@ -153,11 +153,11 @@ describe JobEntity do
end
it 'states that it failed' do
expect(subject[:status][:label]).to eq('failed')
expect(subject[:status][:label]).to eq(s_('CiStatusLabel|failed'))
end
it 'indicates the failure reason on tooltip' do
expect(subject[:status][:tooltip]).to eq('failed - (API failure)')
expect(subject[:status][:tooltip]).to eq("#{s_('CiStatusLabel|failed')} - (API failure)")
end
it 'includes a callout message with a verbose output' do
......@@ -181,7 +181,7 @@ describe JobEntity do
end
it 'indicates the failure reason on tooltip' do
expect(subject[:status][:tooltip]).to eq('failed - (API failure) (allowed to fail)')
expect(subject[:status][:tooltip]).to eq("#{s_('CiStatusLabel|failed')} - (API failure) (allowed to fail)")
end
it 'includes a callout message with a verbose output' do
......
......@@ -29,7 +29,7 @@ describe StageEntity do
it 'contains detailed status' do
expect(subject[:status]).to include :text, :label, :group, :icon, :tooltip
expect(subject[:status][:label]).to eq 'passed'
expect(subject[:status][:label]).to eq s_('CiStatusLabel|passed')
end
it 'contains valid name' do
......@@ -47,7 +47,7 @@ describe StageEntity do
end
it 'contains stage title' do
expect(subject[:title]).to eq 'test: passed'
expect(subject[:title]).to eq "test: #{s_('CiStatusLabel|passed')}"
end
it 'does not contain play_details info' do
......
......@@ -51,7 +51,7 @@ describe Clusters::Applications::PatchService do
service.execute
expect(application).to be_update_errored
expect(application.status_reason).to match('Kubernetes error: 500')
expect(application.status_reason).to eq(_('Kubernetes error: %{error_code}') % { error_code: 500 })
end
end
......@@ -73,7 +73,7 @@ describe Clusters::Applications::PatchService do
service.execute
expect(application).to be_update_errored
expect(application.status_reason).to eq('Failed to update.')
expect(application.status_reason).to eq(_('Failed to update.'))
end
end
end
......
......@@ -51,7 +51,7 @@ describe Clusters::Applications::UpgradeService do
service.execute
expect(application).to be_update_errored
expect(application.status_reason).to match('Kubernetes error: 500')
expect(application.status_reason).to eq(_('Kubernetes error: %{error_code}') % { error_code: 500 })
end
end
......@@ -73,7 +73,7 @@ describe Clusters::Applications::UpgradeService do
service.execute
expect(application).to be_update_errored
expect(application.status_reason).to eq('Failed to upgrade.')
expect(application.status_reason).to eq(_('Failed to upgrade.'))
end
end
end
......
......@@ -60,7 +60,7 @@ describe Groups::CreateService, '#execute' do
it 'does not save group and returns an error' do
is_expected.not_to be_persisted
expect(subject.errors[:parent_id].first).to eq('You don’t have permission to create a subgroup in this group.')
expect(subject.errors[:parent_id].first).to eq(s_('CreateGroup|You don’t have permission to create a subgroup in this group.'))
expect(subject.parent_id).to be_nil
end
end
......
......@@ -18,7 +18,7 @@ describe Lfs::UnlockFileService do
expect(result[:status]).to eq(:error)
expect(result[:http_status]).to eq(403)
expect(result[:message]).to eq('You have no permissions')
expect(result[:message]).to eq(_('You have no permissions'))
end
end
......@@ -82,7 +82,7 @@ describe Lfs::UnlockFileService do
result = subject.execute
expect(result[:status]).to eq(:error)
expect(result[:message]).to match(/You must have maintainer access/)
expect(result[:message]).to eq(_('You must have maintainer access to force delete a lock'))
expect(result[:http_status]).to eq(403)
end
end
......
......@@ -570,7 +570,7 @@ describe QuickActions::InterpretService do
it 'returns move issue failure message when the referenced issue is not found' do
_, _, message = service.execute('/move invalid', issue)
expect(message).to eq("Failed to move this issue because target project doesn't exist.")
expect(message).to eq(_("Failed to move this issue because target project doesn't exist."))
end
end
......@@ -1125,7 +1125,7 @@ describe QuickActions::InterpretService do
_, _, message = service.execute('/due invalid date', issue)
expect(message).to eq('Failed to set due date because the date format is invalid.')
expect(message).to eq(_('Failed to set due date because the date format is invalid.'))
end
it_behaves_like 'due command' do
......@@ -1251,12 +1251,12 @@ describe QuickActions::InterpretService do
let(:issuable) { issue }
end
it_behaves_like 'empty command', 'Failed to mark this issue as a duplicate because referenced issue was not found.' do
it_behaves_like 'empty command', _('Failed to mark this issue as a duplicate because referenced issue was not found.') do
let(:content) { "/duplicate imaginary#1234" }
let(:issuable) { issue }
end
it_behaves_like 'empty command', 'Failed to mark this issue as a duplicate because referenced issue was not found.' do
it_behaves_like 'empty command', _('Failed to mark this issue as a duplicate because referenced issue was not found.') do
let(:other_project) { create(:project, :private) }
let(:issue_duplicate) { create(:issue, project: other_project) }
......@@ -1321,7 +1321,7 @@ describe QuickActions::InterpretService do
let(:issuable) { issue }
end
it_behaves_like 'empty command', 'Failed to mark this issue as a duplicate because referenced issue was not found.' do
it_behaves_like 'empty command', _('Failed to mark this issue as a duplicate because referenced issue was not found.') do
let(:content) { '/duplicate #{issue.to_reference}' }
let(:issuable) { issue }
end
......@@ -1695,7 +1695,7 @@ describe QuickActions::InterpretService do
merge_request.update!(label_ids: [bug.id])
_, explanations = service.explain(content, merge_request)
expect(explanations).to eq(['Removes all labels.'])
expect(explanations).to eq([_('Removes all labels.')])
end
end
......@@ -1856,13 +1856,13 @@ describe QuickActions::InterpretService do
it 'uses the default branch name' do
_, explanations = service.explain(content, issue)
expect(explanations).to eq(['Creates a branch and a merge request to resolve this issue.'])
expect(explanations).to eq([_('Creates a branch and a merge request to resolve this issue.')])
end
it 'returns the execution message using the default branch name' do
_, _, message = service.execute(content, issue)
expect(message).to eq('Created a branch and a merge request to resolve this issue.')
expect(message).to eq(_('Created a branch and a merge request to resolve this issue.'))
end
end
......
......@@ -348,7 +348,7 @@ describe SystemNoteService do
it "blocks cross reference when #{type.underscore}_events is false" do
jira_tracker.update("#{type}_events" => false)
expect(cross_reference(type)).to eq("Events for #{type.pluralize.humanize.downcase} are disabled.")
expect(cross_reference(type)).to eq(s_('JiraService|Events for %{noteable_model_name} are disabled.') % { noteable_model_name: type.pluralize.humanize.downcase })
end
it "creates cross reference when #{type.underscore}_events is true" do
......
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