Commit 366a3f9e authored by Sean McGivern's avatar Sean McGivern

Merge branch 'cablett-it-specify' into 'master'

Change some `it do` to `specify do`

See merge request gitlab-org/gitlab!31199
parents 162c6641 576484d7
......@@ -24,7 +24,7 @@ describe Admin::CredentialsController do
let_it_be(:personal_access_tokens) { create_list(:personal_access_token, 2) }
shared_examples_for 'filtering by `personal_access_tokens`' do
it do
specify do
get :index, params: params
expect(assigns(:credentials)).to match_array(personal_access_tokens)
......
......@@ -37,7 +37,7 @@ describe Profiles::PreferencesController do
context 'when security dashboard feature is disabled' do
context 'when security dashboard feature enabled' do
it do
specify do
expect { subject }.not_to change { user.reload.group_view_security_dashboard? }
end
end
......
......@@ -9,7 +9,7 @@ describe Groups::RoadmapController do
describe '#show' do
context 'when the user is signed in' do
shared_examples_for 'returns 404 status' do
it do
specify do
get :show, params: { group_id: group }
expect(response).to have_gitlab_http_status(:not_found)
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe Types::PermissionTypes::Epic do
it do
specify do
expected_permissions = [:read_epic, :read_epic_iid, :update_epic, :destroy_epic,
:admin_epic, :create_epic, :create_note, :award_emoji]
......
......@@ -49,7 +49,7 @@ describe Gitlab::ApplicationContext do
end
with_them do
it do
specify do
# Build a hash that has all `provided_options` as keys, and `nil` as value
provided_values = provided_options.map { |key| [key, nil] }.to_h
context = described_class.new(provided_values)
......
......@@ -31,7 +31,7 @@ describe Gitlab::CIDR do
end
with_them do
it do
specify do
expect(described_class.new(values).match?(ip)).to eq(match)
end
end
......
......@@ -300,7 +300,7 @@ describe Gitlab::Geo, :geo, :request_store do
end
with_them do
it do
specify do
stub_application_setting(geo_node_allowed_ips: allowed_ips)
expect(described_class.allowed_ip?(ip)).to eq(allowed)
......
......@@ -95,7 +95,7 @@ describe ApplicationSetting do
end
with_them do
it do
specify do
setting.update_column(:geo_node_allowed_ips, allowed_ips)
expect(setting.reload.valid?).to eq(is_valid)
......@@ -122,7 +122,7 @@ describe ApplicationSetting do
end
with_them do
it do
specify do
setting.elasticsearch_url = elasticsearch_url
expect(setting.valid?).to eq(is_valid)
......
......@@ -862,7 +862,7 @@ describe Project do
with_them do
let(:project) { build(:project, :mirror, import_url: import_url, import_data_attributes: { auth_method: auth_method } ) }
it do
specify do
expect(project.repository).to receive(:fetch_upstream).with(expected, forced: false)
project.fetch_mirror
......
......@@ -105,9 +105,7 @@ describe GroupPolicy do
subject { described_class.new(non_group_member, private_group) }
context 'when user is not invited to any of the group projects' do
it do
is_expected.not_to be_allowed(:read_group_contribution_analytics)
end
it { is_expected.not_to be_allowed(:read_group_contribution_analytics) }
end
context 'when user is invited to a group project, but not to the group' do
......@@ -117,9 +115,7 @@ describe GroupPolicy do
private_project.add_guest(non_group_member)
end
it do
is_expected.not_to be_allowed(:read_group_contribution_analytics)
end
it { is_expected.not_to be_allowed(:read_group_contribution_analytics) }
end
end
end
......@@ -674,7 +670,7 @@ describe GroupPolicy do
stub_licensed_features(security_dashboard: true)
end
it do
specify do
expect_allowed(:read_group)
expect_allowed(:read_group_security_dashboard)
expect_disallowed(:upload_file)
......
......@@ -211,25 +211,19 @@ describe ProjectPolicy do
context 'with admin' do
let(:current_user) { admin }
it do
is_expected.to be_allowed(:admin_mirror)
end
it { is_expected.to be_allowed(:admin_mirror) }
end
context 'with owner' do
let(:current_user) { owner }
it do
is_expected.to be_allowed(:admin_mirror)
end
it { is_expected.to be_allowed(:admin_mirror) }
end
context 'with developer' do
let(:current_user) { developer }
it do
is_expected.to be_disallowed(:admin_mirror)
end
it { is_expected.to be_disallowed(:admin_mirror) }
end
end
......@@ -241,17 +235,13 @@ describe ProjectPolicy do
context 'with admin' do
let(:current_user) { admin }
it do
is_expected.to be_allowed(:admin_mirror)
end
it { is_expected.to be_allowed(:admin_mirror) }
end
context 'with owner' do
let(:current_user) { owner }
it do
is_expected.to be_disallowed(:admin_mirror)
end
it { is_expected.to be_disallowed(:admin_mirror) }
end
end
......@@ -263,17 +253,13 @@ describe ProjectPolicy do
context 'with admin' do
let(:current_user) { admin }
it do
is_expected.to be_disallowed(:admin_mirror)
end
it { is_expected.to be_disallowed(:admin_mirror) }
end
context 'with owner' do
let(:current_user) { owner }
it do
is_expected.to be_disallowed(:admin_mirror)
end
it { is_expected.to be_disallowed(:admin_mirror) }
end
end
......@@ -285,17 +271,13 @@ describe ProjectPolicy do
context 'with admin' do
let(:current_user) { admin }
it do
is_expected.to be_allowed(:admin_mirror)
end
it { is_expected.to be_allowed(:admin_mirror) }
end
context 'with owner' do
let(:current_user) { owner }
it do
is_expected.to be_allowed(:admin_mirror)
end
it { is_expected.to be_allowed(:admin_mirror) }
end
end
end
......@@ -973,9 +955,7 @@ describe ProjectPolicy do
stub_licensed_features(feature => true)
end
it do
is_expected.to(allowed ? be_allowed(policy) : be_disallowed(policy))
end
it { is_expected.to(allowed ? be_allowed(policy) : be_disallowed(policy)) }
context 'when feature is not available' do
before do
......@@ -1173,9 +1153,7 @@ describe ProjectPolicy do
stub_licensed_features(code_review_analytics: true)
end
it do
is_expected.to(allowed ? be_allowed(:read_code_review_analytics) : be_disallowed(:read_code_review_analytics))
end
it { is_expected.to(allowed ? be_allowed(:read_code_review_analytics) : be_disallowed(:read_code_review_analytics)) }
end
context 'with code review analytics is not available in license' do
......@@ -1256,9 +1234,7 @@ describe ProjectPolicy do
stub_application_setting(setting_name => setting)
end
it do
is_expected.to(allowed ? be_allowed(policy) : be_disallowed(policy))
end
it { is_expected.to(allowed ? be_allowed(policy) : be_disallowed(policy)) }
end
end
......@@ -1283,9 +1259,7 @@ describe ProjectPolicy do
stub_application_setting(setting_name => setting)
end
it do
is_expected.to(allowed ? be_allowed(policy) : be_disallowed(policy))
end
it { is_expected.to(allowed ? be_allowed(policy) : be_disallowed(policy)) }
end
end
end
......@@ -1338,9 +1312,7 @@ describe ProjectPolicy do
stub_application_setting(setting_name => setting)
end
it do
is_expected.to(allowed ? be_allowed(policy) : be_disallowed(policy))
end
it { is_expected.to(allowed ? be_allowed(policy) : be_disallowed(policy)) }
end
end
......@@ -1365,9 +1337,7 @@ describe ProjectPolicy do
stub_application_setting(setting_name => setting)
end
it do
is_expected.to(allowed ? be_allowed(policy) : be_disallowed(policy))
end
it { is_expected.to(allowed ? be_allowed(policy) : be_disallowed(policy)) }
end
end
end
......@@ -1403,9 +1373,7 @@ describe ProjectPolicy do
stub_licensed_features(compliance_framework: feature_enabled)
end
it do
is_expected.to(allowed ? be_allowed(policy) : be_disallowed(policy))
end
it { is_expected.to(allowed ? be_allowed(policy) : be_disallowed(policy)) }
end
end
end
......@@ -646,7 +646,7 @@ describe API::Groups do
subject { delete api("/groups/#{group.id}", user) }
shared_examples_for 'immediately enqueues the job to delete the group' do
it do
specify do
Sidekiq::Testing.fake! do
expect { subject }.to change(GroupDestroyWorker.jobs, :size).by(1)
end
......
......@@ -37,7 +37,7 @@ describe API::Todos do
end
shared_examples 'an endpoint that responds with success' do
it do
specify do
expect(response).to have_gitlab_http_status(:ok)
end
end
......
......@@ -7,7 +7,7 @@ describe 'Git HTTP requests' do
include WorkhorseHelpers
shared_examples_for 'pulls are allowed' do
it do
specify do
download(path, env) do |response|
expect(response).to have_gitlab_http_status(:ok)
expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
......@@ -16,7 +16,7 @@ describe 'Git HTTP requests' do
end
shared_examples_for 'pushes are allowed' do
it do
specify do
upload(path, env) do |response|
expect(response).to have_gitlab_http_status(:ok)
expect(response.media_type).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
......
......@@ -157,7 +157,7 @@ describe Git::BranchPushService do
let(:commits_to_sync) { [] }
shared_examples 'enqueues Jira sync worker' do
it do
specify do
Sidekiq::Testing.fake! do
expect(JiraConnect::SyncBranchWorker).to receive(:perform_async)
.with(project.id, branch_to_sync, commits_to_sync)
......@@ -169,7 +169,7 @@ describe Git::BranchPushService do
end
shared_examples 'does not enqueue Jira sync worker' do
it do
specify do
Sidekiq::Testing.fake! do
expect { subject.execute }.not_to change(JiraConnect::SyncBranchWorker.jobs, :size)
end
......
......@@ -14,7 +14,7 @@ describe Members::DestroyService do
end
shared_examples_for 'logs an audit event' do
it do
specify do
expect { event }.to change { SecurityEvent.count }.by(1)
end
end
......
......@@ -19,7 +19,7 @@ describe Members::UpdateService do
end
shared_examples_for 'logs an audit event' do
it do
specify do
expect do
described_class.new(current_user, params).execute(member, permission: permission)
end.to change { SecurityEvent.count }.by(1)
......
......@@ -415,7 +415,7 @@ describe EE::NotificationService, :mailer do
end
describe '#new_note' do
it do
specify do
reset_delivered_emails!
expect(SentNotification).to receive(:record).with(epic, any_args).exactly(9).times
......
......@@ -28,7 +28,7 @@ describe MergeTrains::CreatePipelineService do
shared_examples_for 'returns an error' do
let(:expected_reason) { 'unknown' }
it do
specify do
expect(subject[:status]).to eq(:error)
expect(subject[:message]).to eq(expected_reason)
end
......
......@@ -27,7 +27,7 @@ describe MergeTrains::RefreshMergeRequestService do
shared_examples_for 'drops the merge request from the merge train' do
let(:expected_reason) { 'unknown' }
it do
specify do
expect_next_instance_of(AutoMerge::MergeTrainService) do |service|
expect(service).to receive(:abort).with(merge_request, expected_reason, hash_including(process_next: false))
end
......@@ -39,7 +39,7 @@ describe MergeTrains::RefreshMergeRequestService do
shared_examples_for 'creates a pipeline for merge train' do
let(:previous_ref) { 'refs/heads/master' }
it do
specify do
expect_next_instance_of(MergeTrains::CreatePipelineService, project, maintainer) do |pipeline_service|
allow(pipeline_service).to receive(:execute) { { status: :success, pipeline: pipeline } }
expect(pipeline_service).to receive(:execute).with(merge_request, previous_ref)
......@@ -73,7 +73,7 @@ describe MergeTrains::RefreshMergeRequestService do
end
shared_examples_for 'does not create a pipeline' do
it do
specify do
expect(service).not_to receive(:create_pipeline!)
result = subject
......
......@@ -29,7 +29,7 @@ end
RSpec.shared_examples 'responds with "not found" for an unknown vulnerability ID' do
let(:vulnerability_id) { 0 }
it do
specify do
subject
expect(response).to have_gitlab_http_status(:not_found)
......
......@@ -24,7 +24,7 @@ describe Projects::ServiceHookLogsController do
describe 'GET #show' do
subject { get :show, params: log_params }
it do
specify do
expect(response).to be_successful
end
end
......
......@@ -23,7 +23,7 @@ describe 'Adding an AwardEmoji' do
end
shared_examples 'a mutation that does not create an AwardEmoji' do
it do
specify do
expect do
post_graphql_mutation(mutation, current_user: current_user)
end.not_to change { AwardEmoji.count }
......
......@@ -24,7 +24,7 @@ describe 'Removing an AwardEmoji' do
end
shared_examples 'a mutation that does not destroy an AwardEmoji' do
it do
specify do
expect do
post_graphql_mutation(mutation, current_user: current_user)
end.not_to change { AwardEmoji.count }
......
......@@ -23,7 +23,7 @@ describe 'Toggling an AwardEmoji' do
end
shared_examples 'a mutation that does not create or destroy an AwardEmoji' do
it do
specify do
expect do
post_graphql_mutation(mutation, current_user: current_user)
end.not_to change { AwardEmoji.count }
......
......@@ -25,7 +25,7 @@ describe 'Mark snippet as spam', :do_not_mock_admin_mode do
end
shared_examples 'does not mark the snippet as spam' do
it do
specify do
expect do
post_graphql_mutation(mutation, current_user: current_user)
end.not_to change { snippet.reload.user_agent_detail.submitted }
......
......@@ -35,7 +35,7 @@ describe 'Getting Grafana Integration' do
it_behaves_like 'a working graphql query'
it { expect(integration_data).to be nil }
specify { expect(integration_data).to be nil }
end
context 'with project admin permissions' do
......@@ -45,16 +45,16 @@ describe 'Getting Grafana Integration' do
it_behaves_like 'a working graphql query'
it { expect(integration_data['token']).to eql grafana_integration.masked_token }
it { expect(integration_data['grafanaUrl']).to eql grafana_integration.grafana_url }
specify { expect(integration_data['token']).to eql grafana_integration.masked_token }
specify { expect(integration_data['grafanaUrl']).to eql grafana_integration.grafana_url }
it do
specify do
expect(
integration_data['createdAt']
).to eql grafana_integration.created_at.strftime('%Y-%m-%dT%H:%M:%SZ')
end
it do
specify do
expect(
integration_data['updatedAt']
).to eql grafana_integration.updated_at.strftime('%Y-%m-%dT%H:%M:%SZ')
......
......@@ -25,7 +25,7 @@ RSpec.shared_examples 'creating award emojis marks Todos as done' do
let(:awardable) { create(type) }
let!(:todo) { create(:todo, target: awardable, project: project, user: user) }
it do
specify do
subject
expect(todo.reload.done?).to eq(expectation)
......
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