Commit fe23bdab authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'cablett-consistent-jira' into 'master'

Make Jira capitalisation consistent in test descriptions

See merge request gitlab-org/gitlab!29872
parents a73020ba e1e823c2
...@@ -63,7 +63,7 @@ describe Projects::Import::JiraController do ...@@ -63,7 +63,7 @@ describe Projects::Import::JiraController do
stub_feature_flags(jira_issue_import_vue: false) stub_feature_flags(jira_issue_import_vue: false)
end end
context 'when jira service is enabled for the project' do context 'when Jira service is enabled for the project' do
let_it_be(:jira_service) { create(:jira_service, project: project) } let_it_be(:jira_service) { create(:jira_service, project: project) }
context 'when user is developer' do context 'when user is developer' do
...@@ -79,7 +79,7 @@ describe Projects::Import::JiraController do ...@@ -79,7 +79,7 @@ describe Projects::Import::JiraController do
get :show, params: { namespace_id: project.namespace.to_param, project_id: project } get :show, params: { namespace_id: project.namespace.to_param, project_id: project }
end end
it 'does not query jira service' do it 'does not query Jira service' do
expect(project).not_to receive(:jira_service) expect(project).not_to receive(:jira_service)
end end
...@@ -118,7 +118,7 @@ describe Projects::Import::JiraController do ...@@ -118,7 +118,7 @@ describe Projects::Import::JiraController do
end end
end end
context 'when running jira import first time' do context 'when running Jira import first time' do
context 'get show' do context 'get show' do
before do before do
allow(JIRA::Resource::Project).to receive(:all).and_return(jira_projects) allow(JIRA::Resource::Project).to receive(:all).and_return(jira_projects)
...@@ -147,7 +147,7 @@ describe Projects::Import::JiraController do ...@@ -147,7 +147,7 @@ describe Projects::Import::JiraController do
end end
context 'post import' do context 'post import' do
context 'when jira project key is empty' do context 'when Jira project key is empty' do
it 'redirects back to show with an error' do it 'redirects back to show with an error' do
post :import, params: { namespace_id: project.namespace, project_id: project, jira_project_key: '' } post :import, params: { namespace_id: project.namespace, project_id: project, jira_project_key: '' }
...@@ -197,7 +197,7 @@ describe Projects::Import::JiraController do ...@@ -197,7 +197,7 @@ describe Projects::Import::JiraController do
end end
end end
context 'when jira import ran before' do context 'when Jira import ran before' do
let_it_be(:jira_import_state) { create(:jira_import_state, :finished, project: project, jira_project_key: jira_project_key) } let_it_be(:jira_import_state) { create(:jira_import_state, :finished, project: project, jira_project_key: jira_project_key) }
context 'get show' do context 'get show' do
......
...@@ -16,7 +16,7 @@ describe Resolvers::Projects::JiraImportsResolver do ...@@ -16,7 +16,7 @@ describe Resolvers::Projects::JiraImportsResolver do
context 'when anonymous user' do context 'when anonymous user' do
let(:current_user) { nil } let(:current_user) { nil }
it_behaves_like 'no jira import access' it_behaves_like 'no Jira import access'
end end
end end
...@@ -25,7 +25,7 @@ describe Resolvers::Projects::JiraImportsResolver do ...@@ -25,7 +25,7 @@ describe Resolvers::Projects::JiraImportsResolver do
project.add_guest(user) project.add_guest(user)
end end
it_behaves_like 'no jira import data present' it_behaves_like 'no Jira import data present'
it 'does not raise access error' do it 'does not raise access error' do
expect do expect do
...@@ -47,14 +47,14 @@ describe Resolvers::Projects::JiraImportsResolver do ...@@ -47,14 +47,14 @@ describe Resolvers::Projects::JiraImportsResolver do
stub_feature_flags(jira_issue_import: false) stub_feature_flags(jira_issue_import: false)
end end
it_behaves_like 'no jira import access' it_behaves_like 'no Jira import access'
end end
context 'when user cannot read Jira imports' do context 'when user cannot read Jira imports' do
context 'when anonymous user' do context 'when anonymous user' do
let(:current_user) { nil } let(:current_user) { nil }
it_behaves_like 'no jira import access' it_behaves_like 'no Jira import access'
end end
end end
......
...@@ -90,7 +90,7 @@ describe Gitlab::BackgroundMigration::MigrateIssueTrackersSensitiveData, schema: ...@@ -90,7 +90,7 @@ describe Gitlab::BackgroundMigration::MigrateIssueTrackersSensitiveData, schema:
end end
end end
context 'with jira service' do context 'with Jira service' do
let!(:service) do let!(:service) do
services.create(id: 10, type: 'JiraService', title: nil, properties: jira_properties.to_json, category: 'issue_tracker') services.create(id: 10, type: 'JiraService', title: nil, properties: jira_properties.to_json, category: 'issue_tracker')
end end
...@@ -202,7 +202,7 @@ describe Gitlab::BackgroundMigration::MigrateIssueTrackersSensitiveData, schema: ...@@ -202,7 +202,7 @@ describe Gitlab::BackgroundMigration::MigrateIssueTrackersSensitiveData, schema:
end end
end end
context 'with jira service which has data fields record inconsistent with properties field' do context 'with Jira service which has data fields record inconsistent with properties field' do
let!(:service) do let!(:service) do
services.create(id: 16, type: 'CustomIssueTrackerService', description: 'Existing description', properties: jira_properties.to_json, category: 'issue_tracker').tap do |service| services.create(id: 16, type: 'CustomIssueTrackerService', description: 'Existing description', properties: jira_properties.to_json, category: 'issue_tracker').tap do |service|
JiraTrackerData.create!(service_id: service.id, url: 'http://other_jira_url') JiraTrackerData.create!(service_id: service.id, url: 'http://other_jira_url')
...@@ -241,7 +241,7 @@ describe Gitlab::BackgroundMigration::MigrateIssueTrackersSensitiveData, schema: ...@@ -241,7 +241,7 @@ describe Gitlab::BackgroundMigration::MigrateIssueTrackersSensitiveData, schema:
end end
end end
context 'jira service with empty properties' do context 'Jira service with empty properties' do
let!(:service) do let!(:service) do
services.create(id: 18, type: 'JiraService', properties: '', category: 'issue_tracker') services.create(id: 18, type: 'JiraService', properties: '', category: 'issue_tracker')
end end
...@@ -253,7 +253,7 @@ describe Gitlab::BackgroundMigration::MigrateIssueTrackersSensitiveData, schema: ...@@ -253,7 +253,7 @@ describe Gitlab::BackgroundMigration::MigrateIssueTrackersSensitiveData, schema:
end end
end end
context 'jira service with nil properties' do context 'Jira service with nil properties' do
let!(:service) do let!(:service) do
services.create(id: 18, type: 'JiraService', properties: nil, category: 'issue_tracker') services.create(id: 18, type: 'JiraService', properties: nil, category: 'issue_tracker')
end end
...@@ -265,7 +265,7 @@ describe Gitlab::BackgroundMigration::MigrateIssueTrackersSensitiveData, schema: ...@@ -265,7 +265,7 @@ describe Gitlab::BackgroundMigration::MigrateIssueTrackersSensitiveData, schema:
end end
end end
context 'jira service with invalid properties' do context 'Jira service with invalid properties' do
let!(:service) do let!(:service) do
services.create(id: 18, type: 'JiraService', properties: 'invalid data', category: 'issue_tracker') services.create(id: 18, type: 'JiraService', properties: 'invalid data', category: 'issue_tracker')
end end
...@@ -277,7 +277,7 @@ describe Gitlab::BackgroundMigration::MigrateIssueTrackersSensitiveData, schema: ...@@ -277,7 +277,7 @@ describe Gitlab::BackgroundMigration::MigrateIssueTrackersSensitiveData, schema:
end end
end end
context 'with jira service with invalid properties, valid jira service and valid bugzilla service' do context 'with Jira service with invalid properties, valid Jira service and valid bugzilla service' do
let!(:jira_service_invalid) do let!(:jira_service_invalid) do
services.create(id: 19, title: 'invalid - title', description: 'invalid - description', type: 'JiraService', properties: 'invalid data', category: 'issue_tracker') services.create(id: 19, title: 'invalid - title', description: 'invalid - description', type: 'JiraService', properties: 'invalid data', category: 'issue_tracker')
end end
......
...@@ -118,7 +118,7 @@ describe 'Starting a Jira Import' do ...@@ -118,7 +118,7 @@ describe 'Starting a Jira Import' do
it_behaves_like 'a mutation that returns errors in the response', errors: ['Unable to find Jira project to import data from.'] it_behaves_like 'a mutation that returns errors in the response', errors: ['Unable to find Jira project to import data from.']
end end
context 'when jira import successfully scheduled' do context 'when Jira import successfully scheduled' do
it 'schedules a Jira import' do it 'schedules a Jira import' do
post_graphql_mutation(mutation, current_user: current_user) post_graphql_mutation(mutation, current_user: current_user)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
describe 'query jira import data' do describe 'query Jira import data' do
include GraphqlHelpers include GraphqlHelpers
let_it_be(:current_user) { create(:user) } let_it_be(:current_user) { create(:user) }
......
...@@ -73,14 +73,14 @@ describe JiraImport::StartImportService do ...@@ -73,14 +73,14 @@ describe JiraImport::StartImportService do
expect(subject).to be_success expect(subject).to be_success
end end
it 'schedules jira import' do it 'schedules Jira import' do
subject subject
expect(project.latest_jira_import).to be_scheduled expect(project.latest_jira_import).to be_scheduled
end end
end end
it 'creates jira import data' do it 'creates Jira import data' do
jira_import = subject.payload[:import_data] jira_import = subject.payload[:import_data]
expect(jira_import.jira_project_xid).to eq(0) expect(jira_import.jira_project_xid).to eq(0)
...@@ -89,21 +89,21 @@ describe JiraImport::StartImportService do ...@@ -89,21 +89,21 @@ describe JiraImport::StartImportService do
expect(jira_import.user).to eq(user) expect(jira_import.user).to eq(user)
end end
it 'creates jira import label' do it 'creates Jira import label' do
expect { subject }.to change { Label.count }.by(1) expect { subject }.to change { Label.count }.by(1)
end end
it 'creates jira label title with correct number' do it 'creates Jira label title with correct number' do
jira_import = subject.payload[:import_data] jira_import = subject.payload[:import_data]
label_title = "jira-import::#{jira_import.jira_project_key}-1" label_title = "jira-import::#{jira_import.jira_project_key}-1"
expect(jira_import.label.title).to eq(label_title) expect(jira_import.label.title).to eq(label_title)
end end
context 'when multiple jira imports for same jira project' do context 'when multiple Jira imports for same Jira project' do
let!(:jira_imports) { create_list(:jira_import_state, 3, :finished, project: project, jira_project_key: fake_key)} let!(:jira_imports) { create_list(:jira_import_state, 3, :finished, project: project, jira_project_key: fake_key)}
it 'creates jira label title with correct number' do it 'creates Jira label title with correct number' do
jira_import = subject.payload[:import_data] jira_import = subject.payload[:import_data]
label_title = "jira-import::#{jira_import.jira_project_key}-4" label_title = "jira-import::#{jira_import.jira_project_key}-4"
......
# frozen_string_literal: true # frozen_string_literal: true
shared_examples 'no jira import data present' do shared_examples 'no Jira import data present' do
it 'returns none' do it 'returns none' do
expect(resolve_imports).to eq JiraImportState.none expect(resolve_imports).to eq JiraImportState.none
end end
end end
shared_examples 'no jira import access' do shared_examples 'no Jira import access' do
it 'raises error' do it 'raises error' do
expect do expect do
resolve_imports resolve_imports
......
...@@ -20,7 +20,7 @@ shared_examples 'does not advance to next stage' do ...@@ -20,7 +20,7 @@ shared_examples 'does not advance to next stage' do
end end
end end
shared_examples 'cannot do jira import' do shared_examples 'cannot do Jira import' do
it 'does not advance to next stage' do it 'does not advance to next stage' do
worker = described_class.new worker = described_class.new
expect(worker).not_to receive(:import) expect(worker).not_to receive(:import)
......
...@@ -16,7 +16,7 @@ describe Gitlab::JiraImport::Stage::FinishImportWorker do ...@@ -16,7 +16,7 @@ describe Gitlab::JiraImport::Stage::FinishImportWorker do
stub_feature_flags(jira_issue_import: false) stub_feature_flags(jira_issue_import: false)
end end
it_behaves_like 'cannot do jira import' it_behaves_like 'cannot do Jira import'
end end
context 'when feature flag enabled' do context 'when feature flag enabled' do
...@@ -27,7 +27,7 @@ describe Gitlab::JiraImport::Stage::FinishImportWorker do ...@@ -27,7 +27,7 @@ describe Gitlab::JiraImport::Stage::FinishImportWorker do
end end
context 'when import did not start' do context 'when import did not start' do
it_behaves_like 'cannot do jira import' it_behaves_like 'cannot do Jira import'
end end
context 'when import started' do context 'when import started' do
......
...@@ -15,7 +15,7 @@ describe Gitlab::JiraImport::Stage::ImportAttachmentsWorker do ...@@ -15,7 +15,7 @@ describe Gitlab::JiraImport::Stage::ImportAttachmentsWorker do
stub_feature_flags(jira_issue_import: false) stub_feature_flags(jira_issue_import: false)
end end
it_behaves_like 'cannot do jira import' it_behaves_like 'cannot do Jira import'
it_behaves_like 'does not advance to next stage' it_behaves_like 'does not advance to next stage'
end end
...@@ -27,7 +27,7 @@ describe Gitlab::JiraImport::Stage::ImportAttachmentsWorker do ...@@ -27,7 +27,7 @@ describe Gitlab::JiraImport::Stage::ImportAttachmentsWorker do
end end
context 'when import did not start' do context 'when import did not start' do
it_behaves_like 'cannot do jira import' it_behaves_like 'cannot do Jira import'
it_behaves_like 'does not advance to next stage' it_behaves_like 'does not advance to next stage'
end end
......
...@@ -16,7 +16,7 @@ describe Gitlab::JiraImport::Stage::ImportIssuesWorker do ...@@ -16,7 +16,7 @@ describe Gitlab::JiraImport::Stage::ImportIssuesWorker do
stub_feature_flags(jira_issue_import: false) stub_feature_flags(jira_issue_import: false)
end end
it_behaves_like 'cannot do jira import' it_behaves_like 'cannot do Jira import'
it_behaves_like 'does not advance to next stage' it_behaves_like 'does not advance to next stage'
end end
...@@ -28,7 +28,7 @@ describe Gitlab::JiraImport::Stage::ImportIssuesWorker do ...@@ -28,7 +28,7 @@ describe Gitlab::JiraImport::Stage::ImportIssuesWorker do
end end
context 'when import did not start' do context 'when import did not start' do
it_behaves_like 'cannot do jira import' it_behaves_like 'cannot do Jira import'
it_behaves_like 'does not advance to next stage' it_behaves_like 'does not advance to next stage'
end end
......
...@@ -16,7 +16,7 @@ describe Gitlab::JiraImport::Stage::ImportLabelsWorker do ...@@ -16,7 +16,7 @@ describe Gitlab::JiraImport::Stage::ImportLabelsWorker do
stub_feature_flags(jira_issue_import: false) stub_feature_flags(jira_issue_import: false)
end end
it_behaves_like 'cannot do jira import' it_behaves_like 'cannot do Jira import'
it_behaves_like 'does not advance to next stage' it_behaves_like 'does not advance to next stage'
end end
...@@ -28,7 +28,7 @@ describe Gitlab::JiraImport::Stage::ImportLabelsWorker do ...@@ -28,7 +28,7 @@ describe Gitlab::JiraImport::Stage::ImportLabelsWorker do
end end
context 'when import did not start' do context 'when import did not start' do
it_behaves_like 'cannot do jira import' it_behaves_like 'cannot do Jira import'
it_behaves_like 'does not advance to next stage' it_behaves_like 'does not advance to next stage'
end end
......
...@@ -15,7 +15,7 @@ describe Gitlab::JiraImport::Stage::ImportNotesWorker do ...@@ -15,7 +15,7 @@ describe Gitlab::JiraImport::Stage::ImportNotesWorker do
stub_feature_flags(jira_issue_import: false) stub_feature_flags(jira_issue_import: false)
end end
it_behaves_like 'cannot do jira import' it_behaves_like 'cannot do Jira import'
it_behaves_like 'does not advance to next stage' it_behaves_like 'does not advance to next stage'
end end
...@@ -27,7 +27,7 @@ describe Gitlab::JiraImport::Stage::ImportNotesWorker do ...@@ -27,7 +27,7 @@ describe Gitlab::JiraImport::Stage::ImportNotesWorker do
end end
context 'when import did not start' do context 'when import did not start' do
it_behaves_like 'cannot do jira import' it_behaves_like 'cannot do Jira import'
it_behaves_like 'does not advance to next stage' it_behaves_like 'does not advance to next stage'
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