Commit 9a77ca11 authored by James Lopez's avatar James Lopez

Merge branch 'rubocop_examplewording' into 'master'

Autocorrect with RSpec/ExampleWording cop

See merge request gitlab-org/gitlab-ce!26817
parents 2bf4fefd 4ec16912
...@@ -3,7 +3,7 @@ require Rails.root.join('config', 'object_store_settings.rb') ...@@ -3,7 +3,7 @@ require Rails.root.join('config', 'object_store_settings.rb')
describe ObjectStoreSettings do describe ObjectStoreSettings do
describe '.parse' do describe '.parse' do
it 'should set correct default values' do it 'sets correct default values' do
settings = described_class.parse(nil) settings = described_class.parse(nil)
expect(settings['enabled']).to be false expect(settings['enabled']).to be false
......
...@@ -75,7 +75,7 @@ describe Dashboard::MilestonesController do ...@@ -75,7 +75,7 @@ describe Dashboard::MilestonesController do
expect(response.body).not_to include(project_milestone.title) expect(response.body).not_to include(project_milestone.title)
end end
it 'should show counts of group and project milestones to which the user belongs to' do it 'shows counts of group and project milestones to which the user belongs to' do
get :index get :index
expect(response.body).to include("Open\n<span class=\"badge badge-pill\">2</span>") expect(response.body).to include("Open\n<span class=\"badge badge-pill\">2</span>")
......
...@@ -455,7 +455,7 @@ describe Groups::ClustersController do ...@@ -455,7 +455,7 @@ describe Groups::ClustersController do
context 'when domain is invalid' do context 'when domain is invalid' do
let(:domain) { 'http://not-a-valid-domain' } let(:domain) { 'http://not-a-valid-domain' }
it 'should not update cluster attributes' do it 'does not update cluster attributes' do
go go
cluster.reload cluster.reload
......
...@@ -124,7 +124,7 @@ describe Groups::Settings::CiCdController do ...@@ -124,7 +124,7 @@ describe Groups::Settings::CiCdController do
end end
context 'when explicitly enabling auto devops' do context 'when explicitly enabling auto devops' do
it 'should update group attribute' do it 'updates group attribute' do
expect(group.auto_devops_enabled).to eq(true) expect(group.auto_devops_enabled).to eq(true)
end end
end end
...@@ -132,7 +132,7 @@ describe Groups::Settings::CiCdController do ...@@ -132,7 +132,7 @@ describe Groups::Settings::CiCdController do
context 'when explicitly disabling auto devops' do context 'when explicitly disabling auto devops' do
let(:auto_devops_param) { '0' } let(:auto_devops_param) { '0' }
it 'should update group attribute' do it 'updates group attribute' do
expect(group.auto_devops_enabled).to eq(false) expect(group.auto_devops_enabled).to eq(false)
end end
end end
......
...@@ -566,11 +566,11 @@ describe GroupsController do ...@@ -566,11 +566,11 @@ describe GroupsController do
} }
end end
it 'should return a notice' do it 'returns a notice' do
expect(flash[:notice]).to eq("Group '#{group.name}' was successfully transferred.") expect(flash[:notice]).to eq("Group '#{group.name}' was successfully transferred.")
end end
it 'should redirect to the new path' do it 'redirects to the new path' do
expect(response).to redirect_to("/#{new_parent_group.path}/#{group.path}") expect(response).to redirect_to("/#{new_parent_group.path}/#{group.path}")
end end
end end
...@@ -587,11 +587,11 @@ describe GroupsController do ...@@ -587,11 +587,11 @@ describe GroupsController do
} }
end end
it 'should return a notice' do it 'returns a notice' do
expect(flash[:notice]).to eq("Group '#{group.name}' was successfully transferred.") expect(flash[:notice]).to eq("Group '#{group.name}' was successfully transferred.")
end end
it 'should redirect to the new path' do it 'redirects to the new path' do
expect(response).to redirect_to("/#{group.path}") expect(response).to redirect_to("/#{group.path}")
end end
end end
...@@ -611,11 +611,11 @@ describe GroupsController do ...@@ -611,11 +611,11 @@ describe GroupsController do
} }
end end
it 'should return an alert' do it 'returns an alert' do
expect(flash[:alert]).to eq "Transfer failed: namespace directory cannot be moved" expect(flash[:alert]).to eq "Transfer failed: namespace directory cannot be moved"
end end
it 'should redirect to the current path' do it 'redirects to the current path' do
expect(response).to redirect_to(edit_group_path(group)) expect(response).to redirect_to(edit_group_path(group))
end end
end end
...@@ -633,7 +633,7 @@ describe GroupsController do ...@@ -633,7 +633,7 @@ describe GroupsController do
} }
end end
it 'should be denied' do it 'is denied' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(404)
end end
end end
......
...@@ -55,7 +55,7 @@ describe OmniauthCallbacksController, type: :controller do ...@@ -55,7 +55,7 @@ describe OmniauthCallbacksController, type: :controller do
allow(@routes).to receive(:generate_extras) { [path, []] } allow(@routes).to receive(:generate_extras) { [path, []] }
end end
it 'it calls through to the failure handler' do it 'calls through to the failure handler' do
request.env['omniauth.error'] = OneLogin::RubySaml::ValidationError.new("Fingerprint mismatch") request.env['omniauth.error'] = OneLogin::RubySaml::ValidationError.new("Fingerprint mismatch")
request.env['omniauth.error.strategy'] = OmniAuth::Strategies::SAML.new(nil) request.env['omniauth.error.strategy'] = OmniAuth::Strategies::SAML.new(nil)
stub_route_as('/users/auth/saml/callback') stub_route_as('/users/auth/saml/callback')
......
...@@ -285,7 +285,7 @@ describe Projects::BlobController do ...@@ -285,7 +285,7 @@ describe Projects::BlobController do
merge_request.update!(source_project: other_project, target_project: other_project) merge_request.update!(source_project: other_project, target_project: other_project)
end end
it "it redirect to blob" do it "redirects to blob" do
put :update, params: mr_params put :update, params: mr_params
expect(response).to redirect_to(blob_after_edit_path) expect(response).to redirect_to(blob_after_edit_path)
......
...@@ -16,15 +16,15 @@ describe Projects::Ci::LintsController do ...@@ -16,15 +16,15 @@ describe Projects::Ci::LintsController do
get :show, params: { namespace_id: project.namespace, project_id: project } get :show, params: { namespace_id: project.namespace, project_id: project }
end end
it 'should be success' do it 'is success' do
expect(response).to be_success expect(response).to be_success
end end
it 'should render show page' do it 'renders show page' do
expect(response).to render_template :show expect(response).to render_template :show
end end
it 'should retrieve project' do it 'retrieves project' do
expect(assigns(:project)).to eq(project) expect(assigns(:project)).to eq(project)
end end
end end
...@@ -36,7 +36,7 @@ describe Projects::Ci::LintsController do ...@@ -36,7 +36,7 @@ describe Projects::Ci::LintsController do
get :show, params: { namespace_id: project.namespace, project_id: project } get :show, params: { namespace_id: project.namespace, project_id: project }
end end
it 'should respond with 404' do it 'responds with 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(404)
end end
end end
...@@ -74,7 +74,7 @@ describe Projects::Ci::LintsController do ...@@ -74,7 +74,7 @@ describe Projects::Ci::LintsController do
post :create, params: { namespace_id: project.namespace, project_id: project, content: content } post :create, params: { namespace_id: project.namespace, project_id: project, content: content }
end end
it 'should be success' do it 'is success' do
expect(response).to be_success expect(response).to be_success
end end
...@@ -82,7 +82,7 @@ describe Projects::Ci::LintsController do ...@@ -82,7 +82,7 @@ describe Projects::Ci::LintsController do
expect(response).to render_template :show expect(response).to render_template :show
end end
it 'should retrieve project' do it 'retrieves project' do
expect(assigns(:project)).to eq(project) expect(assigns(:project)).to eq(project)
end end
end end
...@@ -102,7 +102,7 @@ describe Projects::Ci::LintsController do ...@@ -102,7 +102,7 @@ describe Projects::Ci::LintsController do
post :create, params: { namespace_id: project.namespace, project_id: project, content: content } post :create, params: { namespace_id: project.namespace, project_id: project, content: content }
end end
it 'should assign errors' do it 'assigns errors' do
expect(assigns[:error]).to eq('jobs:rubocop config contains unknown keys: scriptt') expect(assigns[:error]).to eq('jobs:rubocop config contains unknown keys: scriptt')
end end
end end
...@@ -114,7 +114,7 @@ describe Projects::Ci::LintsController do ...@@ -114,7 +114,7 @@ describe Projects::Ci::LintsController do
post :create, params: { namespace_id: project.namespace, project_id: project, content: content } post :create, params: { namespace_id: project.namespace, project_id: project, content: content }
end end
it 'should respond with 404' do it 'responds with 404' do
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(404)
end end
end end
......
...@@ -15,7 +15,7 @@ describe Projects::CommitsController do ...@@ -15,7 +15,7 @@ describe Projects::CommitsController do
describe "GET commits_root" do describe "GET commits_root" do
context "no ref is provided" do context "no ref is provided" do
it 'should redirect to the default branch of the project' do it 'redirects to the default branch of the project' do
get(:commits_root, get(:commits_root,
params: { params: {
namespace_id: project.namespace, namespace_id: project.namespace,
......
...@@ -65,7 +65,7 @@ describe Projects::MirrorsController do ...@@ -65,7 +65,7 @@ describe Projects::MirrorsController do
expect(flash[:notice]).to match(/successfully updated/) expect(flash[:notice]).to match(/successfully updated/)
end end
it 'should create a RemoteMirror object' do it 'creates a RemoteMirror object' do
expect { do_put(project, remote_mirrors_attributes: remote_mirror_attributes) }.to change(RemoteMirror, :count).by(1) expect { do_put(project, remote_mirrors_attributes: remote_mirror_attributes) }.to change(RemoteMirror, :count).by(1)
end end
end end
...@@ -82,7 +82,7 @@ describe Projects::MirrorsController do ...@@ -82,7 +82,7 @@ describe Projects::MirrorsController do
expect(flash[:alert]).to match(/Only allowed protocols are/) expect(flash[:alert]).to match(/Only allowed protocols are/)
end end
it 'should not create a RemoteMirror object' do it 'does not create a RemoteMirror object' do
expect { do_put(project, remote_mirrors_attributes: remote_mirror_attributes) }.not_to change(RemoteMirror, :count) expect { do_put(project, remote_mirrors_attributes: remote_mirror_attributes) }.not_to change(RemoteMirror, :count)
end end
end end
......
...@@ -5,7 +5,7 @@ describe Projects::ProjectMembersController do ...@@ -5,7 +5,7 @@ describe Projects::ProjectMembersController do
let(:project) { create(:project, :public, :access_requestable) } let(:project) { create(:project, :public, :access_requestable) }
describe 'GET index' do describe 'GET index' do
it 'should have the project_members address with a 200 status code' do it 'has the project_members address with a 200 status code' do
get :index, params: { namespace_id: project.namespace, project_id: project } get :index, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
......
...@@ -147,7 +147,7 @@ describe Projects::ServicesController do ...@@ -147,7 +147,7 @@ describe Projects::ServicesController do
params: { namespace_id: project.namespace, project_id: project, id: service.to_param, service: { namespace: 'updated_namespace' } } params: { namespace_id: project.namespace, project_id: project, id: service.to_param, service: { namespace: 'updated_namespace' } }
end end
it 'should not update the service' do it 'does not update the service' do
service.reload service.reload
expect(service.namespace).not_to eq('updated_namespace') expect(service.namespace).not_to eq('updated_namespace')
end end
...@@ -172,7 +172,7 @@ describe Projects::ServicesController do ...@@ -172,7 +172,7 @@ describe Projects::ServicesController do
context 'with approved services' do context 'with approved services' do
let(:service_id) { 'jira' } let(:service_id) { 'jira' }
it 'should render edit page' do it 'renders edit page' do
expect(response).to be_success expect(response).to be_success
end end
end end
...@@ -180,7 +180,7 @@ describe Projects::ServicesController do ...@@ -180,7 +180,7 @@ describe Projects::ServicesController do
context 'with a deprecated service' do context 'with a deprecated service' do
let(:service_id) { 'kubernetes' } let(:service_id) { 'kubernetes' }
it 'should render edit page' do it 'renders edit page' do
expect(response).to be_success expect(response).to be_success
end end
end end
......
...@@ -14,11 +14,11 @@ describe UserCalloutsController do ...@@ -14,11 +14,11 @@ describe UserCalloutsController do
let(:feature_name) { UserCallout.feature_names.keys.first } let(:feature_name) { UserCallout.feature_names.keys.first }
context 'when callout entry does not exist' do context 'when callout entry does not exist' do
it 'should create a callout entry with dismissed state' do it 'creates a callout entry with dismissed state' do
expect { subject }.to change { UserCallout.count }.by(1) expect { subject }.to change { UserCallout.count }.by(1)
end end
it 'should return success' do it 'returns success' do
subject subject
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
...@@ -28,7 +28,7 @@ describe UserCalloutsController do ...@@ -28,7 +28,7 @@ describe UserCalloutsController do
context 'when callout entry already exists' do context 'when callout entry already exists' do
let!(:callout) { create(:user_callout, feature_name: UserCallout.feature_names.keys.first, user: user) } let!(:callout) { create(:user_callout, feature_name: UserCallout.feature_names.keys.first, user: user) }
it 'should return success' do it 'returns success' do
subject subject
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
...@@ -39,7 +39,7 @@ describe UserCalloutsController do ...@@ -39,7 +39,7 @@ describe UserCalloutsController do
context 'with invalid feature name' do context 'with invalid feature name' do
let(:feature_name) { 'bogus_feature_name' } let(:feature_name) { 'bogus_feature_name' }
it 'should return bad request' do it 'returns bad request' do
subject subject
expect(response).to have_gitlab_http_status(:bad_request) expect(response).to have_gitlab_http_status(:bad_request)
......
...@@ -34,7 +34,7 @@ describe 'Expand and collapse diffs', :js do ...@@ -34,7 +34,7 @@ describe 'Expand and collapse diffs', :js do
define_method(file.split('.').first) { file_container(file) } define_method(file.split('.').first) { file_container(file) }
end end
it 'should show the diff content with a highlighted line when linking to line' do it 'shows the diff content with a highlighted line when linking to line' do
expect(large_diff).not_to have_selector('.code') expect(large_diff).not_to have_selector('.code')
expect(large_diff).to have_selector('.nothing-here-block') expect(large_diff).to have_selector('.nothing-here-block')
...@@ -48,7 +48,7 @@ describe 'Expand and collapse diffs', :js do ...@@ -48,7 +48,7 @@ describe 'Expand and collapse diffs', :js do
expect(large_diff).to have_selector('.hll') expect(large_diff).to have_selector('.hll')
end end
it 'should show the diff content when linking to file' do it 'shows the diff content when linking to file' do
expect(large_diff).not_to have_selector('.code') expect(large_diff).not_to have_selector('.code')
expect(large_diff).to have_selector('.nothing-here-block') expect(large_diff).to have_selector('.nothing-here-block')
......
...@@ -68,17 +68,17 @@ describe 'Explore Groups page', :js do ...@@ -68,17 +68,17 @@ describe 'Explore Groups page', :js do
end end
describe 'landing component' do describe 'landing component' do
it 'should show a landing component' do it 'shows a landing component' do
expect(page).to have_content('Below you will find all the groups that are public.') expect(page).to have_content('Below you will find all the groups that are public.')
end end
it 'should be dismissable' do it 'is dismissable' do
find('.dismiss-button').click find('.dismiss-button').click
expect(page).not_to have_content('Below you will find all the groups that are public.') expect(page).not_to have_content('Below you will find all the groups that are public.')
end end
it 'should persistently not show once dismissed' do it 'does not show persistently once dismissed' do
find('.dismiss-button').click find('.dismiss-button').click
visit explore_groups_path visit explore_groups_path
......
...@@ -43,7 +43,7 @@ describe 'Group CI/CD settings' do ...@@ -43,7 +43,7 @@ describe 'Group CI/CD settings' do
end end
context 'as owner first visiting group settings' do context 'as owner first visiting group settings' do
it 'should see instance enabled badge' do it 'sees instance enabled badge' do
visit group_settings_ci_cd_path(group) visit group_settings_ci_cd_path(group)
page.within '#auto-devops-settings' do page.within '#auto-devops-settings' do
...@@ -53,7 +53,7 @@ describe 'Group CI/CD settings' do ...@@ -53,7 +53,7 @@ describe 'Group CI/CD settings' do
end end
context 'when Auto DevOps group has been enabled' do context 'when Auto DevOps group has been enabled' do
it 'should see group enabled badge' do it 'sees group enabled badge' do
group.update!(auto_devops_enabled: true) group.update!(auto_devops_enabled: true)
visit group_settings_ci_cd_path(group) visit group_settings_ci_cd_path(group)
...@@ -65,7 +65,7 @@ describe 'Group CI/CD settings' do ...@@ -65,7 +65,7 @@ describe 'Group CI/CD settings' do
end end
context 'when Auto DevOps group has been disabled' do context 'when Auto DevOps group has been disabled' do
it 'should not see a badge' do it 'does not see a badge' do
group.update!(auto_devops_enabled: false) group.update!(auto_devops_enabled: false)
visit group_settings_ci_cd_path(group) visit group_settings_ci_cd_path(group)
......
...@@ -237,7 +237,7 @@ describe 'Group' do ...@@ -237,7 +237,7 @@ describe 'Group' do
let!(:project) { create(:project, namespace: group) } let!(:project) { create(:project, namespace: group) }
let!(:path) { group_path(group) } let!(:path) { group_path(group) }
it 'it renders projects and groups on the page' do it 'renders projects and groups on the page' do
visit path visit path
wait_for_requests wait_for_requests
......
...@@ -82,15 +82,15 @@ describe 'Help Pages' do ...@@ -82,15 +82,15 @@ describe 'Help Pages' do
visit help_path visit help_path
end end
it 'should display custom help page text' do it 'displays custom help page text' do
expect(page).to have_text "My Custom Text" expect(page).to have_text "My Custom Text"
end end
it 'should hide marketing content when enabled' do it 'hides marketing content when enabled' do
expect(page).not_to have_link "Get a support subscription" expect(page).not_to have_link "Get a support subscription"
end end
it 'should use a custom support url' do it 'uses a custom support url' do
expect(page).to have_link "See our website for getting help", href: "http://example.com/help" expect(page).to have_link "See our website for getting help", href: "http://example.com/help"
end end
end end
......
...@@ -42,7 +42,7 @@ describe 'Dropdown assignee', :js do ...@@ -42,7 +42,7 @@ describe 'Dropdown assignee', :js do
expect(page).to have_css(js_dropdown_assignee, visible: false) expect(page).to have_css(js_dropdown_assignee, visible: false)
end end
it 'should show loading indicator when opened' do it 'shows loading indicator when opened' do
slow_requests do slow_requests do
# We aren't using `input_filtered_search` because we want to see the loading indicator # We aren't using `input_filtered_search` because we want to see the loading indicator
filtered_search.set('assignee:') filtered_search.set('assignee:')
...@@ -51,13 +51,13 @@ describe 'Dropdown assignee', :js do ...@@ -51,13 +51,13 @@ describe 'Dropdown assignee', :js do
end end
end end
it 'should hide loading indicator when loaded' do it 'hides loading indicator when loaded' do
input_filtered_search('assignee:', submit: false, extra_space: false) input_filtered_search('assignee:', submit: false, extra_space: false)
expect(find(js_dropdown_assignee)).not_to have_css('.filter-dropdown-loading') expect(find(js_dropdown_assignee)).not_to have_css('.filter-dropdown-loading')
end end
it 'should load all the assignees when opened' do it 'loads all the assignees when opened' do
input_filtered_search('assignee:', submit: false, extra_space: false) input_filtered_search('assignee:', submit: false, extra_space: false)
expect(dropdown_assignee_size).to eq(4) expect(dropdown_assignee_size).to eq(4)
......
...@@ -50,7 +50,7 @@ describe 'Dropdown author', :js do ...@@ -50,7 +50,7 @@ describe 'Dropdown author', :js do
expect(page).to have_css(js_dropdown_author, visible: false) expect(page).to have_css(js_dropdown_author, visible: false)
end end
it 'should show loading indicator when opened' do it 'shows loading indicator when opened' do
slow_requests do slow_requests do
filtered_search.set('author:') filtered_search.set('author:')
...@@ -58,13 +58,13 @@ describe 'Dropdown author', :js do ...@@ -58,13 +58,13 @@ describe 'Dropdown author', :js do
end end
end end
it 'should hide loading indicator when loaded' do it 'hides loading indicator when loaded' do
send_keys_to_filtered_search('author:') send_keys_to_filtered_search('author:')
expect(page).not_to have_css('#js-dropdown-author .filter-dropdown-loading') expect(page).not_to have_css('#js-dropdown-author .filter-dropdown-loading')
end end
it 'should load all the authors when opened' do it 'loads all the authors when opened' do
send_keys_to_filtered_search('author:') send_keys_to_filtered_search('author:')
expect(dropdown_author_size).to eq(4) expect(dropdown_author_size).to eq(4)
......
...@@ -69,7 +69,7 @@ describe 'Dropdown emoji', :js do ...@@ -69,7 +69,7 @@ describe 'Dropdown emoji', :js do
expect(page).to have_css(js_dropdown_emoji, visible: false) expect(page).to have_css(js_dropdown_emoji, visible: false)
end end
it 'should show loading indicator when opened' do it 'shows loading indicator when opened' do
slow_requests do slow_requests do
filtered_search.set('my-reaction:') filtered_search.set('my-reaction:')
...@@ -77,13 +77,13 @@ describe 'Dropdown emoji', :js do ...@@ -77,13 +77,13 @@ describe 'Dropdown emoji', :js do
end end
end end
it 'should hide loading indicator when loaded' do it 'hides loading indicator when loaded' do
send_keys_to_filtered_search('my-reaction:') send_keys_to_filtered_search('my-reaction:')
expect(page).not_to have_css('#js-dropdown-my-reaction .filter-dropdown-loading') expect(page).not_to have_css('#js-dropdown-my-reaction .filter-dropdown-loading')
end end
it 'should load all the emojis when opened' do it 'loads all the emojis when opened' do
send_keys_to_filtered_search('my-reaction:') send_keys_to_filtered_search('my-reaction:')
expect(dropdown_emoji_size).to eq(4) expect(dropdown_emoji_size).to eq(4)
......
...@@ -49,7 +49,7 @@ describe 'Dropdown milestone', :js do ...@@ -49,7 +49,7 @@ describe 'Dropdown milestone', :js do
expect(page).to have_css(js_dropdown_milestone, visible: false) expect(page).to have_css(js_dropdown_milestone, visible: false)
end end
it 'should show loading indicator when opened' do it 'shows loading indicator when opened' do
slow_requests do slow_requests do
filtered_search.set('milestone:') filtered_search.set('milestone:')
...@@ -57,13 +57,13 @@ describe 'Dropdown milestone', :js do ...@@ -57,13 +57,13 @@ describe 'Dropdown milestone', :js do
end end
end end
it 'should hide loading indicator when loaded' do it 'hides loading indicator when loaded' do
filtered_search.set('milestone:') filtered_search.set('milestone:')
expect(find(js_dropdown_milestone)).not_to have_css('.filter-dropdown-loading') expect(find(js_dropdown_milestone)).not_to have_css('.filter-dropdown-loading')
end end
it 'should load all the milestones when opened' do it 'loads all the milestones when opened' do
filtered_search.set('milestone:') filtered_search.set('milestone:')
expect(filter_dropdown).to have_selector('.filter-dropdown .filter-dropdown-item', count: 6) expect(filter_dropdown).to have_selector('.filter-dropdown .filter-dropdown-item', count: 6)
......
...@@ -45,7 +45,7 @@ describe 'New/edit issue', :js do ...@@ -45,7 +45,7 @@ describe 'New/edit issue', :js do
wait_for_requests wait_for_requests
end end
it 'should display selected users even if they are not part of the original API call' do it 'displays selected users even if they are not part of the original API call' do
find('.dropdown-input-field').native.send_keys user2.name find('.dropdown-input-field').native.send_keys user2.name
page.within '.dropdown-menu-user' do page.within '.dropdown-menu-user' do
......
...@@ -26,7 +26,7 @@ describe 'Issue Detail', :js do ...@@ -26,7 +26,7 @@ describe 'Issue Detail', :js do
wait_for_requests wait_for_requests
end end
it 'should encode the description to prevent xss issues' do it 'encodes the description to prevent xss issues' do
page.within('.issuable-details .detail-page-description') do page.within('.issuable-details .detail-page-description') do
expect(page).to have_selector('img', count: 1) expect(page).to have_selector('img', count: 1)
expect(find('img')['onerror']).to be_nil expect(find('img')['onerror']).to be_nil
......
...@@ -145,7 +145,7 @@ describe 'Labels Hierarchy', :js, :nested_groups do ...@@ -145,7 +145,7 @@ describe 'Labels Hierarchy', :js, :nested_groups do
visit new_project_issue_path(project_1) visit new_project_issue_path(project_1)
end end
it 'should be able to assign ancestor group labels' do it 'is able to assign ancestor group labels' do
fill_in 'issue_title', with: 'new created issue' fill_in 'issue_title', with: 'new created issue'
fill_in 'issue_description', with: 'new issue description' fill_in 'issue_description', with: 'new issue description'
......
...@@ -76,7 +76,7 @@ describe 'create a merge request, allowing commits from members who can merge to ...@@ -76,7 +76,7 @@ describe 'create a merge request, allowing commits from members who can merge to
sign_in(member) sign_in(member)
end end
it 'it hides the option from members' do it 'hides the option from members' do
visit edit_project_merge_request_path(target_project, merge_request) visit edit_project_merge_request_path(target_project, merge_request)
expect(page).not_to have_content('Allows commits from members who can merge to the target branch') expect(page).not_to have_content('Allows commits from members who can merge to the target branch')
......
...@@ -302,7 +302,7 @@ describe 'Merge request > User sees merge widget', :js do ...@@ -302,7 +302,7 @@ describe 'Merge request > User sees merge widget', :js do
visit project_merge_request_path(project_only_mwps, merge_request_in_only_mwps_project) visit project_merge_request_path(project_only_mwps, merge_request_in_only_mwps_project)
end end
it 'should be allowed to merge' do it 'is allowed to merge' do
# Wait for the `ci_status` and `merge_check` requests # Wait for the `ci_status` and `merge_check` requests
wait_for_requests wait_for_requests
......
...@@ -230,7 +230,7 @@ describe 'Merge request > User sees versions', :js do ...@@ -230,7 +230,7 @@ describe 'Merge request > User sees versions', :js do
wait_for_requests wait_for_requests
end end
it 'should only show diffs from the commit' do it 'only shows diffs from the commit' do
diff_commit_ids = find_all('.diff-file [data-commit-id]').map {|diff| diff['data-commit-id']} diff_commit_ids = find_all('.diff-file [data-commit-id]').map {|diff| diff['data-commit-id']}
expect(diff_commit_ids).not_to be_empty expect(diff_commit_ids).not_to be_empty
......
...@@ -572,7 +572,7 @@ describe 'File blob', :js do ...@@ -572,7 +572,7 @@ describe 'File blob', :js do
visit_blob('files/ruby/test.rb', ref: 'feature') visit_blob('files/ruby/test.rb', ref: 'feature')
end end
it 'should show the realtime pipeline status' do it 'shows the realtime pipeline status' do
page.within('.commit-actions') do page.within('.commit-actions') do
expect(page).to have_css('.ci-status-icon') expect(page).to have_css('.ci-status-icon')
expect(page).to have_css('.ci-status-icon-running') expect(page).to have_css('.ci-status-icon-running')
......
...@@ -80,7 +80,7 @@ describe 'Clusters Applications', :js do ...@@ -80,7 +80,7 @@ describe 'Clusters Applications', :js do
context 'on an abac cluster' do context 'on an abac cluster' do
let(:cluster) { create(:cluster, :provided_by_gcp, :rbac_disabled, projects: [project]) } let(:cluster) { create(:cluster, :provided_by_gcp, :rbac_disabled, projects: [project]) }
it 'should show info block and not be installable' do it 'shows info block and not be installable' do
page.within('.js-cluster-application-row-knative') do page.within('.js-cluster-application-row-knative') do
expect(page).to have_css('.rbac-notice') expect(page).to have_css('.rbac-notice')
expect(page.find(:css, '.js-cluster-application-install-button')['disabled']).to eq('true') expect(page.find(:css, '.js-cluster-application-install-button')['disabled']).to eq('true')
...@@ -91,7 +91,7 @@ describe 'Clusters Applications', :js do ...@@ -91,7 +91,7 @@ describe 'Clusters Applications', :js do
context 'on an rbac cluster' do context 'on an rbac cluster' do
let(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) } let(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) }
it 'should not show callout block and be installable' do it 'does not show callout block and be installable' do
page.within('.js-cluster-application-row-knative') do page.within('.js-cluster-application-row-knative') do
expect(page).not_to have_css('.rbac-notice') expect(page).not_to have_css('.rbac-notice')
expect(page).to have_css('.js-cluster-application-install-button:not([disabled])') expect(page).to have_css('.js-cluster-application-install-button:not([disabled])')
......
...@@ -43,7 +43,7 @@ describe 'Mini Pipeline Graph in Commit View', :js do ...@@ -43,7 +43,7 @@ describe 'Mini Pipeline Graph in Commit View', :js do
visit project_commit_path(project, project.commit.id) visit project_commit_path(project, project.commit.id)
end end
it 'should not display a mini pipeline graph' do it 'does not display a mini pipeline graph' do
expect(page).not_to have_selector('.mr-widget-pipeline-graph') expect(page).not_to have_selector('.mr-widget-pipeline-graph')
end end
end end
......
...@@ -159,7 +159,7 @@ describe 'Environment' do ...@@ -159,7 +159,7 @@ describe 'Environment' do
context 'for project maintainer' do context 'for project maintainer' do
let(:role) { :maintainer } let(:role) { :maintainer }
it 'it shows the terminal button' do it 'shows the terminal button' do
expect(page).to have_terminal_button expect(page).to have_terminal_button
end end
......
...@@ -30,7 +30,7 @@ describe 'Environments page', :js do ...@@ -30,7 +30,7 @@ describe 'Environments page', :js do
end end
describe 'in available tab page' do describe 'in available tab page' do
it 'should show one environment' do it 'shows one environment' do
visit_environments(project, scope: 'available') visit_environments(project, scope: 'available')
expect(page).to have_css('.environments-container') expect(page).to have_css('.environments-container')
...@@ -44,7 +44,7 @@ describe 'Environments page', :js do ...@@ -44,7 +44,7 @@ describe 'Environments page', :js do
create_list(:environment, 4, project: project, state: :available) create_list(:environment, 4, project: project, state: :available)
end end
it 'should render second page of pipelines' do it 'renders second page of pipelines' do
visit_environments(project, scope: 'available') visit_environments(project, scope: 'available')
find('.js-next-button').click find('.js-next-button').click
...@@ -56,7 +56,7 @@ describe 'Environments page', :js do ...@@ -56,7 +56,7 @@ describe 'Environments page', :js do
end end
describe 'in stopped tab page' do describe 'in stopped tab page' do
it 'should show no environments' do it 'shows no environments' do
visit_environments(project, scope: 'stopped') visit_environments(project, scope: 'stopped')
expect(page).to have_css('.environments-container') expect(page).to have_css('.environments-container')
...@@ -72,7 +72,7 @@ describe 'Environments page', :js do ...@@ -72,7 +72,7 @@ describe 'Environments page', :js do
allow_any_instance_of(Kubeclient::Client).to receive(:proxy_url).and_raise(Kubeclient::HttpError.new(401, 'Unauthorized', nil)) allow_any_instance_of(Kubeclient::Client).to receive(:proxy_url).and_raise(Kubeclient::HttpError.new(401, 'Unauthorized', nil))
end end
it 'should show one environment without error' do it 'shows one environment without error' do
visit_environments(project, scope: 'available') visit_environments(project, scope: 'available')
expect(page).to have_css('.environments-container') expect(page).to have_css('.environments-container')
...@@ -87,7 +87,7 @@ describe 'Environments page', :js do ...@@ -87,7 +87,7 @@ describe 'Environments page', :js do
end end
describe 'in available tab page' do describe 'in available tab page' do
it 'should show no environments' do it 'shows no environments' do
visit_environments(project, scope: 'available') visit_environments(project, scope: 'available')
expect(page).to have_css('.environments-container') expect(page).to have_css('.environments-container')
...@@ -96,7 +96,7 @@ describe 'Environments page', :js do ...@@ -96,7 +96,7 @@ describe 'Environments page', :js do
end end
describe 'in stopped tab page' do describe 'in stopped tab page' do
it 'should show one environment' do it 'shows one environment' do
visit_environments(project, scope: 'stopped') visit_environments(project, scope: 'stopped')
expect(page).to have_css('.environments-container') expect(page).to have_css('.environments-container')
......
...@@ -159,7 +159,7 @@ describe 'Project > Members > Invite group', :js do ...@@ -159,7 +159,7 @@ describe 'Project > Members > Invite group', :js do
open_select2 '#link_group_id' open_select2 '#link_group_id'
end end
it 'should infinitely scroll' do it 'infinitely scrolls' do
expect(find('.select2-drop .select2-results')).to have_selector('.select2-result', count: 1) expect(find('.select2-drop .select2-results')).to have_selector('.select2-result', count: 1)
scroll_select2_to_bottom('.select2-drop .select2-results:visible') scroll_select2_to_bottom('.select2-drop .select2-results:visible')
......
...@@ -93,14 +93,14 @@ describe 'Pipeline Schedules', :js do ...@@ -93,14 +93,14 @@ describe 'Pipeline Schedules', :js do
expect(page).to have_button('UTC') expect(page).to have_button('UTC')
end end
it 'it creates a new scheduled pipeline' do it 'creates a new scheduled pipeline' do
fill_in_schedule_form fill_in_schedule_form
save_pipeline_schedule save_pipeline_schedule
expect(page).to have_content('my fancy description') expect(page).to have_content('my fancy description')
end end
it 'it prevents an invalid form from being submitted' do it 'prevents an invalid form from being submitted' do
save_pipeline_schedule save_pipeline_schedule
expect(page).to have_content('This field is required') expect(page).to have_content('This field is required')
...@@ -112,7 +112,7 @@ describe 'Pipeline Schedules', :js do ...@@ -112,7 +112,7 @@ describe 'Pipeline Schedules', :js do
edit_pipeline_schedule edit_pipeline_schedule
end end
it 'it displays existing properties' do it 'displays existing properties' do
description = find_field('schedule_description').value description = find_field('schedule_description').value
expect(description).to eq('pipeline schedule') expect(description).to eq('pipeline schedule')
expect(page).to have_button('master') expect(page).to have_button('master')
......
...@@ -154,7 +154,7 @@ describe 'Pipeline', :js do ...@@ -154,7 +154,7 @@ describe 'Pipeline', :js do
end end
end end
it 'should be possible to retry the success job' do it 'is possible to retry the success job' do
find('#ci-badge-build .ci-action-icon-container').click find('#ci-badge-build .ci-action-icon-container').click
expect(page).not_to have_content('Retry job') expect(page).not_to have_content('Retry job')
...@@ -194,13 +194,13 @@ describe 'Pipeline', :js do ...@@ -194,13 +194,13 @@ describe 'Pipeline', :js do
end end
end end
it 'should be possible to retry the failed build' do it 'is possible to retry the failed build' do
find('#ci-badge-test .ci-action-icon-container').click find('#ci-badge-test .ci-action-icon-container').click
expect(page).not_to have_content('Retry job') expect(page).not_to have_content('Retry job')
end end
it 'should include the failure reason' do it 'includes the failure reason' do
page.within('#ci-badge-test') do page.within('#ci-badge-test') do
build_link = page.find('.js-pipeline-graph-job-link') build_link = page.find('.js-pipeline-graph-job-link')
expect(build_link['data-original-title']).to eq('test - failed - (unknown failure)') expect(build_link['data-original-title']).to eq('test - failed - (unknown failure)')
...@@ -220,7 +220,7 @@ describe 'Pipeline', :js do ...@@ -220,7 +220,7 @@ describe 'Pipeline', :js do
end end
end end
it 'should be possible to play the manual job' do it 'is possible to play the manual job' do
find('#ci-badge-manual-build .ci-action-icon-container').click find('#ci-badge-manual-build .ci-action-icon-container').click
expect(page).not_to have_content('Play job') expect(page).not_to have_content('Play job')
...@@ -454,7 +454,7 @@ describe 'Pipeline', :js do ...@@ -454,7 +454,7 @@ describe 'Pipeline', :js do
expect(page).to have_content('Cancel running') expect(page).to have_content('Cancel running')
end end
it 'should not link to job' do it 'does not link to job' do
expect(page).not_to have_selector('.js-pipeline-graph-job-link') expect(page).not_to have_selector('.js-pipeline-graph-job-link')
end end
end end
......
...@@ -542,19 +542,19 @@ describe 'Pipelines', :js do ...@@ -542,19 +542,19 @@ describe 'Pipelines', :js do
visit_project_pipelines visit_project_pipelines
end end
it 'should render a mini pipeline graph' do it 'renders a mini pipeline graph' do
expect(page).to have_selector('.js-mini-pipeline-graph') expect(page).to have_selector('.js-mini-pipeline-graph')
expect(page).to have_selector('.js-builds-dropdown-button') expect(page).to have_selector('.js-builds-dropdown-button')
end end
context 'when clicking a stage badge' do context 'when clicking a stage badge' do
it 'should open a dropdown' do it 'opens a dropdown' do
find('.js-builds-dropdown-button').click find('.js-builds-dropdown-button').click
expect(page).to have_link build.name expect(page).to have_link build.name
end end
it 'should be possible to cancel pending build' do it 'is possible to cancel pending build' do
find('.js-builds-dropdown-button').click find('.js-builds-dropdown-button').click
find('.js-ci-action').click find('.js-ci-action').click
wait_for_requests wait_for_requests
...@@ -570,7 +570,7 @@ describe 'Pipelines', :js do ...@@ -570,7 +570,7 @@ describe 'Pipelines', :js do
name: 'build') name: 'build')
end end
it 'should display the failure reason' do it 'displays the failure reason' do
find('.js-builds-dropdown-button').click find('.js-builds-dropdown-button').click
within('.js-builds-dropdown-list') do within('.js-builds-dropdown-list') do
...@@ -587,21 +587,21 @@ describe 'Pipelines', :js do ...@@ -587,21 +587,21 @@ describe 'Pipelines', :js do
create(:ci_empty_pipeline, project: project) create(:ci_empty_pipeline, project: project)
end end
it 'should render pagination' do it 'renders pagination' do
visit project_pipelines_path(project) visit project_pipelines_path(project)
wait_for_requests wait_for_requests
expect(page).to have_selector('.gl-pagination') expect(page).to have_selector('.gl-pagination')
end end
it 'should render second page of pipelines' do it 'renders second page of pipelines' do
visit project_pipelines_path(project, page: '2') visit project_pipelines_path(project, page: '2')
wait_for_requests wait_for_requests
expect(page).to have_selector('.gl-pagination .page', count: 2) expect(page).to have_selector('.gl-pagination .page', count: 2)
end end
it 'should show updated content' do it 'shows updated content' do
visit project_pipelines_path(project) visit project_pipelines_path(project)
wait_for_requests wait_for_requests
page.find('.js-next-button .page-link').click page.find('.js-next-button .page-link').click
......
...@@ -23,14 +23,14 @@ describe 'Projects > Snippets > User comments on a snippet', :js do ...@@ -23,14 +23,14 @@ describe 'Projects > Snippets > User comments on a snippet', :js do
expect(page).to have_content('Good snippet!') expect(page).to have_content('Good snippet!')
end end
it 'should have autocomplete' do it 'has autocomplete' do
find('#note_note').native.send_keys('') find('#note_note').native.send_keys('')
fill_in 'note[note]', with: '@' fill_in 'note[note]', with: '@'
expect(page).to have_selector('.atwho-view') expect(page).to have_selector('.atwho-view')
end end
it 'should have zen mode' do it 'has zen mode' do
find('.js-zen-enter').click find('.js-zen-enter').click
expect(page).to have_selector('.fullscreen') expect(page).to have_selector('.fullscreen')
end end
......
...@@ -3,13 +3,13 @@ require 'spec_helper' ...@@ -3,13 +3,13 @@ require 'spec_helper'
describe 'RavenJS' do describe 'RavenJS' do
let(:raven_path) { '/raven.chunk.js' } let(:raven_path) { '/raven.chunk.js' }
it 'should not load raven if sentry is disabled' do it 'does not load raven if sentry is disabled' do
visit new_user_session_path visit new_user_session_path
expect(has_requested_raven).to eq(false) expect(has_requested_raven).to eq(false)
end end
it 'should load raven if sentry is enabled' do it 'loads raven if sentry is enabled' do
stub_application_setting(clientside_sentry_dsn: 'https://key@domain.com/id', clientside_sentry_enabled: true) stub_application_setting(clientside_sentry_dsn: 'https://key@domain.com/id', clientside_sentry_enabled: true)
visit new_user_session_path visit new_user_session_path
......
...@@ -83,7 +83,7 @@ describe 'Comments on personal snippets', :js do ...@@ -83,7 +83,7 @@ describe 'Comments on personal snippets', :js do
expect(find('div#notes')).to have_content('This is awesome!') expect(find('div#notes')).to have_content('This is awesome!')
end end
it 'should not have autocomplete' do it 'does not have autocomplete' do
wait_for_requests wait_for_requests
find('#note_note').native.send_keys('') find('#note_note').native.send_keys('')
......
...@@ -93,7 +93,7 @@ describe 'Overview tab on a user profile', :js do ...@@ -93,7 +93,7 @@ describe 'Overview tab on a user profile', :js do
describe 'user has no personal projects' do describe 'user has no personal projects' do
include_context 'visit overview tab' include_context 'visit overview tab'
it 'it shows an empty project list with an info message' do it 'shows an empty project list with an info message' do
page.within('.projects-block') do page.within('.projects-block') do
expect(page).to have_selector('.loading', visible: false) expect(page).to have_selector('.loading', visible: false)
expect(page).to have_content('You haven\'t created any personal projects.') expect(page).to have_content('You haven\'t created any personal projects.')
...@@ -113,7 +113,7 @@ describe 'Overview tab on a user profile', :js do ...@@ -113,7 +113,7 @@ describe 'Overview tab on a user profile', :js do
include_context 'visit overview tab' include_context 'visit overview tab'
it 'it shows one entry in the list of projects' do it 'shows one entry in the list of projects' do
page.within('.projects-block') do page.within('.projects-block') do
expect(page).to have_selector('.project-row', count: 1) expect(page).to have_selector('.project-row', count: 1)
end end
...@@ -139,7 +139,7 @@ describe 'Overview tab on a user profile', :js do ...@@ -139,7 +139,7 @@ describe 'Overview tab on a user profile', :js do
include_context 'visit overview tab' include_context 'visit overview tab'
it 'it shows max. ten entries in the list of projects' do it 'shows max. ten entries in the list of projects' do
page.within('.projects-block') do page.within('.projects-block') do
expect(page).to have_selector('.project-row', count: 10) expect(page).to have_selector('.project-row', count: 10)
end end
......
...@@ -9,7 +9,7 @@ describe MilestonesFinder do ...@@ -9,7 +9,7 @@ describe MilestonesFinder do
let!(:milestone_3) { create(:milestone, project: project_1, state: 'active', due_date: Date.tomorrow) } let!(:milestone_3) { create(:milestone, project: project_1, state: 'active', due_date: Date.tomorrow) }
let!(:milestone_4) { create(:milestone, project: project_2, state: 'active') } let!(:milestone_4) { create(:milestone, project: project_2, state: 'active') }
it 'it returns milestones for projects' do it 'returns milestones for projects' do
result = described_class.new(project_ids: [project_1.id, project_2.id], state: 'all').execute result = described_class.new(project_ids: [project_1.id, project_2.id], state: 'all').execute
expect(result).to contain_exactly(milestone_3, milestone_4) expect(result).to contain_exactly(milestone_3, milestone_4)
......
...@@ -59,19 +59,19 @@ describe IconsHelper do ...@@ -59,19 +59,19 @@ describe IconsHelper do
describe 'non existing icon' do describe 'non existing icon' do
non_existing = 'non_existing_icon_sprite' non_existing = 'non_existing_icon_sprite'
it 'should raise in development mode' do it 'raises in development mode' do
allow(Rails.env).to receive(:development?).and_return(true) allow(Rails.env).to receive(:development?).and_return(true)
expect { sprite_icon(non_existing) }.to raise_error(ArgumentError, /is not a known icon/) expect { sprite_icon(non_existing) }.to raise_error(ArgumentError, /is not a known icon/)
end end
it 'should raise in test mode' do it 'raises in test mode' do
allow(Rails.env).to receive(:test?).and_return(true) allow(Rails.env).to receive(:test?).and_return(true)
expect { sprite_icon(non_existing) }.to raise_error(ArgumentError, /is not a known icon/) expect { sprite_icon(non_existing) }.to raise_error(ArgumentError, /is not a known icon/)
end end
it 'should not raise in production mode' do it 'does not raise in production mode' do
allow(Rails.env).to receive(:test?).and_return(false) allow(Rails.env).to receive(:test?).and_return(false)
allow(Rails.env).to receive(:development?).and_return(false) allow(Rails.env).to receive(:development?).and_return(false)
......
...@@ -12,7 +12,7 @@ describe SearchHelper do ...@@ -12,7 +12,7 @@ describe SearchHelper do
allow(self).to receive(:current_user).and_return(nil) allow(self).to receive(:current_user).and_return(nil)
end end
it "it returns nil" do it "returns nil" do
expect(search_autocomplete_opts("q")).to be_nil expect(search_autocomplete_opts("q")).to be_nil
end end
end end
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe VersionCheckHelper do describe VersionCheckHelper do
describe '#version_status_badge' do describe '#version_status_badge' do
it 'should return nil if not dev environment and not enabled' do it 'returns nil if not dev environment and not enabled' do
allow(Rails.env).to receive(:production?) { false } allow(Rails.env).to receive(:production?) { false }
allow(Gitlab::CurrentSettings.current_application_settings).to receive(:version_check_enabled) { false } allow(Gitlab::CurrentSettings.current_application_settings).to receive(:version_check_enabled) { false }
...@@ -16,16 +16,16 @@ describe VersionCheckHelper do ...@@ -16,16 +16,16 @@ describe VersionCheckHelper do
allow(VersionCheck).to receive(:url) { 'https://version.host.com/check.svg?gitlab_info=xxx' } allow(VersionCheck).to receive(:url) { 'https://version.host.com/check.svg?gitlab_info=xxx' }
end end
it 'should return an image tag' do it 'returns an image tag' do
expect(helper.version_status_badge).to start_with('<img') expect(helper.version_status_badge).to start_with('<img')
end end
it 'should have a js prefixed css class' do it 'has a js prefixed css class' do
expect(helper.version_status_badge) expect(helper.version_status_badge)
.to match(/class="js-version-status-badge lazy"/) .to match(/class="js-version-status-badge lazy"/)
end end
it 'should have a VersionCheck url as the src' do it 'has a VersionCheck url as the src' do
expect(helper.version_status_badge) expect(helper.version_status_badge)
.to include(%{src="https://version.host.com/check.svg?gitlab_info=xxx"}) .to include(%{src="https://version.host.com/check.svg?gitlab_info=xxx"})
end end
......
...@@ -21,7 +21,7 @@ describe API::Helpers::CustomValidators do ...@@ -21,7 +21,7 @@ describe API::Helpers::CustomValidators do
end end
context 'invalid parameters' do context 'invalid parameters' do
it 'should raise a validation error' do it 'raises a validation error' do
expect_validation_error({ 'test' => 'some_value' }) expect_validation_error({ 'test' => 'some_value' })
end end
end end
...@@ -44,7 +44,7 @@ describe API::Helpers::CustomValidators do ...@@ -44,7 +44,7 @@ describe API::Helpers::CustomValidators do
end end
context 'invalid parameters' do context 'invalid parameters' do
it 'should raise a validation error' do it 'raises a validation error' do
expect_validation_error({ 'test' => 'some_other_string' }) expect_validation_error({ 'test' => 'some_other_string' })
end end
end end
...@@ -67,7 +67,7 @@ describe API::Helpers::CustomValidators do ...@@ -67,7 +67,7 @@ describe API::Helpers::CustomValidators do
end end
context 'invalid parameters' do context 'invalid parameters' do
it 'should raise a validation error' do it 'raises a validation error' do
expect_validation_error({ 'test' => 'some_other_string' }) expect_validation_error({ 'test' => 'some_other_string' })
end end
end end
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe Banzai::Filter::PlantumlFilter do describe Banzai::Filter::PlantumlFilter do
include FilterSpecHelper include FilterSpecHelper
it 'should replace plantuml pre tag with img tag' do it 'replaces plantuml pre tag with img tag' do
stub_application_setting(plantuml_enabled: true, plantuml_url: "http://localhost:8080") stub_application_setting(plantuml_enabled: true, plantuml_url: "http://localhost:8080")
input = '<pre><code lang="plantuml">Bob -> Sara : Hello</code></pre>' input = '<pre><code lang="plantuml">Bob -> Sara : Hello</code></pre>'
output = '<div class="imageblock"><div class="content"><img class="plantuml" src="http://localhost:8080/png/U9npoazIqBLJ24uiIbImKl18pSd91m0rkGMq"></div></div>' output = '<div class="imageblock"><div class="content"><img class="plantuml" src="http://localhost:8080/png/U9npoazIqBLJ24uiIbImKl18pSd91m0rkGMq"></div></div>'
...@@ -12,7 +12,7 @@ describe Banzai::Filter::PlantumlFilter do ...@@ -12,7 +12,7 @@ describe Banzai::Filter::PlantumlFilter do
expect(doc.to_s).to eq output expect(doc.to_s).to eq output
end end
it 'should not replace plantuml pre tag with img tag if disabled' do it 'does not replace plantuml pre tag with img tag if disabled' do
stub_application_setting(plantuml_enabled: false) stub_application_setting(plantuml_enabled: false)
input = '<pre><code lang="plantuml">Bob -> Sara : Hello</code></pre>' input = '<pre><code lang="plantuml">Bob -> Sara : Hello</code></pre>'
output = '<pre><code lang="plantuml">Bob -&gt; Sara : Hello</code></pre>' output = '<pre><code lang="plantuml">Bob -&gt; Sara : Hello</code></pre>'
...@@ -21,7 +21,7 @@ describe Banzai::Filter::PlantumlFilter do ...@@ -21,7 +21,7 @@ describe Banzai::Filter::PlantumlFilter do
expect(doc.to_s).to eq output expect(doc.to_s).to eq output
end end
it 'should not replace plantuml pre tag with img tag if url is invalid' do it 'does not replace plantuml pre tag with img tag if url is invalid' do
stub_application_setting(plantuml_enabled: true, plantuml_url: "invalid") stub_application_setting(plantuml_enabled: true, plantuml_url: "invalid")
input = '<pre><code lang="plantuml">Bob -> Sara : Hello</code></pre>' input = '<pre><code lang="plantuml">Bob -> Sara : Hello</code></pre>'
output = '<div class="listingblock"><div class="content"><pre class="plantuml plantuml-error"> PlantUML Error: cannot connect to PlantUML server at "invalid"</pre></div></div>' output = '<div class="listingblock"><div class="content"><pre class="plantuml plantuml-error"> PlantUML Error: cannot connect to PlantUML server at "invalid"</pre></div></div>'
......
...@@ -5,7 +5,7 @@ describe Forever do ...@@ -5,7 +5,7 @@ describe Forever do
subject { described_class.date } subject { described_class.date }
context 'when using PostgreSQL' do context 'when using PostgreSQL' do
it 'should return Postgresql future date' do it 'returns Postgresql future date' do
allow(Gitlab::Database).to receive(:postgresql?).and_return(true) allow(Gitlab::Database).to receive(:postgresql?).and_return(true)
expect(subject).to eq(described_class::POSTGRESQL_DATE) expect(subject).to eq(described_class::POSTGRESQL_DATE)
...@@ -13,7 +13,7 @@ describe Forever do ...@@ -13,7 +13,7 @@ describe Forever do
end end
context 'when using MySQL' do context 'when using MySQL' do
it 'should return MySQL future date' do it 'returns MySQL future date' do
allow(Gitlab::Database).to receive(:postgresql?).and_return(false) allow(Gitlab::Database).to receive(:postgresql?).and_return(false)
expect(subject).to eq(described_class::MYSQL_DATE) expect(subject).to eq(described_class::MYSQL_DATE)
......
...@@ -19,7 +19,7 @@ describe Gitlab::BackgroundMigration::PopulateClusterKubernetesNamespaceTable, : ...@@ -19,7 +19,7 @@ describe Gitlab::BackgroundMigration::PopulateClusterKubernetesNamespaceTable, :
end end
shared_examples 'consistent kubernetes namespace attributes' do shared_examples 'consistent kubernetes namespace attributes' do
it 'should populate namespace and service account information' do it 'populates namespace and service account information' do
migration.perform migration.perform
clusters_with_namespace.each do |cluster| clusters_with_namespace.each do |cluster|
...@@ -41,7 +41,7 @@ describe Gitlab::BackgroundMigration::PopulateClusterKubernetesNamespaceTable, : ...@@ -41,7 +41,7 @@ describe Gitlab::BackgroundMigration::PopulateClusterKubernetesNamespaceTable, :
context 'when no Clusters::Project has a Clusters::KubernetesNamespace' do context 'when no Clusters::Project has a Clusters::KubernetesNamespace' do
let(:cluster_projects) { cluster_projects_table.all } let(:cluster_projects) { cluster_projects_table.all }
it 'should create a Clusters::KubernetesNamespace per Clusters::Project' do it 'creates a Clusters::KubernetesNamespace per Clusters::Project' do
expect do expect do
migration.perform migration.perform
end.to change(Clusters::KubernetesNamespace, :count).by(cluster_projects_table.count) end.to change(Clusters::KubernetesNamespace, :count).by(cluster_projects_table.count)
...@@ -57,7 +57,7 @@ describe Gitlab::BackgroundMigration::PopulateClusterKubernetesNamespaceTable, : ...@@ -57,7 +57,7 @@ describe Gitlab::BackgroundMigration::PopulateClusterKubernetesNamespaceTable, :
create_kubernetes_namespace(clusters_table.all) create_kubernetes_namespace(clusters_table.all)
end end
it 'should not create any Clusters::KubernetesNamespace' do it 'does not create any Clusters::KubernetesNamespace' do
expect do expect do
migration.perform migration.perform
end.not_to change(Clusters::KubernetesNamespace, :count) end.not_to change(Clusters::KubernetesNamespace, :count)
...@@ -78,7 +78,7 @@ describe Gitlab::BackgroundMigration::PopulateClusterKubernetesNamespaceTable, : ...@@ -78,7 +78,7 @@ describe Gitlab::BackgroundMigration::PopulateClusterKubernetesNamespaceTable, :
end.to change(Clusters::KubernetesNamespace, :count).by(with_no_kubernetes_namespace.count) end.to change(Clusters::KubernetesNamespace, :count).by(with_no_kubernetes_namespace.count)
end end
it 'should not modify clusters with Clusters::KubernetesNamespace' do it 'does not modify clusters with Clusters::KubernetesNamespace' do
migration.perform migration.perform
with_kubernetes_namespace.each do |cluster| with_kubernetes_namespace.each do |cluster|
......
...@@ -41,7 +41,7 @@ describe Gitlab::BackgroundMigration::PopulateForkNetworksRange, :migration, sch ...@@ -41,7 +41,7 @@ describe Gitlab::BackgroundMigration::PopulateForkNetworksRange, :migration, sch
migration.perform(1, 3) migration.perform(1, 3)
end end
it 'it creates the fork network' do it 'creates the fork network' do
expect(fork_network1).not_to be_nil expect(fork_network1).not_to be_nil
expect(fork_network2).not_to be_nil expect(fork_network2).not_to be_nil
end end
......
...@@ -26,7 +26,7 @@ describe Gitlab::Ci::Config::External::File::Base do ...@@ -26,7 +26,7 @@ describe Gitlab::Ci::Config::External::File::Base do
context 'when a location is present' do context 'when a location is present' do
let(:location) { 'some-location' } let(:location) { 'some-location' }
it 'should return true' do it 'returns true' do
expect(subject).to be_matching expect(subject).to be_matching
end end
end end
...@@ -34,7 +34,7 @@ describe Gitlab::Ci::Config::External::File::Base do ...@@ -34,7 +34,7 @@ describe Gitlab::Ci::Config::External::File::Base do
context 'with a location is missing' do context 'with a location is missing' do
let(:location) { nil } let(:location) { nil }
it 'should return false' do it 'returns false' do
expect(subject).not_to be_matching expect(subject).not_to be_matching
end end
end end
......
...@@ -15,7 +15,7 @@ describe Gitlab::Ci::Config::External::File::Local do ...@@ -15,7 +15,7 @@ describe Gitlab::Ci::Config::External::File::Local do
context 'when a local is specified' do context 'when a local is specified' do
let(:params) { { local: 'file' } } let(:params) { { local: 'file' } }
it 'should return true' do it 'returns true' do
expect(local_file).to be_matching expect(local_file).to be_matching
end end
end end
...@@ -23,7 +23,7 @@ describe Gitlab::Ci::Config::External::File::Local do ...@@ -23,7 +23,7 @@ describe Gitlab::Ci::Config::External::File::Local do
context 'with a missing local' do context 'with a missing local' do
let(:params) { { local: nil } } let(:params) { { local: nil } }
it 'should return false' do it 'returns false' do
expect(local_file).not_to be_matching expect(local_file).not_to be_matching
end end
end end
...@@ -31,7 +31,7 @@ describe Gitlab::Ci::Config::External::File::Local do ...@@ -31,7 +31,7 @@ describe Gitlab::Ci::Config::External::File::Local do
context 'with a missing local key' do context 'with a missing local key' do
let(:params) { {} } let(:params) { {} }
it 'should return false' do it 'returns false' do
expect(local_file).not_to be_matching expect(local_file).not_to be_matching
end end
end end
...@@ -45,7 +45,7 @@ describe Gitlab::Ci::Config::External::File::Local do ...@@ -45,7 +45,7 @@ describe Gitlab::Ci::Config::External::File::Local do
allow_any_instance_of(described_class).to receive(:fetch_local_content).and_return("image: 'ruby2:2'") allow_any_instance_of(described_class).to receive(:fetch_local_content).and_return("image: 'ruby2:2'")
end end
it 'should return true' do it 'returns true' do
expect(local_file.valid?).to be_truthy expect(local_file.valid?).to be_truthy
end end
end end
...@@ -53,7 +53,7 @@ describe Gitlab::Ci::Config::External::File::Local do ...@@ -53,7 +53,7 @@ describe Gitlab::Ci::Config::External::File::Local do
context 'when is not a valid local path' do context 'when is not a valid local path' do
let(:location) { '/lib/gitlab/ci/templates/non-existent-file.yml' } let(:location) { '/lib/gitlab/ci/templates/non-existent-file.yml' }
it 'should return false' do it 'returns false' do
expect(local_file.valid?).to be_falsy expect(local_file.valid?).to be_falsy
end end
end end
...@@ -61,7 +61,7 @@ describe Gitlab::Ci::Config::External::File::Local do ...@@ -61,7 +61,7 @@ describe Gitlab::Ci::Config::External::File::Local do
context 'when is not a yaml file' do context 'when is not a yaml file' do
let(:location) { '/config/application.rb' } let(:location) { '/config/application.rb' }
it 'should return false' do it 'returns false' do
expect(local_file.valid?).to be_falsy expect(local_file.valid?).to be_falsy
end end
end end
...@@ -84,7 +84,7 @@ describe Gitlab::Ci::Config::External::File::Local do ...@@ -84,7 +84,7 @@ describe Gitlab::Ci::Config::External::File::Local do
allow_any_instance_of(described_class).to receive(:fetch_local_content).and_return(local_file_content) allow_any_instance_of(described_class).to receive(:fetch_local_content).and_return(local_file_content)
end end
it 'should return the content of the file' do it 'returns the content of the file' do
expect(local_file.content).to eq(local_file_content) expect(local_file.content).to eq(local_file_content)
end end
end end
...@@ -92,7 +92,7 @@ describe Gitlab::Ci::Config::External::File::Local do ...@@ -92,7 +92,7 @@ describe Gitlab::Ci::Config::External::File::Local do
context 'with an invalid file' do context 'with an invalid file' do
let(:location) { '/lib/gitlab/ci/templates/non-existent-file.yml' } let(:location) { '/lib/gitlab/ci/templates/non-existent-file.yml' }
it 'should be nil' do it 'is nil' do
expect(local_file.content).to be_nil expect(local_file.content).to be_nil
end end
end end
...@@ -101,7 +101,7 @@ describe Gitlab::Ci::Config::External::File::Local do ...@@ -101,7 +101,7 @@ describe Gitlab::Ci::Config::External::File::Local do
describe '#error_message' do describe '#error_message' do
let(:location) { '/lib/gitlab/ci/templates/non-existent-file.yml' } let(:location) { '/lib/gitlab/ci/templates/non-existent-file.yml' }
it 'should return an error message' do it 'returns an error message' do
expect(local_file.error_message).to eq("Local file `#{location}` does not exist!") expect(local_file.error_message).to eq("Local file `#{location}` does not exist!")
end end
end end
......
...@@ -19,7 +19,7 @@ describe Gitlab::Ci::Config::External::File::Project do ...@@ -19,7 +19,7 @@ describe Gitlab::Ci::Config::External::File::Project do
context 'when a file and project is specified' do context 'when a file and project is specified' do
let(:params) { { file: 'file.yml', project: 'project' } } let(:params) { { file: 'file.yml', project: 'project' } }
it 'should return true' do it 'returns true' do
expect(project_file).to be_matching expect(project_file).to be_matching
end end
end end
...@@ -27,7 +27,7 @@ describe Gitlab::Ci::Config::External::File::Project do ...@@ -27,7 +27,7 @@ describe Gitlab::Ci::Config::External::File::Project do
context 'with only file is specified' do context 'with only file is specified' do
let(:params) { { file: 'file.yml' } } let(:params) { { file: 'file.yml' } }
it 'should return false' do it 'returns false' do
expect(project_file).not_to be_matching expect(project_file).not_to be_matching
end end
end end
...@@ -35,7 +35,7 @@ describe Gitlab::Ci::Config::External::File::Project do ...@@ -35,7 +35,7 @@ describe Gitlab::Ci::Config::External::File::Project do
context 'with only project is specified' do context 'with only project is specified' do
let(:params) { { project: 'project' } } let(:params) { { project: 'project' } }
it 'should return false' do it 'returns false' do
expect(project_file).not_to be_matching expect(project_file).not_to be_matching
end end
end end
...@@ -43,7 +43,7 @@ describe Gitlab::Ci::Config::External::File::Project do ...@@ -43,7 +43,7 @@ describe Gitlab::Ci::Config::External::File::Project do
context 'with a missing local key' do context 'with a missing local key' do
let(:params) { {} } let(:params) { {} }
it 'should return false' do it 'returns false' do
expect(project_file).not_to be_matching expect(project_file).not_to be_matching
end end
end end
...@@ -61,14 +61,14 @@ describe Gitlab::Ci::Config::External::File::Project do ...@@ -61,14 +61,14 @@ describe Gitlab::Ci::Config::External::File::Project do
stub_project_blob(root_ref_sha, '/file.yml') { 'image: ruby:2.1' } stub_project_blob(root_ref_sha, '/file.yml') { 'image: ruby:2.1' }
end end
it 'should return true' do it 'returns true' do
expect(project_file).to be_valid expect(project_file).to be_valid
end end
context 'when user does not have permission to access file' do context 'when user does not have permission to access file' do
let(:context_user) { create(:user) } let(:context_user) { create(:user) }
it 'should return false' do it 'returns false' do
expect(project_file).not_to be_valid expect(project_file).not_to be_valid
expect(project_file.error_message).to include("Project `#{project.full_path}` not found or access denied!") expect(project_file.error_message).to include("Project `#{project.full_path}` not found or access denied!")
end end
...@@ -86,7 +86,7 @@ describe Gitlab::Ci::Config::External::File::Project do ...@@ -86,7 +86,7 @@ describe Gitlab::Ci::Config::External::File::Project do
stub_project_blob(ref_sha, '/file.yml') { 'image: ruby:2.1' } stub_project_blob(ref_sha, '/file.yml') { 'image: ruby:2.1' }
end end
it 'should return true' do it 'returns true' do
expect(project_file).to be_valid expect(project_file).to be_valid
end end
end end
...@@ -102,7 +102,7 @@ describe Gitlab::Ci::Config::External::File::Project do ...@@ -102,7 +102,7 @@ describe Gitlab::Ci::Config::External::File::Project do
stub_project_blob(root_ref_sha, '/file.yml') { '' } stub_project_blob(root_ref_sha, '/file.yml') { '' }
end end
it 'should return false' do it 'returns false' do
expect(project_file).not_to be_valid expect(project_file).not_to be_valid
expect(project_file.error_message).to include("Project `#{project.full_path}` file `/file.yml` is empty!") expect(project_file.error_message).to include("Project `#{project.full_path}` file `/file.yml` is empty!")
end end
...@@ -113,7 +113,7 @@ describe Gitlab::Ci::Config::External::File::Project do ...@@ -113,7 +113,7 @@ describe Gitlab::Ci::Config::External::File::Project do
{ project: project.full_path, ref: 'I-Do-Not-Exist', file: '/file.yml' } { project: project.full_path, ref: 'I-Do-Not-Exist', file: '/file.yml' }
end end
it 'should return false' do it 'returns false' do
expect(project_file).not_to be_valid expect(project_file).not_to be_valid
expect(project_file.error_message).to include("Project `#{project.full_path}` reference `I-Do-Not-Exist` does not exist!") expect(project_file.error_message).to include("Project `#{project.full_path}` reference `I-Do-Not-Exist` does not exist!")
end end
...@@ -124,7 +124,7 @@ describe Gitlab::Ci::Config::External::File::Project do ...@@ -124,7 +124,7 @@ describe Gitlab::Ci::Config::External::File::Project do
{ project: project.full_path, file: '/invalid-file.yml' } { project: project.full_path, file: '/invalid-file.yml' }
end end
it 'should return false' do it 'returns false' do
expect(project_file).not_to be_valid expect(project_file).not_to be_valid
expect(project_file.error_message).to include("Project `#{project.full_path}` file `/invalid-file.yml` does not exist!") expect(project_file.error_message).to include("Project `#{project.full_path}` file `/invalid-file.yml` does not exist!")
end end
...@@ -135,7 +135,7 @@ describe Gitlab::Ci::Config::External::File::Project do ...@@ -135,7 +135,7 @@ describe Gitlab::Ci::Config::External::File::Project do
{ project: project.full_path, file: '/invalid-file' } { project: project.full_path, file: '/invalid-file' }
end end
it 'should return false' do it 'returns false' do
expect(project_file).not_to be_valid expect(project_file).not_to be_valid
expect(project_file.error_message).to include('Included file `/invalid-file` does not have YAML extension!') expect(project_file.error_message).to include('Included file `/invalid-file` does not have YAML extension!')
end end
......
...@@ -21,7 +21,7 @@ describe Gitlab::Ci::Config::External::File::Remote do ...@@ -21,7 +21,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
context 'when a remote is specified' do context 'when a remote is specified' do
let(:params) { { remote: 'http://remote' } } let(:params) { { remote: 'http://remote' } }
it 'should return true' do it 'returns true' do
expect(remote_file).to be_matching expect(remote_file).to be_matching
end end
end end
...@@ -29,7 +29,7 @@ describe Gitlab::Ci::Config::External::File::Remote do ...@@ -29,7 +29,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
context 'with a missing remote' do context 'with a missing remote' do
let(:params) { { remote: nil } } let(:params) { { remote: nil } }
it 'should return false' do it 'returns false' do
expect(remote_file).not_to be_matching expect(remote_file).not_to be_matching
end end
end end
...@@ -37,7 +37,7 @@ describe Gitlab::Ci::Config::External::File::Remote do ...@@ -37,7 +37,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
context 'with a missing remote key' do context 'with a missing remote key' do
let(:params) { {} } let(:params) { {} }
it 'should return false' do it 'returns false' do
expect(remote_file).not_to be_matching expect(remote_file).not_to be_matching
end end
end end
...@@ -49,7 +49,7 @@ describe Gitlab::Ci::Config::External::File::Remote do ...@@ -49,7 +49,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
WebMock.stub_request(:get, location).to_return(body: remote_file_content) WebMock.stub_request(:get, location).to_return(body: remote_file_content)
end end
it 'should return true' do it 'returns true' do
expect(remote_file.valid?).to be_truthy expect(remote_file.valid?).to be_truthy
end end
end end
...@@ -57,7 +57,7 @@ describe Gitlab::Ci::Config::External::File::Remote do ...@@ -57,7 +57,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
context 'with an irregular url' do context 'with an irregular url' do
let(:location) { 'not-valid://gitlab.com/gitlab-org/gitlab-ce/blob/1234/.gitlab-ci-1.yml' } let(:location) { 'not-valid://gitlab.com/gitlab-org/gitlab-ce/blob/1234/.gitlab-ci-1.yml' }
it 'should return false' do it 'returns false' do
expect(remote_file.valid?).to be_falsy expect(remote_file.valid?).to be_falsy
end end
end end
...@@ -67,7 +67,7 @@ describe Gitlab::Ci::Config::External::File::Remote do ...@@ -67,7 +67,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
allow(Gitlab::HTTP).to receive(:get).and_raise(Timeout::Error) allow(Gitlab::HTTP).to receive(:get).and_raise(Timeout::Error)
end end
it 'should be falsy' do it 'is falsy' do
expect(remote_file.valid?).to be_falsy expect(remote_file.valid?).to be_falsy
end end
end end
...@@ -75,7 +75,7 @@ describe Gitlab::Ci::Config::External::File::Remote do ...@@ -75,7 +75,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
context 'when is not a yaml file' do context 'when is not a yaml file' do
let(:location) { 'https://asdasdasdaj48ggerexample.com' } let(:location) { 'https://asdasdasdaj48ggerexample.com' }
it 'should be falsy' do it 'is falsy' do
expect(remote_file.valid?).to be_falsy expect(remote_file.valid?).to be_falsy
end end
end end
...@@ -83,7 +83,7 @@ describe Gitlab::Ci::Config::External::File::Remote do ...@@ -83,7 +83,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
context 'with an internal url' do context 'with an internal url' do
let(:location) { 'http://localhost:8080' } let(:location) { 'http://localhost:8080' }
it 'should be falsy' do it 'is falsy' do
expect(remote_file.valid?).to be_falsy expect(remote_file.valid?).to be_falsy
end end
end end
...@@ -95,7 +95,7 @@ describe Gitlab::Ci::Config::External::File::Remote do ...@@ -95,7 +95,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
WebMock.stub_request(:get, location).to_return(body: remote_file_content) WebMock.stub_request(:get, location).to_return(body: remote_file_content)
end end
it 'should return the content of the file' do it 'returns the content of the file' do
expect(remote_file.content).to eql(remote_file_content) expect(remote_file.content).to eql(remote_file_content)
end end
end end
...@@ -105,7 +105,7 @@ describe Gitlab::Ci::Config::External::File::Remote do ...@@ -105,7 +105,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
allow(Gitlab::HTTP).to receive(:get).and_raise(Timeout::Error) allow(Gitlab::HTTP).to receive(:get).and_raise(Timeout::Error)
end end
it 'should be falsy' do it 'is falsy' do
expect(remote_file.content).to be_falsy expect(remote_file.content).to be_falsy
end end
end end
...@@ -117,7 +117,7 @@ describe Gitlab::Ci::Config::External::File::Remote do ...@@ -117,7 +117,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
WebMock.stub_request(:get, location).to_raise(SocketError.new('Some HTTP error')) WebMock.stub_request(:get, location).to_raise(SocketError.new('Some HTTP error'))
end end
it 'should be nil' do it 'is nil' do
expect(remote_file.content).to be_nil expect(remote_file.content).to be_nil
end end
end end
...@@ -125,7 +125,7 @@ describe Gitlab::Ci::Config::External::File::Remote do ...@@ -125,7 +125,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
context 'with an internal url' do context 'with an internal url' do
let(:location) { 'http://localhost:8080' } let(:location) { 'http://localhost:8080' }
it 'should be nil' do it 'is nil' do
expect(remote_file.content).to be_nil expect(remote_file.content).to be_nil
end end
end end
...@@ -147,7 +147,7 @@ describe Gitlab::Ci::Config::External::File::Remote do ...@@ -147,7 +147,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
WebMock.stub_request(:get, location).to_timeout WebMock.stub_request(:get, location).to_timeout
end end
it 'should returns error message about a timeout' do it 'returns error message about a timeout' do
expect(subject).to match /could not be fetched because of a timeout error!/ expect(subject).to match /could not be fetched because of a timeout error!/
end end
end end
...@@ -157,7 +157,7 @@ describe Gitlab::Ci::Config::External::File::Remote do ...@@ -157,7 +157,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
WebMock.stub_request(:get, location).to_raise(Gitlab::HTTP::Error) WebMock.stub_request(:get, location).to_raise(Gitlab::HTTP::Error)
end end
it 'should returns error message about a HTTP error' do it 'returns error message about a HTTP error' do
expect(subject).to match /could not be fetched because of HTTP error!/ expect(subject).to match /could not be fetched because of HTTP error!/
end end
end end
...@@ -167,7 +167,7 @@ describe Gitlab::Ci::Config::External::File::Remote do ...@@ -167,7 +167,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
WebMock.stub_request(:get, location).to_return(body: remote_file_content, status: 404) WebMock.stub_request(:get, location).to_return(body: remote_file_content, status: 404)
end end
it 'should returns error message about a timeout' do it 'returns error message about a timeout' do
expect(subject).to match /could not be fetched because of HTTP code `404` error!/ expect(subject).to match /could not be fetched because of HTTP code `404` error!/
end end
end end
...@@ -175,7 +175,7 @@ describe Gitlab::Ci::Config::External::File::Remote do ...@@ -175,7 +175,7 @@ describe Gitlab::Ci::Config::External::File::Remote do
context 'when the URL is blocked' do context 'when the URL is blocked' do
let(:location) { 'http://127.0.0.1/some/path/to/config.yaml' } let(:location) { 'http://127.0.0.1/some/path/to/config.yaml' }
it 'should include details about blocked URL' do it 'includes details about blocked URL' do
expect(subject).to eq "Remote file could not be fetched because URL '#{location}' " \ expect(subject).to eq "Remote file could not be fetched because URL '#{location}' " \
'is blocked: Requests to localhost are not allowed!' 'is blocked: Requests to localhost are not allowed!'
end end
......
...@@ -16,7 +16,7 @@ describe Gitlab::Ci::Config::External::File::Template do ...@@ -16,7 +16,7 @@ describe Gitlab::Ci::Config::External::File::Template do
context 'when a template is specified' do context 'when a template is specified' do
let(:params) { { template: 'some-template' } } let(:params) { { template: 'some-template' } }
it 'should return true' do it 'returns true' do
expect(template_file).to be_matching expect(template_file).to be_matching
end end
end end
...@@ -24,7 +24,7 @@ describe Gitlab::Ci::Config::External::File::Template do ...@@ -24,7 +24,7 @@ describe Gitlab::Ci::Config::External::File::Template do
context 'with a missing template' do context 'with a missing template' do
let(:params) { { template: nil } } let(:params) { { template: nil } }
it 'should return false' do it 'returns false' do
expect(template_file).not_to be_matching expect(template_file).not_to be_matching
end end
end end
...@@ -32,7 +32,7 @@ describe Gitlab::Ci::Config::External::File::Template do ...@@ -32,7 +32,7 @@ describe Gitlab::Ci::Config::External::File::Template do
context 'with a missing template key' do context 'with a missing template key' do
let(:params) { {} } let(:params) { {} }
it 'should return false' do it 'returns false' do
expect(template_file).not_to be_matching expect(template_file).not_to be_matching
end end
end end
...@@ -42,7 +42,7 @@ describe Gitlab::Ci::Config::External::File::Template do ...@@ -42,7 +42,7 @@ describe Gitlab::Ci::Config::External::File::Template do
context 'when is a valid template name' do context 'when is a valid template name' do
let(:template) { 'Auto-DevOps.gitlab-ci.yml' } let(:template) { 'Auto-DevOps.gitlab-ci.yml' }
it 'should return true' do it 'returns true' do
expect(template_file).to be_valid expect(template_file).to be_valid
end end
end end
...@@ -50,7 +50,7 @@ describe Gitlab::Ci::Config::External::File::Template do ...@@ -50,7 +50,7 @@ describe Gitlab::Ci::Config::External::File::Template do
context 'with invalid template name' do context 'with invalid template name' do
let(:template) { 'Template.yml' } let(:template) { 'Template.yml' }
it 'should return false' do it 'returns false' do
expect(template_file).not_to be_valid expect(template_file).not_to be_valid
expect(template_file.error_message).to include('Template file `Template.yml` is not a valid location!') expect(template_file.error_message).to include('Template file `Template.yml` is not a valid location!')
end end
...@@ -59,7 +59,7 @@ describe Gitlab::Ci::Config::External::File::Template do ...@@ -59,7 +59,7 @@ describe Gitlab::Ci::Config::External::File::Template do
context 'with a non-existing template' do context 'with a non-existing template' do
let(:template) { 'I-Do-Not-Have-This-Template.gitlab-ci.yml' } let(:template) { 'I-Do-Not-Have-This-Template.gitlab-ci.yml' }
it 'should return false' do it 'returns false' do
expect(template_file).not_to be_valid expect(template_file).not_to be_valid
expect(template_file.error_message).to include('Included file `I-Do-Not-Have-This-Template.gitlab-ci.yml` is empty or does not exist!') expect(template_file.error_message).to include('Included file `I-Do-Not-Have-This-Template.gitlab-ci.yml` is empty or does not exist!')
end end
......
...@@ -21,7 +21,7 @@ describe Gitlab::Ci::Config::External::Processor do ...@@ -21,7 +21,7 @@ describe Gitlab::Ci::Config::External::Processor do
context 'when no external files defined' do context 'when no external files defined' do
let(:values) { { image: 'ruby:2.2' } } let(:values) { { image: 'ruby:2.2' } }
it 'should return the same values' do it 'returns the same values' do
expect(processor.perform).to eq(values) expect(processor.perform).to eq(values)
end end
end end
...@@ -29,7 +29,7 @@ describe Gitlab::Ci::Config::External::Processor do ...@@ -29,7 +29,7 @@ describe Gitlab::Ci::Config::External::Processor do
context 'when an invalid local file is defined' do context 'when an invalid local file is defined' do
let(:values) { { include: '/lib/gitlab/ci/templates/non-existent-file.yml', image: 'ruby:2.2' } } let(:values) { { include: '/lib/gitlab/ci/templates/non-existent-file.yml', image: 'ruby:2.2' } }
it 'should raise an error' do it 'raises an error' do
expect { processor.perform }.to raise_error( expect { processor.perform }.to raise_error(
described_class::IncludeError, described_class::IncludeError,
"Local file `/lib/gitlab/ci/templates/non-existent-file.yml` does not exist!" "Local file `/lib/gitlab/ci/templates/non-existent-file.yml` does not exist!"
...@@ -45,7 +45,7 @@ describe Gitlab::Ci::Config::External::Processor do ...@@ -45,7 +45,7 @@ describe Gitlab::Ci::Config::External::Processor do
WebMock.stub_request(:get, remote_file).to_raise(SocketError.new('Some HTTP error')) WebMock.stub_request(:get, remote_file).to_raise(SocketError.new('Some HTTP error'))
end end
it 'should raise an error' do it 'raises an error' do
expect { processor.perform }.to raise_error( expect { processor.perform }.to raise_error(
described_class::IncludeError, described_class::IncludeError,
"Remote file `#{remote_file}` could not be fetched because of a socket error!" "Remote file `#{remote_file}` could not be fetched because of a socket error!"
...@@ -78,12 +78,12 @@ describe Gitlab::Ci::Config::External::Processor do ...@@ -78,12 +78,12 @@ describe Gitlab::Ci::Config::External::Processor do
WebMock.stub_request(:get, remote_file).to_return(body: external_file_content) WebMock.stub_request(:get, remote_file).to_return(body: external_file_content)
end end
it 'should append the file to the values' do it 'appends the file to the values' do
output = processor.perform output = processor.perform
expect(output.keys).to match_array([:image, :before_script, :rspec, :rubocop]) expect(output.keys).to match_array([:image, :before_script, :rspec, :rubocop])
end end
it "should remove the 'include' keyword" do it "removes the 'include' keyword" do
expect(processor.perform[:include]).to be_nil expect(processor.perform[:include]).to be_nil
end end
end end
...@@ -105,12 +105,12 @@ describe Gitlab::Ci::Config::External::Processor do ...@@ -105,12 +105,12 @@ describe Gitlab::Ci::Config::External::Processor do
.to receive(:fetch_local_content).and_return(local_file_content) .to receive(:fetch_local_content).and_return(local_file_content)
end end
it 'should append the file to the values' do it 'appends the file to the values' do
output = processor.perform output = processor.perform
expect(output.keys).to match_array([:image, :before_script]) expect(output.keys).to match_array([:image, :before_script])
end end
it "should remove the 'include' keyword" do it "removes the 'include' keyword" do
expect(processor.perform[:include]).to be_nil expect(processor.perform[:include]).to be_nil
end end
end end
...@@ -148,11 +148,11 @@ describe Gitlab::Ci::Config::External::Processor do ...@@ -148,11 +148,11 @@ describe Gitlab::Ci::Config::External::Processor do
WebMock.stub_request(:get, remote_file).to_return(body: remote_file_content) WebMock.stub_request(:get, remote_file).to_return(body: remote_file_content)
end end
it 'should append the files to the values' do it 'appends the files to the values' do
expect(processor.perform.keys).to match_array([:image, :stages, :before_script, :rspec]) expect(processor.perform.keys).to match_array([:image, :stages, :before_script, :rspec])
end end
it "should remove the 'include' keyword" do it "removes the 'include' keyword" do
expect(processor.perform[:include]).to be_nil expect(processor.perform[:include]).to be_nil
end end
end end
...@@ -167,7 +167,7 @@ describe Gitlab::Ci::Config::External::Processor do ...@@ -167,7 +167,7 @@ describe Gitlab::Ci::Config::External::Processor do
.to receive(:fetch_local_content).and_return(local_file_content) .to receive(:fetch_local_content).and_return(local_file_content)
end end
it 'should raise an error' do it 'raises an error' do
expect { processor.perform }.to raise_error( expect { processor.perform }.to raise_error(
described_class::IncludeError, described_class::IncludeError,
"Included file `/lib/gitlab/ci/templates/template.yml` does not have valid YAML syntax!" "Included file `/lib/gitlab/ci/templates/template.yml` does not have valid YAML syntax!"
...@@ -190,7 +190,7 @@ describe Gitlab::Ci::Config::External::Processor do ...@@ -190,7 +190,7 @@ describe Gitlab::Ci::Config::External::Processor do
HEREDOC HEREDOC
end end
it 'should take precedence' do it 'takes precedence' do
WebMock.stub_request(:get, remote_file).to_return(body: remote_file_content) WebMock.stub_request(:get, remote_file).to_return(body: remote_file_content)
expect(processor.perform[:image]).to eq('ruby:2.2') expect(processor.perform[:image]).to eq('ruby:2.2')
end end
......
...@@ -225,7 +225,7 @@ describe Gitlab::Ci::Config do ...@@ -225,7 +225,7 @@ describe Gitlab::Ci::Config do
end end
context "when gitlab_ci_yml has valid 'include' defined" do context "when gitlab_ci_yml has valid 'include' defined" do
it 'should return a composed hash' do it 'returns a composed hash' do
before_script_values = [ before_script_values = [
"apt-get update -qq && apt-get install -y -qq sqlite3 libsqlite3-dev nodejs", "ruby -v", "apt-get update -qq && apt-get install -y -qq sqlite3 libsqlite3-dev nodejs", "ruby -v",
"which ruby", "which ruby",
...@@ -316,7 +316,7 @@ describe Gitlab::Ci::Config do ...@@ -316,7 +316,7 @@ describe Gitlab::Ci::Config do
HEREDOC HEREDOC
end end
it 'should take precedence' do it 'takes precedence' do
expect(config.to_hash).to eq({ image: 'ruby:2.2' }) expect(config.to_hash).to eq({ image: 'ruby:2.2' })
end end
end end
...@@ -341,7 +341,7 @@ describe Gitlab::Ci::Config do ...@@ -341,7 +341,7 @@ describe Gitlab::Ci::Config do
HEREDOC HEREDOC
end end
it 'should merge the variables dictionaries' do it 'merges the variables dictionaries' do
expect(config.to_hash).to eq({ variables: { A: 'alpha', B: 'beta', C: 'gamma', D: 'delta' } }) expect(config.to_hash).to eq({ variables: { A: 'alpha', B: 'beta', C: 'gamma', D: 'delta' } })
end end
end end
......
...@@ -23,7 +23,7 @@ describe Gitlab::Ci::Pipeline::Chain::Skip do ...@@ -23,7 +23,7 @@ describe Gitlab::Ci::Pipeline::Chain::Skip do
step.perform! step.perform!
end end
it 'should break the chain' do it 'breaks the chain' do
expect(step.break?).to be true expect(step.break?).to be true
end end
...@@ -37,11 +37,11 @@ describe Gitlab::Ci::Pipeline::Chain::Skip do ...@@ -37,11 +37,11 @@ describe Gitlab::Ci::Pipeline::Chain::Skip do
step.perform! step.perform!
end end
it 'should not break the chain' do it 'does not break the chain' do
expect(step.break?).to be false expect(step.break?).to be false
end end
it 'should not skip a pipeline chain' do it 'does not skip a pipeline chain' do
expect(pipeline.reload).not_to be_skipped expect(pipeline.reload).not_to be_skipped
end end
end end
......
...@@ -150,13 +150,13 @@ describe Gitlab::ContributionsCalendar do ...@@ -150,13 +150,13 @@ describe Gitlab::ContributionsCalendar do
end end
describe '#starting_year' do describe '#starting_year' do
it "should be the start of last year" do it "is the start of last year" do
expect(calendar.starting_year).to eq(last_year.year) expect(calendar.starting_year).to eq(last_year.year)
end end
end end
describe '#starting_month' do describe '#starting_month' do
it "should be the start of this month" do it "is the start of this month" do
expect(calendar.starting_month).to eq(today.month) expect(calendar.starting_month).to eq(today.month)
end end
end end
......
...@@ -27,7 +27,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1, :delete do ...@@ -27,7 +27,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1, :delete do
describe '#rename_wildcard_paths' do describe '#rename_wildcard_paths' do
it_behaves_like 'renames child namespaces' it_behaves_like 'renames child namespaces'
it 'should rename projects' do it 'renames projects' do
rename_projects = double rename_projects = double
expect(described_class::RenameProjects) expect(described_class::RenameProjects)
.to receive(:new).with(['the-path'], subject) .to receive(:new).with(['the-path'], subject)
...@@ -40,7 +40,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1, :delete do ...@@ -40,7 +40,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1, :delete do
end end
describe '#rename_root_paths' do describe '#rename_root_paths' do
it 'should rename namespaces' do it 'renames namespaces' do
rename_namespaces = double rename_namespaces = double
expect(described_class::RenameNamespaces) expect(described_class::RenameNamespaces)
.to receive(:new).with(['the-path'], subject) .to receive(:new).with(['the-path'], subject)
......
...@@ -27,7 +27,7 @@ describe Gitlab::Diff::FileCollection::MergeRequestDiff do ...@@ -27,7 +27,7 @@ describe Gitlab::Diff::FileCollection::MergeRequestDiff do
let(:diffable) { merge_request.merge_request_diff } let(:diffable) { merge_request.merge_request_diff }
end end
it 'it uses a different cache key if diff line keys change' do it 'uses a different cache key if diff line keys change' do
mr_diff = described_class.new(merge_request.merge_request_diff, diff_options: nil) mr_diff = described_class.new(merge_request.merge_request_diff, diff_options: nil)
key = mr_diff.cache_key key = mr_diff.cache_key
......
...@@ -113,13 +113,13 @@ describe Gitlab::Git::Commit, :seed_helper do ...@@ -113,13 +113,13 @@ describe Gitlab::Git::Commit, :seed_helper do
context 'Class methods' do context 'Class methods' do
shared_examples '.find' do shared_examples '.find' do
it "should return first head commit if without params" do it "returns first head commit if without params" do
expect(described_class.last(repository).id).to eq( expect(described_class.last(repository).id).to eq(
rugged_repo.head.target.oid rugged_repo.head.target.oid
) )
end end
it "should return valid commit" do it "returns valid commit" do
expect(described_class.find(repository, SeedRepo::Commit::ID)).to be_valid_commit expect(described_class.find(repository, SeedRepo::Commit::ID)).to be_valid_commit
end end
...@@ -127,21 +127,21 @@ describe Gitlab::Git::Commit, :seed_helper do ...@@ -127,21 +127,21 @@ describe Gitlab::Git::Commit, :seed_helper do
expect(described_class.find(repository, SeedRepo::Commit::ID).parent_ids).to be_an(Array) expect(described_class.find(repository, SeedRepo::Commit::ID).parent_ids).to be_an(Array)
end end
it "should return valid commit for tag" do it "returns valid commit for tag" do
expect(described_class.find(repository, 'v1.0.0').id).to eq('6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9') expect(described_class.find(repository, 'v1.0.0').id).to eq('6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9')
end end
it "should return nil for non-commit ids" do it "returns nil for non-commit ids" do
blob = Gitlab::Git::Blob.find(repository, SeedRepo::Commit::ID, "files/ruby/popen.rb") blob = Gitlab::Git::Blob.find(repository, SeedRepo::Commit::ID, "files/ruby/popen.rb")
expect(described_class.find(repository, blob.id)).to be_nil expect(described_class.find(repository, blob.id)).to be_nil
end end
it "should return nil for parent of non-commit object" do it "returns nil for parent of non-commit object" do
blob = Gitlab::Git::Blob.find(repository, SeedRepo::Commit::ID, "files/ruby/popen.rb") blob = Gitlab::Git::Blob.find(repository, SeedRepo::Commit::ID, "files/ruby/popen.rb")
expect(described_class.find(repository, "#{blob.id}^")).to be_nil expect(described_class.find(repository, "#{blob.id}^")).to be_nil
end end
it "should return nil for nonexisting ids" do it "returns nil for nonexisting ids" do
expect(described_class.find(repository, "+123_4532530XYZ")).to be_nil expect(described_class.find(repository, "+123_4532530XYZ")).to be_nil
end end
...@@ -328,7 +328,7 @@ describe Gitlab::Git::Commit, :seed_helper do ...@@ -328,7 +328,7 @@ describe Gitlab::Git::Commit, :seed_helper do
end end
describe '.find_all' do describe '.find_all' do
it 'should return a return a collection of commits' do it 'returns a return a collection of commits' do
commits = described_class.find_all(repository) commits = described_class.find_all(repository)
expect(commits).to all( be_a_kind_of(described_class) ) expect(commits).to all( be_a_kind_of(described_class) )
......
...@@ -182,7 +182,7 @@ EOT ...@@ -182,7 +182,7 @@ EOT
context "without default options" do context "without default options" do
let(:filtered_options) { described_class.filter_diff_options(options) } let(:filtered_options) { described_class.filter_diff_options(options) }
it "should filter invalid options" do it "filters invalid options" do
expect(filtered_options).not_to have_key(:invalid_opt) expect(filtered_options).not_to have_key(:invalid_opt)
end end
end end
...@@ -193,16 +193,16 @@ EOT ...@@ -193,16 +193,16 @@ EOT
described_class.filter_diff_options(options, default_options) described_class.filter_diff_options(options, default_options)
end end
it "should filter invalid options" do it "filters invalid options" do
expect(filtered_options).not_to have_key(:invalid_opt) expect(filtered_options).not_to have_key(:invalid_opt)
expect(filtered_options).not_to have_key(:bad_opt) expect(filtered_options).not_to have_key(:bad_opt)
end end
it "should merge with default options" do it "merges with default options" do
expect(filtered_options).to have_key(:ignore_whitespace_change) expect(filtered_options).to have_key(:ignore_whitespace_change)
end end
it "should override default options" do it "overrides default options" do
expect(filtered_options).to have_key(:max_files) expect(filtered_options).to have_key(:max_files)
expect(filtered_options[:max_files]).to eq(100) expect(filtered_options[:max_files]).to eq(100)
end end
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::GitmodulesParser do describe Gitlab::Git::GitmodulesParser do
it 'should parse a .gitmodules file correctly' do it 'parses a .gitmodules file correctly' do
data = <<~GITMODULES data = <<~GITMODULES
[submodule "vendor/libgit2"] [submodule "vendor/libgit2"]
path = vendor/libgit2 path = vendor/libgit2
......
...@@ -450,20 +450,20 @@ describe Gitlab::Git::Repository, :seed_helper do ...@@ -450,20 +450,20 @@ describe Gitlab::Git::Repository, :seed_helper do
ensure_seeds ensure_seeds
end end
it "should create a new branch" do it "creates a new branch" do
expect(repository.create_branch('new_branch', 'master')).not_to be_nil expect(repository.create_branch('new_branch', 'master')).not_to be_nil
end end
it "should create a new branch with the right name" do it "creates a new branch with the right name" do
expect(repository.create_branch('another_branch', 'master').name).to eq('another_branch') expect(repository.create_branch('another_branch', 'master').name).to eq('another_branch')
end end
it "should fail if we create an existing branch" do it "fails if we create an existing branch" do
repository.create_branch('duplicated_branch', 'master') repository.create_branch('duplicated_branch', 'master')
expect {repository.create_branch('duplicated_branch', 'master')}.to raise_error("Branch duplicated_branch already exists") expect {repository.create_branch('duplicated_branch', 'master')}.to raise_error("Branch duplicated_branch already exists")
end end
it "should fail if we create a branch from a non existing ref" do it "fails if we create a branch from a non existing ref" do
expect {repository.create_branch('branch_based_in_wrong_ref', 'master_2_the_revenge')}.to raise_error("Invalid reference master_2_the_revenge") expect {repository.create_branch('branch_based_in_wrong_ref', 'master_2_the_revenge')}.to raise_error("Invalid reference master_2_the_revenge")
end end
end end
...@@ -522,7 +522,7 @@ describe Gitlab::Git::Repository, :seed_helper do ...@@ -522,7 +522,7 @@ describe Gitlab::Git::Repository, :seed_helper do
describe "#refs_hash" do describe "#refs_hash" do
subject { repository.refs_hash } subject { repository.refs_hash }
it "should have as many entries as branches and tags" do it "has as many entries as branches and tags" do
expected_refs = SeedRepo::Repo::BRANCHES + SeedRepo::Repo::TAGS expected_refs = SeedRepo::Repo::BRANCHES + SeedRepo::Repo::TAGS
# We flatten in case a commit is pointed at by more than one branch and/or tag # We flatten in case a commit is pointed at by more than one branch and/or tag
expect(subject.values.flatten.size).to eq(expected_refs.size) expect(subject.values.flatten.size).to eq(expected_refs.size)
...@@ -613,11 +613,11 @@ describe Gitlab::Git::Repository, :seed_helper do ...@@ -613,11 +613,11 @@ describe Gitlab::Git::Repository, :seed_helper do
end end
shared_examples 'search files by content' do shared_examples 'search files by content' do
it 'should have 2 items' do it 'has 2 items' do
expect(search_results.size).to eq(2) expect(search_results.size).to eq(2)
end end
it 'should have the correct matching line' do it 'has the correct matching line' do
expect(search_results).to contain_exactly("search-files-by-content-branch:encoding/CHANGELOG\u00001\u0000search-files-by-content change\n", expect(search_results).to contain_exactly("search-files-by-content-branch:encoding/CHANGELOG\u00001\u0000search-files-by-content change\n",
"search-files-by-content-branch:anotherfile\u00001\u0000search-files-by-content change\n") "search-files-by-content-branch:anotherfile\u00001\u0000search-files-by-content change\n")
end end
...@@ -850,7 +850,7 @@ describe Gitlab::Git::Repository, :seed_helper do ...@@ -850,7 +850,7 @@ describe Gitlab::Git::Repository, :seed_helper do
context "where provides 'after' timestamp" do context "where provides 'after' timestamp" do
options = { after: Time.iso8601('2014-03-03T20:15:01+00:00') } options = { after: Time.iso8601('2014-03-03T20:15:01+00:00') }
it "should returns commits on or after that timestamp" do it "returns commits on or after that timestamp" do
commits = repository.log(options) commits = repository.log(options)
expect(commits.size).to be > 0 expect(commits.size).to be > 0
...@@ -863,7 +863,7 @@ describe Gitlab::Git::Repository, :seed_helper do ...@@ -863,7 +863,7 @@ describe Gitlab::Git::Repository, :seed_helper do
context "where provides 'before' timestamp" do context "where provides 'before' timestamp" do
options = { before: Time.iso8601('2014-03-03T20:15:01+00:00') } options = { before: Time.iso8601('2014-03-03T20:15:01+00:00') }
it "should returns commits on or before that timestamp" do it "returns commits on or before that timestamp" do
commits = repository.log(options) commits = repository.log(options)
expect(commits.size).to be > 0 expect(commits.size).to be > 0
...@@ -1064,14 +1064,14 @@ describe Gitlab::Git::Repository, :seed_helper do ...@@ -1064,14 +1064,14 @@ describe Gitlab::Git::Repository, :seed_helper do
end end
describe '#find_branch' do describe '#find_branch' do
it 'should return a Branch for master' do it 'returns a Branch for master' do
branch = repository.find_branch('master') branch = repository.find_branch('master')
expect(branch).to be_a_kind_of(Gitlab::Git::Branch) expect(branch).to be_a_kind_of(Gitlab::Git::Branch)
expect(branch.name).to eq('master') expect(branch.name).to eq('master')
end end
it 'should handle non-existent branch' do it 'handles non-existent branch' do
branch = repository.find_branch('this-is-garbage') branch = repository.find_branch('this-is-garbage')
expect(branch).to eq(nil) expect(branch).to eq(nil)
......
...@@ -28,7 +28,7 @@ describe Gitlab::Kubernetes::ClusterRoleBinding do ...@@ -28,7 +28,7 @@ describe Gitlab::Kubernetes::ClusterRoleBinding do
subject { cluster_role_binding.generate } subject { cluster_role_binding.generate }
it 'should build a Kubeclient Resource' do it 'builds a Kubeclient Resource' do
is_expected.to eq(resource) is_expected.to eq(resource)
end end
end end
......
...@@ -18,7 +18,7 @@ describe Gitlab::Kubernetes::ConfigMap do ...@@ -18,7 +18,7 @@ describe Gitlab::Kubernetes::ConfigMap do
let(:resource) { ::Kubeclient::Resource.new(metadata: metadata, data: application.files) } let(:resource) { ::Kubeclient::Resource.new(metadata: metadata, data: application.files) }
subject { config_map.generate } subject { config_map.generate }
it 'should build a Kubeclient Resource' do it 'builds a Kubeclient Resource' do
is_expected.to eq(resource) is_expected.to eq(resource)
end end
end end
......
...@@ -41,7 +41,7 @@ describe Gitlab::Kubernetes::Helm::BaseCommand do ...@@ -41,7 +41,7 @@ describe Gitlab::Kubernetes::Helm::BaseCommand do
describe '#pod_resource' do describe '#pod_resource' do
subject { base_command.pod_resource } subject { base_command.pod_resource }
it 'should returns a kubeclient resoure with pod content for application' do it 'returns a kubeclient resoure with pod content for application' do
is_expected.to be_an_instance_of ::Kubeclient::Resource is_expected.to be_an_instance_of ::Kubeclient::Resource
end end
......
...@@ -5,7 +5,7 @@ describe Gitlab::Kubernetes::Helm::Certificate do ...@@ -5,7 +5,7 @@ describe Gitlab::Kubernetes::Helm::Certificate do
describe '.generate_root' do describe '.generate_root' do
subject { described_class.generate_root } subject { described_class.generate_root }
it 'should generate a root CA that expires a long way in the future' do it 'generates a root CA that expires a long way in the future' do
expect(subject.cert.not_after).to be > 999.years.from_now expect(subject.cert.not_after).to be > 999.years.from_now
end end
end end
...@@ -13,14 +13,14 @@ describe Gitlab::Kubernetes::Helm::Certificate do ...@@ -13,14 +13,14 @@ describe Gitlab::Kubernetes::Helm::Certificate do
describe '#issue' do describe '#issue' do
subject { described_class.generate_root.issue } subject { described_class.generate_root.issue }
it 'should generate a cert that expires soon' do it 'generates a cert that expires soon' do
expect(subject.cert.not_after).to be < 60.minutes.from_now expect(subject.cert.not_after).to be < 60.minutes.from_now
end end
context 'passing in INFINITE_EXPIRY' do context 'passing in INFINITE_EXPIRY' do
subject { described_class.generate_root.issue(expires_in: described_class::INFINITE_EXPIRY) } subject { described_class.generate_root.issue(expires_in: described_class::INFINITE_EXPIRY) }
it 'should generate a cert that expires a long way in the future' do it 'generates a cert that expires a long way in the future' do
expect(subject.cert.not_after).to be > 999.years.from_now expect(subject.cert.not_after).to be > 999.years.from_now
end end
end end
......
...@@ -10,11 +10,11 @@ describe Gitlab::Kubernetes::Helm::Pod do ...@@ -10,11 +10,11 @@ describe Gitlab::Kubernetes::Helm::Pod do
subject { described_class.new(command, namespace, service_account_name: service_account_name) } subject { described_class.new(command, namespace, service_account_name: service_account_name) }
context 'with a command' do context 'with a command' do
it 'should generate a Kubeclient::Resource' do it 'generates a Kubeclient::Resource' do
expect(subject.generate).to be_a_kind_of(Kubeclient::Resource) expect(subject.generate).to be_a_kind_of(Kubeclient::Resource)
end end
it 'should generate the appropriate metadata' do it 'generates the appropriate metadata' do
metadata = subject.generate.metadata metadata = subject.generate.metadata
expect(metadata.name).to eq("install-#{app.name}") expect(metadata.name).to eq("install-#{app.name}")
expect(metadata.namespace).to eq('gitlab-managed-apps') expect(metadata.namespace).to eq('gitlab-managed-apps')
...@@ -22,12 +22,12 @@ describe Gitlab::Kubernetes::Helm::Pod do ...@@ -22,12 +22,12 @@ describe Gitlab::Kubernetes::Helm::Pod do
expect(metadata.labels['gitlab.org/application']).to eq(app.name) expect(metadata.labels['gitlab.org/application']).to eq(app.name)
end end
it 'should generate a container spec' do it 'generates a container spec' do
spec = subject.generate.spec spec = subject.generate.spec
expect(spec.containers.count).to eq(1) expect(spec.containers.count).to eq(1)
end end
it 'should generate the appropriate specifications for the container' do it 'generates the appropriate specifications for the container' do
container = subject.generate.spec.containers.first container = subject.generate.spec.containers.first
expect(container.name).to eq('helm') expect(container.name).to eq('helm')
expect(container.image).to eq('registry.gitlab.com/gitlab-org/cluster-integration/helm-install-image/releases/2.12.3-kube-1.11.7') expect(container.image).to eq('registry.gitlab.com/gitlab-org/cluster-integration/helm-install-image/releases/2.12.3-kube-1.11.7')
...@@ -37,30 +37,30 @@ describe Gitlab::Kubernetes::Helm::Pod do ...@@ -37,30 +37,30 @@ describe Gitlab::Kubernetes::Helm::Pod do
expect(container.args).to match_array(["-c", "$(COMMAND_SCRIPT)"]) expect(container.args).to match_array(["-c", "$(COMMAND_SCRIPT)"])
end end
it 'should include a never restart policy' do it 'includes a never restart policy' do
spec = subject.generate.spec spec = subject.generate.spec
expect(spec.restartPolicy).to eq('Never') expect(spec.restartPolicy).to eq('Never')
end end
it 'should include volumes for the container' do it 'includes volumes for the container' do
container = subject.generate.spec.containers.first container = subject.generate.spec.containers.first
expect(container.volumeMounts.first['name']).to eq('configuration-volume') expect(container.volumeMounts.first['name']).to eq('configuration-volume')
expect(container.volumeMounts.first['mountPath']).to eq("/data/helm/#{app.name}/config") expect(container.volumeMounts.first['mountPath']).to eq("/data/helm/#{app.name}/config")
end end
it 'should include a volume inside the specification' do it 'includes a volume inside the specification' do
spec = subject.generate.spec spec = subject.generate.spec
expect(spec.volumes.first['name']).to eq('configuration-volume') expect(spec.volumes.first['name']).to eq('configuration-volume')
end end
it 'should mount configMap specification in the volume' do it 'mounts configMap specification in the volume' do
volume = subject.generate.spec.volumes.first volume = subject.generate.spec.volumes.first
expect(volume.configMap['name']).to eq("values-content-configuration-#{app.name}") expect(volume.configMap['name']).to eq("values-content-configuration-#{app.name}")
expect(volume.configMap['items'].first['key']).to eq(:'values.yaml') expect(volume.configMap['items'].first['key']).to eq(:'values.yaml')
expect(volume.configMap['items'].first['path']).to eq(:'values.yaml') expect(volume.configMap['items'].first['path']).to eq(:'values.yaml')
end end
it 'should have no serviceAccountName' do it 'has no serviceAccountName' do
spec = subject.generate.spec spec = subject.generate.spec
expect(spec.serviceAccountName).to be_nil expect(spec.serviceAccountName).to be_nil
end end
...@@ -68,7 +68,7 @@ describe Gitlab::Kubernetes::Helm::Pod do ...@@ -68,7 +68,7 @@ describe Gitlab::Kubernetes::Helm::Pod do
context 'with a service_account_name' do context 'with a service_account_name' do
let(:service_account_name) { 'sa' } let(:service_account_name) { 'sa' }
it 'should use the serviceAccountName provided' do it 'uses the serviceAccountName provided' do
spec = subject.generate.spec spec = subject.generate.spec
expect(spec.serviceAccountName).to eq(service_account_name) expect(spec.serviceAccountName).to eq(service_account_name)
end end
......
...@@ -42,7 +42,7 @@ describe Gitlab::Kubernetes::RoleBinding, '#generate' do ...@@ -42,7 +42,7 @@ describe Gitlab::Kubernetes::RoleBinding, '#generate' do
).generate ).generate
end end
it 'should build a Kubeclient Resource' do it 'builds a Kubeclient Resource' do
is_expected.to eq(resource) is_expected.to eq(resource)
end end
end end
...@@ -17,7 +17,7 @@ describe Gitlab::Kubernetes::ServiceAccount do ...@@ -17,7 +17,7 @@ describe Gitlab::Kubernetes::ServiceAccount do
subject { service_account.generate } subject { service_account.generate }
it 'should build a Kubeclient Resource' do it 'builds a Kubeclient Resource' do
is_expected.to eq(resource) is_expected.to eq(resource)
end end
end end
......
...@@ -28,7 +28,7 @@ describe Gitlab::Kubernetes::ServiceAccountToken do ...@@ -28,7 +28,7 @@ describe Gitlab::Kubernetes::ServiceAccountToken do
subject { service_account_token.generate } subject { service_account_token.generate }
it 'should build a Kubeclient Resource' do it 'builds a Kubeclient Resource' do
is_expected.to eq(resource) is_expected.to eq(resource)
end end
end end
......
...@@ -97,7 +97,7 @@ describe Gitlab::SearchResults do ...@@ -97,7 +97,7 @@ describe Gitlab::SearchResults do
results.objects('merge_requests') results.objects('merge_requests')
end end
it 'it skips project filter if default project context is used' do it 'skips project filter if default project context is used' do
allow(results).to receive(:default_project_filter).and_return(true) allow(results).to receive(:default_project_filter).and_return(true)
expect(results).not_to receive(:project_ids_relation) expect(results).not_to receive(:project_ids_relation)
...@@ -113,7 +113,7 @@ describe Gitlab::SearchResults do ...@@ -113,7 +113,7 @@ describe Gitlab::SearchResults do
results.objects('issues') results.objects('issues')
end end
it 'it skips project filter if default project context is used' do it 'skips project filter if default project context is used' do
allow(results).to receive(:default_project_filter).and_return(true) allow(results).to receive(:default_project_filter).and_return(true)
expect(results).not_to receive(:project_ids_relation) expect(results).not_to receive(:project_ids_relation)
......
...@@ -7,19 +7,19 @@ describe Gitlab::Tracing::Rails::ActionViewSubscriber do ...@@ -7,19 +7,19 @@ describe Gitlab::Tracing::Rails::ActionViewSubscriber do
using RSpec::Parameterized::TableSyntax using RSpec::Parameterized::TableSyntax
shared_examples 'an actionview notification' do shared_examples 'an actionview notification' do
it 'should notify the tracer when the hash contains null values' do it 'notifies the tracer when the hash contains null values' do
expect(subject).to receive(:postnotify_span).with(notification_name, start, finish, tags: expected_tags, exception: exception) expect(subject).to receive(:postnotify_span).with(notification_name, start, finish, tags: expected_tags, exception: exception)
subject.public_send(notify_method, start, finish, payload) subject.public_send(notify_method, start, finish, payload)
end end
it 'should notify the tracer when the payload is missing values' do it 'notifies the tracer when the payload is missing values' do
expect(subject).to receive(:postnotify_span).with(notification_name, start, finish, tags: expected_tags, exception: exception) expect(subject).to receive(:postnotify_span).with(notification_name, start, finish, tags: expected_tags, exception: exception)
subject.public_send(notify_method, start, finish, payload.compact) subject.public_send(notify_method, start, finish, payload.compact)
end end
it 'should not throw exceptions when with the default tracer' do it 'does not throw exceptions when with the default tracer' do
expect { subject.public_send(notify_method, start, finish, payload) }.not_to raise_error expect { subject.public_send(notify_method, start, finish, payload) }.not_to raise_error
end end
end end
......
...@@ -53,19 +53,19 @@ describe Gitlab::Tracing::Rails::ActiveRecordSubscriber do ...@@ -53,19 +53,19 @@ describe Gitlab::Tracing::Rails::ActiveRecordSubscriber do
} }
end end
it 'should notify the tracer when the hash contains null values' do it 'notifies the tracer when the hash contains null values' do
expect(subject).to receive(:postnotify_span).with(operation_name, start, finish, tags: expected_tags, exception: exception) expect(subject).to receive(:postnotify_span).with(operation_name, start, finish, tags: expected_tags, exception: exception)
subject.notify(start, finish, payload) subject.notify(start, finish, payload)
end end
it 'should notify the tracer when the payload is missing values' do it 'notifies the tracer when the payload is missing values' do
expect(subject).to receive(:postnotify_span).with(operation_name, start, finish, tags: expected_tags, exception: exception) expect(subject).to receive(:postnotify_span).with(operation_name, start, finish, tags: expected_tags, exception: exception)
subject.notify(start, finish, payload.compact) subject.notify(start, finish, payload.compact)
end end
it 'should not throw exceptions when with the default tracer' do it 'does not throw exceptions when with the default tracer' do
expect { subject.notify(start, finish, payload) }.not_to raise_error expect { subject.notify(start, finish, payload) }.not_to raise_error
end end
end end
......
...@@ -14,7 +14,7 @@ describe Gitlab::Tracing do ...@@ -14,7 +14,7 @@ describe Gitlab::Tracing do
end end
with_them do with_them do
it 'should return the correct state for .enabled?' do it 'returns the correct state for .enabled?' do
expect(described_class).to receive(:connection_string).and_return(connection_string) expect(described_class).to receive(:connection_string).and_return(connection_string)
expect(described_class.enabled?).to eq(enabled_state) expect(described_class.enabled?).to eq(enabled_state)
...@@ -33,7 +33,7 @@ describe Gitlab::Tracing do ...@@ -33,7 +33,7 @@ describe Gitlab::Tracing do
end end
with_them do with_them do
it 'should return the correct state for .tracing_url_enabled?' do it 'returns the correct state for .tracing_url_enabled?' do
expect(described_class).to receive(:enabled?).and_return(enabled?) expect(described_class).to receive(:enabled?).and_return(enabled?)
allow(described_class).to receive(:tracing_url_template).and_return(tracing_url_template) allow(described_class).to receive(:tracing_url_template).and_return(tracing_url_template)
...@@ -56,7 +56,7 @@ describe Gitlab::Tracing do ...@@ -56,7 +56,7 @@ describe Gitlab::Tracing do
end end
with_them do with_them do
it 'should return the correct state for .tracing_url' do it 'returns the correct state for .tracing_url' do
expect(described_class).to receive(:tracing_url_enabled?).and_return(tracing_url_enabled?) expect(described_class).to receive(:tracing_url_enabled?).and_return(tracing_url_enabled?)
allow(described_class).to receive(:tracing_url_template).and_return(tracing_url_template) allow(described_class).to receive(:tracing_url_template).and_return(tracing_url_template)
allow(Gitlab::CorrelationId).to receive(:current_id).and_return(correlation_id) allow(Gitlab::CorrelationId).to receive(:current_id).and_return(correlation_id)
......
...@@ -161,7 +161,7 @@ describe Gitlab::UrlSanitizer do ...@@ -161,7 +161,7 @@ describe Gitlab::UrlSanitizer do
end end
context 'when credentials contains special chars' do context 'when credentials contains special chars' do
it 'should parse the URL without errors' do it 'parses the URL without errors' do
url_sanitizer = described_class.new("https://foo:b?r@github.com/me/project.git") url_sanitizer = described_class.new("https://foo:b?r@github.com/me/project.git")
expect(url_sanitizer.sanitized_url).to eq("https://github.com/me/project.git") expect(url_sanitizer.sanitized_url).to eq("https://github.com/me/project.git")
......
...@@ -25,7 +25,7 @@ describe MigrateAutoDevOpsDomainToClusterDomain, :migration do ...@@ -25,7 +25,7 @@ describe MigrateAutoDevOpsDomainToClusterDomain, :migration do
context 'with ProjectAutoDevOps with no domain' do context 'with ProjectAutoDevOps with no domain' do
let(:domain) { nil } let(:domain) { nil }
it 'should not update cluster project' do it 'does not update cluster project' do
migrate! migrate!
expect(clusters_without_domain.count).to eq(clusters_table.count) expect(clusters_without_domain.count).to eq(clusters_table.count)
...@@ -35,7 +35,7 @@ describe MigrateAutoDevOpsDomainToClusterDomain, :migration do ...@@ -35,7 +35,7 @@ describe MigrateAutoDevOpsDomainToClusterDomain, :migration do
context 'with ProjectAutoDevOps with domain' do context 'with ProjectAutoDevOps with domain' do
let(:domain) { 'example-domain.com' } let(:domain) { 'example-domain.com' }
it 'should update all cluster projects' do it 'updates all cluster projects' do
migrate! migrate!
expect(clusters_with_domain.count).to eq(clusters_table.count) expect(clusters_with_domain.count).to eq(clusters_table.count)
...@@ -49,7 +49,7 @@ describe MigrateAutoDevOpsDomainToClusterDomain, :migration do ...@@ -49,7 +49,7 @@ describe MigrateAutoDevOpsDomainToClusterDomain, :migration do
setup_cluster_projects_with_domain(quantity: 25, domain: nil) setup_cluster_projects_with_domain(quantity: 25, domain: nil)
end end
it 'should only update specific cluster projects' do it 'only updates specific cluster projects' do
migrate! migrate!
expect(clusters_with_domain.count).to eq(20) expect(clusters_with_domain.count).to eq(20)
......
...@@ -61,7 +61,7 @@ describe Badge do ...@@ -61,7 +61,7 @@ describe Badge do
end end
shared_examples 'rendered_links' do shared_examples 'rendered_links' do
it 'should use the project information to populate the url placeholders' do it 'uses the project information to populate the url placeholders' do
stub_project_commit_info(project) stub_project_commit_info(project)
expect(badge.public_send("rendered_#{method}", project)).to eq "http://www.example.com/#{project.full_path}/#{project.id}/master/whatever" expect(badge.public_send("rendered_#{method}", project)).to eq "http://www.example.com/#{project.full_path}/#{project.id}/master/whatever"
......
...@@ -14,7 +14,7 @@ describe ProjectBadge do ...@@ -14,7 +14,7 @@ describe ProjectBadge do
end end
shared_examples 'rendered_links' do shared_examples 'rendered_links' do
it 'should use the badge project information to populate the url placeholders' do it 'uses the badge project information to populate the url placeholders' do
stub_project_commit_info(project) stub_project_commit_info(project)
expect(badge.public_send("rendered_#{method}")).to eq "http://www.example.com/#{project.full_path}/#{project.id}/master/whatever" expect(badge.public_send("rendered_#{method}")).to eq "http://www.example.com/#{project.full_path}/#{project.id}/master/whatever"
......
...@@ -2726,13 +2726,13 @@ describe Ci::Build do ...@@ -2726,13 +2726,13 @@ describe Ci::Build do
project.deploy_tokens << deploy_token project.deploy_tokens << deploy_token
end end
it 'should include deploy token variables' do it 'includes deploy token variables' do
is_expected.to include(*deploy_token_variables) is_expected.to include(*deploy_token_variables)
end end
end end
context 'when gitlab-deploy-token does not exist' do context 'when gitlab-deploy-token does not exist' do
it 'should not include deploy token variables' do it 'does not include deploy token variables' do
expect(subject.find { |v| v[:key] == 'CI_DEPLOY_USER'}).to be_nil expect(subject.find { |v| v[:key] == 'CI_DEPLOY_USER'}).to be_nil
expect(subject.find { |v| v[:key] == 'CI_DEPLOY_PASSWORD'}).to be_nil expect(subject.find { |v| v[:key] == 'CI_DEPLOY_PASSWORD'}).to be_nil
end end
......
...@@ -72,7 +72,7 @@ describe Ci::Runner do ...@@ -72,7 +72,7 @@ describe Ci::Runner do
expect(instance_runner.errors.full_messages).to include('Runner cannot have projects assigned') expect(instance_runner.errors.full_messages).to include('Runner cannot have projects assigned')
end end
it 'should fail to save a group assigned to a project runner even if the runner is already saved' do it 'fails to save a group assigned to a project runner even if the runner is already saved' do
group_runner group_runner
expect { create(:group, runners: [project_runner]) } expect { create(:group, runners: [project_runner]) }
......
...@@ -36,7 +36,7 @@ describe Clusters::Applications::CertManager do ...@@ -36,7 +36,7 @@ describe Clusters::Applications::CertManager do
it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) } it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) }
it 'should be initialized with cert_manager arguments' do it 'is initialized with cert_manager arguments' do
expect(subject.name).to eq('certmanager') expect(subject.name).to eq('certmanager')
expect(subject.chart).to eq('stable/cert-manager') expect(subject.chart).to eq('stable/cert-manager')
expect(subject.version).to eq('v0.5.2') expect(subject.version).to eq('v0.5.2')
...@@ -52,7 +52,7 @@ describe Clusters::Applications::CertManager do ...@@ -52,7 +52,7 @@ describe Clusters::Applications::CertManager do
cert_manager.email = cert_email cert_manager.email = cert_email
end end
it 'should use his/her email to register issuer with certificate provider' do it 'uses his/her email to register issuer with certificate provider' do
expect(subject.files).to eq(cert_manager.files.merge(cluster_issuer_file)) expect(subject.files).to eq(cert_manager.files.merge(cluster_issuer_file))
end end
end end
...@@ -68,7 +68,7 @@ describe Clusters::Applications::CertManager do ...@@ -68,7 +68,7 @@ describe Clusters::Applications::CertManager do
context 'application failed to install previously' do context 'application failed to install previously' do
let(:cert_manager) { create(:clusters_applications_cert_managers, :errored, version: '0.0.1') } let(:cert_manager) { create(:clusters_applications_cert_managers, :errored, version: '0.0.1') }
it 'should be initialized with the locked version' do it 'is initialized with the locked version' do
expect(subject.version).to eq('v0.5.2') expect(subject.version).to eq('v0.5.2')
end end
end end
...@@ -80,7 +80,7 @@ describe Clusters::Applications::CertManager do ...@@ -80,7 +80,7 @@ describe Clusters::Applications::CertManager do
subject { application.files } subject { application.files }
it 'should include cert_manager specific keys in the values.yaml file' do it 'includes cert_manager specific keys in the values.yaml file' do
expect(values).to include('ingressShim') expect(values).to include('ingressShim')
end end
end end
......
...@@ -36,11 +36,11 @@ describe Clusters::Applications::Helm do ...@@ -36,11 +36,11 @@ describe Clusters::Applications::Helm do
it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InitCommand) } it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InitCommand) }
it 'should be initialized with 1 arguments' do it 'is initialized with 1 arguments' do
expect(subject.name).to eq('helm') expect(subject.name).to eq('helm')
end end
it 'should have cert files' do it 'has cert files' do
expect(subject.files[:'ca.pem']).to be_present expect(subject.files[:'ca.pem']).to be_present
expect(subject.files[:'ca.pem']).to eq(helm.ca_cert) expect(subject.files[:'ca.pem']).to eq(helm.ca_cert)
......
...@@ -73,7 +73,7 @@ describe Clusters::Applications::Ingress do ...@@ -73,7 +73,7 @@ describe Clusters::Applications::Ingress do
it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) } it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) }
it 'should be initialized with ingress arguments' do it 'is initialized with ingress arguments' do
expect(subject.name).to eq('ingress') expect(subject.name).to eq('ingress')
expect(subject.chart).to eq('stable/nginx-ingress') expect(subject.chart).to eq('stable/nginx-ingress')
expect(subject.version).to eq('1.1.2') expect(subject.version).to eq('1.1.2')
...@@ -92,7 +92,7 @@ describe Clusters::Applications::Ingress do ...@@ -92,7 +92,7 @@ describe Clusters::Applications::Ingress do
context 'application failed to install previously' do context 'application failed to install previously' do
let(:ingress) { create(:clusters_applications_ingress, :errored, version: 'nginx') } let(:ingress) { create(:clusters_applications_ingress, :errored, version: 'nginx') }
it 'should be initialized with the locked version' do it 'is initialized with the locked version' do
expect(subject.version).to eq('1.1.2') expect(subject.version).to eq('1.1.2')
end end
end end
...@@ -104,7 +104,7 @@ describe Clusters::Applications::Ingress do ...@@ -104,7 +104,7 @@ describe Clusters::Applications::Ingress do
subject { application.files } subject { application.files }
it 'should include ingress valid keys in values' do it 'includes ingress valid keys in values' do
expect(values).to include('image') expect(values).to include('image')
expect(values).to include('repository') expect(values).to include('repository')
expect(values).to include('stats') expect(values).to include('stats')
......
...@@ -45,7 +45,7 @@ describe Clusters::Applications::Jupyter do ...@@ -45,7 +45,7 @@ describe Clusters::Applications::Jupyter do
it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) } it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) }
it 'should be initialized with 4 arguments' do it 'is initialized with 4 arguments' do
expect(subject.name).to eq('jupyter') expect(subject.name).to eq('jupyter')
expect(subject.chart).to eq('jupyter/jupyterhub') expect(subject.chart).to eq('jupyter/jupyterhub')
expect(subject.version).to eq('0.9-174bbd5') expect(subject.version).to eq('0.9-174bbd5')
...@@ -65,7 +65,7 @@ describe Clusters::Applications::Jupyter do ...@@ -65,7 +65,7 @@ describe Clusters::Applications::Jupyter do
context 'application failed to install previously' do context 'application failed to install previously' do
let(:jupyter) { create(:clusters_applications_jupyter, :errored, version: '0.0.1') } let(:jupyter) { create(:clusters_applications_jupyter, :errored, version: '0.0.1') }
it 'should be initialized with the locked version' do it 'is initialized with the locked version' do
expect(subject.version).to eq('0.9-174bbd5') expect(subject.version).to eq('0.9-174bbd5')
end end
end end
...@@ -77,7 +77,7 @@ describe Clusters::Applications::Jupyter do ...@@ -77,7 +77,7 @@ describe Clusters::Applications::Jupyter do
subject { application.files } subject { application.files }
it 'should include valid values' do it 'includes valid values' do
expect(values).to include('ingress') expect(values).to include('ingress')
expect(values).to include('hub') expect(values).to include('hub')
expect(values).to include('rbac') expect(values).to include('rbac')
......
...@@ -77,17 +77,17 @@ describe Clusters::Applications::Knative do ...@@ -77,17 +77,17 @@ describe Clusters::Applications::Knative do
end end
shared_examples 'a command' do shared_examples 'a command' do
it 'should be an instance of Helm::InstallCommand' do it 'is an instance of Helm::InstallCommand' do
expect(subject).to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) expect(subject).to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand)
end end
it 'should be initialized with knative arguments' do it 'is initialized with knative arguments' do
expect(subject.name).to eq('knative') expect(subject.name).to eq('knative')
expect(subject.chart).to eq('knative/knative') expect(subject.chart).to eq('knative/knative')
expect(subject.files).to eq(knative.files) expect(subject.files).to eq(knative.files)
end end
it 'should not install metrics for prometheus' do it 'does not install metrics for prometheus' do
expect(subject.postinstall).to be_nil expect(subject.postinstall).to be_nil
end end
...@@ -97,7 +97,7 @@ describe Clusters::Applications::Knative do ...@@ -97,7 +97,7 @@ describe Clusters::Applications::Knative do
subject { knative.install_command } subject { knative.install_command }
it 'should install metrics' do it 'installs metrics' do
expect(subject.postinstall).not_to be_nil expect(subject.postinstall).not_to be_nil
expect(subject.postinstall.length).to be(1) expect(subject.postinstall.length).to be(1)
expect(subject.postinstall[0]).to eql("kubectl apply -f #{Clusters::Applications::Knative::METRICS_CONFIG}") expect(subject.postinstall[0]).to eql("kubectl apply -f #{Clusters::Applications::Knative::METRICS_CONFIG}")
...@@ -108,7 +108,7 @@ describe Clusters::Applications::Knative do ...@@ -108,7 +108,7 @@ describe Clusters::Applications::Knative do
describe '#install_command' do describe '#install_command' do
subject { knative.install_command } subject { knative.install_command }
it 'should be initialized with latest version' do it 'is initialized with latest version' do
expect(subject.version).to eq('0.3.0') expect(subject.version).to eq('0.3.0')
end end
...@@ -119,7 +119,7 @@ describe Clusters::Applications::Knative do ...@@ -119,7 +119,7 @@ describe Clusters::Applications::Knative do
let!(:current_installed_version) { knative.version = '0.1.0' } let!(:current_installed_version) { knative.version = '0.1.0' }
subject { knative.update_command } subject { knative.update_command }
it 'should be initialized with current version' do it 'is initialized with current version' do
expect(subject.version).to eq(current_installed_version) expect(subject.version).to eq(current_installed_version)
end end
...@@ -132,7 +132,7 @@ describe Clusters::Applications::Knative do ...@@ -132,7 +132,7 @@ describe Clusters::Applications::Knative do
subject { application.files } subject { application.files }
it 'should include knative specific keys in the values.yaml file' do it 'includes knative specific keys in the values.yaml file' do
expect(values).to include('domain') expect(values).to include('domain')
end end
end end
...@@ -165,7 +165,7 @@ describe Clusters::Applications::Knative do ...@@ -165,7 +165,7 @@ describe Clusters::Applications::Knative do
synchronous_reactive_cache(knative) synchronous_reactive_cache(knative)
end end
it 'should be able k8s core for pod details' do it 'is able k8s core for pod details' do
expect(knative.service_pod_details(namespace.namespace, cluster.cluster_project.project.name)).not_to be_nil expect(knative.service_pod_details(namespace.namespace, cluster.cluster_project.project.name)).not_to be_nil
end end
end end
...@@ -190,7 +190,7 @@ describe Clusters::Applications::Knative do ...@@ -190,7 +190,7 @@ describe Clusters::Applications::Knative do
stub_kubeclient_service_pods stub_kubeclient_service_pods
end end
it 'should have an unintialized cache' do it 'has an unintialized cache' do
is_expected.to be_nil is_expected.to be_nil
end end
...@@ -204,11 +204,11 @@ describe Clusters::Applications::Knative do ...@@ -204,11 +204,11 @@ describe Clusters::Applications::Knative do
synchronous_reactive_cache(knative) synchronous_reactive_cache(knative)
end end
it 'should have cached services' do it 'has cached services' do
is_expected.not_to be_nil is_expected.not_to be_nil
end end
it 'should match our namespace' do it 'matches our namespace' do
expect(knative.services_for(ns: namespace)).not_to be_nil expect(knative.services_for(ns: namespace)).not_to be_nil
end end
end end
......
...@@ -94,7 +94,7 @@ describe Clusters::Applications::Prometheus do ...@@ -94,7 +94,7 @@ describe Clusters::Applications::Prometheus do
it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) } it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) }
it 'should be initialized with 3 arguments' do it 'is initialized with 3 arguments' do
expect(subject.name).to eq('prometheus') expect(subject.name).to eq('prometheus')
expect(subject.chart).to eq('stable/prometheus') expect(subject.chart).to eq('stable/prometheus')
expect(subject.version).to eq('6.7.3') expect(subject.version).to eq('6.7.3')
...@@ -113,12 +113,12 @@ describe Clusters::Applications::Prometheus do ...@@ -113,12 +113,12 @@ describe Clusters::Applications::Prometheus do
context 'application failed to install previously' do context 'application failed to install previously' do
let(:prometheus) { create(:clusters_applications_prometheus, :errored, version: '2.0.0') } let(:prometheus) { create(:clusters_applications_prometheus, :errored, version: '2.0.0') }
it 'should be initialized with the locked version' do it 'is initialized with the locked version' do
expect(subject.version).to eq('6.7.3') expect(subject.version).to eq('6.7.3')
end end
end end
it 'should not install knative metrics' do it 'does not install knative metrics' do
expect(subject.postinstall).to be_nil expect(subject.postinstall).to be_nil
end end
...@@ -128,7 +128,7 @@ describe Clusters::Applications::Prometheus do ...@@ -128,7 +128,7 @@ describe Clusters::Applications::Prometheus do
subject { prometheus.install_command } subject { prometheus.install_command }
it 'should install knative metrics' do it 'installs knative metrics' do
expect(subject.postinstall).to include("kubectl apply -f #{Clusters::Applications::Knative::METRICS_CONFIG}") expect(subject.postinstall).to include("kubectl apply -f #{Clusters::Applications::Knative::METRICS_CONFIG}")
end end
end end
...@@ -142,7 +142,7 @@ describe Clusters::Applications::Prometheus do ...@@ -142,7 +142,7 @@ describe Clusters::Applications::Prometheus do
expect(prometheus.upgrade_command(values)).to be_an_instance_of(::Gitlab::Kubernetes::Helm::InstallCommand) expect(prometheus.upgrade_command(values)).to be_an_instance_of(::Gitlab::Kubernetes::Helm::InstallCommand)
end end
it 'should be initialized with 3 arguments' do it 'is initialized with 3 arguments' do
command = prometheus.upgrade_command(values) command = prometheus.upgrade_command(values)
expect(command.name).to eq('prometheus') expect(command.name).to eq('prometheus')
...@@ -180,7 +180,7 @@ describe Clusters::Applications::Prometheus do ...@@ -180,7 +180,7 @@ describe Clusters::Applications::Prometheus do
subject { application.files } subject { application.files }
it 'should include prometheus valid values' do it 'includes prometheus valid values' do
expect(values).to include('alertmanager') expect(values).to include('alertmanager')
expect(values).to include('kubeStateMetrics') expect(values).to include('kubeStateMetrics')
expect(values).to include('nodeExporter') expect(values).to include('nodeExporter')
...@@ -204,7 +204,7 @@ describe Clusters::Applications::Prometheus do ...@@ -204,7 +204,7 @@ describe Clusters::Applications::Prometheus do
expect(subject[:'values.yaml']).to eq({ hello: :world }) expect(subject[:'values.yaml']).to eq({ hello: :world })
end end
it 'should include cert files' do it 'includes cert files' do
expect(subject[:'ca.pem']).to be_present expect(subject[:'ca.pem']).to be_present
expect(subject[:'ca.pem']).to eq(application.cluster.application_helm.ca_cert) expect(subject[:'ca.pem']).to eq(application.cluster.application_helm.ca_cert)
...@@ -220,7 +220,7 @@ describe Clusters::Applications::Prometheus do ...@@ -220,7 +220,7 @@ describe Clusters::Applications::Prometheus do
application.cluster.application_helm.ca_cert = nil application.cluster.application_helm.ca_cert = nil
end end
it 'should not include cert files' do it 'does not include cert files' do
expect(subject[:'ca.pem']).not_to be_present expect(subject[:'ca.pem']).not_to be_present
expect(subject[:'cert.pem']).not_to be_present expect(subject[:'cert.pem']).not_to be_present
expect(subject[:'key.pem']).not_to be_present expect(subject[:'key.pem']).not_to be_present
......
...@@ -21,7 +21,7 @@ describe Clusters::Applications::Runner do ...@@ -21,7 +21,7 @@ describe Clusters::Applications::Runner do
it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) } it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) }
it 'should be initialized with 4 arguments' do it 'is initialized with 4 arguments' do
expect(subject.name).to eq('runner') expect(subject.name).to eq('runner')
expect(subject.chart).to eq('runner/gitlab-runner') expect(subject.chart).to eq('runner/gitlab-runner')
expect(subject.version).to eq('0.3.0') expect(subject.version).to eq('0.3.0')
...@@ -41,7 +41,7 @@ describe Clusters::Applications::Runner do ...@@ -41,7 +41,7 @@ describe Clusters::Applications::Runner do
context 'application failed to install previously' do context 'application failed to install previously' do
let(:gitlab_runner) { create(:clusters_applications_runner, :errored, runner: ci_runner, version: '0.1.13') } let(:gitlab_runner) { create(:clusters_applications_runner, :errored, runner: ci_runner, version: '0.1.13') }
it 'should be initialized with the locked version' do it 'is initialized with the locked version' do
expect(subject.version).to eq('0.3.0') expect(subject.version).to eq('0.3.0')
end end
end end
...@@ -53,7 +53,7 @@ describe Clusters::Applications::Runner do ...@@ -53,7 +53,7 @@ describe Clusters::Applications::Runner do
subject { application.files } subject { application.files }
it 'should include runner valid values' do it 'includes runner valid values' do
expect(values).to include('concurrent') expect(values).to include('concurrent')
expect(values).to include('checkInterval') expect(values).to include('checkInterval')
expect(values).to include('rbac') expect(values).to include('rbac')
...@@ -131,7 +131,7 @@ describe Clusters::Applications::Runner do ...@@ -131,7 +131,7 @@ describe Clusters::Applications::Runner do
allow(application).to receive(:chart_values).and_return(stub_values) allow(application).to receive(:chart_values).and_return(stub_values)
end end
it 'should overwrite values.yaml' do it 'overwrites values.yaml' do
expect(values).to match(/privileged: '?#{application.privileged}/) expect(values).to match(/privileged: '?#{application.privileged}/)
end end
end end
......
...@@ -269,7 +269,7 @@ describe Clusters::Cluster do ...@@ -269,7 +269,7 @@ describe Clusters::Cluster do
context 'when cluster is not a valid hostname' do context 'when cluster is not a valid hostname' do
let(:cluster) { build(:cluster, domain: 'http://not.a.valid.hostname') } let(:cluster) { build(:cluster, domain: 'http://not.a.valid.hostname') }
it 'should add an error on domain' do it 'adds an error on domain' do
expect(subject).not_to be_valid expect(subject).not_to be_valid
expect(subject.errors[:domain].first).to eq('contains invalid characters (valid characters: [a-z0-9\\-])') expect(subject.errors[:domain].first).to eq('contains invalid characters (valid characters: [a-z0-9\\-])')
end end
...@@ -599,7 +599,7 @@ describe Clusters::Cluster do ...@@ -599,7 +599,7 @@ describe Clusters::Cluster do
stub_application_setting(auto_devops_domain: 'global_domain.com') stub_application_setting(auto_devops_domain: 'global_domain.com')
end end
it 'should include KUBE_INGRESS_BASE_DOMAIN' do it 'includes KUBE_INGRESS_BASE_DOMAIN' do
expect(subject.to_hash).to include(KUBE_INGRESS_BASE_DOMAIN: 'global_domain.com') expect(subject.to_hash).to include(KUBE_INGRESS_BASE_DOMAIN: 'global_domain.com')
end end
end end
...@@ -607,7 +607,7 @@ describe Clusters::Cluster do ...@@ -607,7 +607,7 @@ describe Clusters::Cluster do
context 'with a cluster domain' do context 'with a cluster domain' do
let(:cluster) { create(:cluster, :provided_by_gcp, domain: 'example.com') } let(:cluster) { create(:cluster, :provided_by_gcp, domain: 'example.com') }
it 'should include KUBE_INGRESS_BASE_DOMAIN' do it 'includes KUBE_INGRESS_BASE_DOMAIN' do
expect(subject.to_hash).to include(KUBE_INGRESS_BASE_DOMAIN: 'example.com') expect(subject.to_hash).to include(KUBE_INGRESS_BASE_DOMAIN: 'example.com')
end end
end end
...@@ -615,7 +615,7 @@ describe Clusters::Cluster do ...@@ -615,7 +615,7 @@ describe Clusters::Cluster do
context 'with no domain' do context 'with no domain' do
let(:cluster) { create(:cluster, :provided_by_gcp, :project) } let(:cluster) { create(:cluster, :provided_by_gcp, :project) }
it 'should return an empty array' do it 'returns an empty array' do
expect(subject.to_hash).to be_empty expect(subject.to_hash).to be_empty
end end
end end
......
...@@ -60,7 +60,7 @@ RSpec.describe Clusters::KubernetesNamespace, type: :model do ...@@ -60,7 +60,7 @@ RSpec.describe Clusters::KubernetesNamespace, type: :model do
context 'when platform has a namespace assigned' do context 'when platform has a namespace assigned' do
let(:namespace) { 'platform-namespace' } let(:namespace) { 'platform-namespace' }
it 'should copy the namespace' do it 'copies the namespace' do
subject subject
expect(kubernetes_namespace.namespace).to eq('platform-namespace') expect(kubernetes_namespace.namespace).to eq('platform-namespace')
...@@ -72,7 +72,7 @@ RSpec.describe Clusters::KubernetesNamespace, type: :model do ...@@ -72,7 +72,7 @@ RSpec.describe Clusters::KubernetesNamespace, type: :model do
let(:namespace) { nil } let(:namespace) { nil }
let(:project_slug) { "#{project.path}-#{project.id}" } let(:project_slug) { "#{project.path}-#{project.id}" }
it 'should fallback to project namespace' do it 'fallbacks to project namespace' do
subject subject
expect(kubernetes_namespace.namespace).to eq(project_slug) expect(kubernetes_namespace.namespace).to eq(project_slug)
...@@ -83,7 +83,7 @@ RSpec.describe Clusters::KubernetesNamespace, type: :model do ...@@ -83,7 +83,7 @@ RSpec.describe Clusters::KubernetesNamespace, type: :model do
describe '#service_account_name' do describe '#service_account_name' do
let(:service_account_name) { "#{kubernetes_namespace.namespace}-service-account" } let(:service_account_name) { "#{kubernetes_namespace.namespace}-service-account" }
it 'should set a service account name based on namespace' do it 'sets a service account name based on namespace' do
subject subject
expect(kubernetes_namespace.service_account_name).to eq(service_account_name) expect(kubernetes_namespace.service_account_name).to eq(service_account_name)
......
...@@ -447,7 +447,7 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching ...@@ -447,7 +447,7 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
let(:platform) { cluster.platform } let(:platform) { cluster.platform }
context 'when namespace is updated' do context 'when namespace is updated' do
it 'should call ConfigureWorker' do it 'calls ConfigureWorker' do
expect(ClusterConfigureWorker).to receive(:perform_async).with(cluster.id).once expect(ClusterConfigureWorker).to receive(:perform_async).with(cluster.id).once
platform.namespace = 'new-namespace' platform.namespace = 'new-namespace'
...@@ -456,7 +456,7 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching ...@@ -456,7 +456,7 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
end end
context 'when namespace is not updated' do context 'when namespace is not updated' do
it 'should not call ConfigureWorker' do it 'does not call ConfigureWorker' do
expect(ClusterConfigureWorker).not_to receive(:perform_async) expect(ClusterConfigureWorker).not_to receive(:perform_async)
platform.username = "new-username" platform.username = "new-username"
......
...@@ -659,7 +659,7 @@ describe Issuable do ...@@ -659,7 +659,7 @@ describe Issuable do
end end
context 'adding time' do context 'adding time' do
it 'should update the total time spent' do it 'updates the total time spent' do
spend_time(1800) spend_time(1800)
expect(issue.total_time_spent).to eq(1800) expect(issue.total_time_spent).to eq(1800)
...@@ -679,7 +679,7 @@ describe Issuable do ...@@ -679,7 +679,7 @@ describe Issuable do
spend_time(1800) spend_time(1800)
end end
it 'should update the total time spent' do it 'updates the total time spent' do
spend_time(-900) spend_time(-900)
expect(issue.total_time_spent).to eq(900) expect(issue.total_time_spent).to eq(900)
......
...@@ -12,7 +12,7 @@ describe Spammable do ...@@ -12,7 +12,7 @@ describe Spammable do
end end
describe 'ClassMethods' do describe 'ClassMethods' do
it 'should return correct attr_spammable' do it 'returns correct attr_spammable' do
expect(issue.spammable_text).to eq("#{issue.title}\n#{issue.description}") expect(issue.spammable_text).to eq("#{issue.title}\n#{issue.description}")
end end
end end
...@@ -20,7 +20,7 @@ describe Spammable do ...@@ -20,7 +20,7 @@ describe Spammable do
describe 'InstanceMethods' do describe 'InstanceMethods' do
let(:issue) { build(:issue, spam: true) } let(:issue) { build(:issue, spam: true) }
it 'should be invalid if spam' do it 'is invalid if spam' do
expect(issue.valid?).to be_falsey expect(issue.valid?).to be_falsey
end end
......
...@@ -9,7 +9,7 @@ describe DeployToken do ...@@ -9,7 +9,7 @@ describe DeployToken do
it { is_expected.to have_many(:projects).through(:project_deploy_tokens) } it { is_expected.to have_many(:projects).through(:project_deploy_tokens) }
describe '#ensure_token' do describe '#ensure_token' do
it 'should ensure a token' do it 'ensures a token' do
deploy_token.token = nil deploy_token.token = nil
deploy_token.save deploy_token.save
...@@ -19,13 +19,13 @@ describe DeployToken do ...@@ -19,13 +19,13 @@ describe DeployToken do
describe '#ensure_at_least_one_scope' do describe '#ensure_at_least_one_scope' do
context 'with at least one scope' do context 'with at least one scope' do
it 'should be valid' do it 'is valid' do
is_expected.to be_valid is_expected.to be_valid
end end
end end
context 'with no scopes' do context 'with no scopes' do
it 'should be invalid' do it 'is invalid' do
deploy_token = build(:deploy_token, read_repository: false, read_registry: false) deploy_token = build(:deploy_token, read_repository: false, read_registry: false)
expect(deploy_token).not_to be_valid expect(deploy_token).not_to be_valid
...@@ -36,13 +36,13 @@ describe DeployToken do ...@@ -36,13 +36,13 @@ describe DeployToken do
describe '#scopes' do describe '#scopes' do
context 'with all the scopes' do context 'with all the scopes' do
it 'should return scopes assigned to DeployToken' do it 'returns scopes assigned to DeployToken' do
expect(deploy_token.scopes).to eq([:read_repository, :read_registry]) expect(deploy_token.scopes).to eq([:read_repository, :read_registry])
end end
end end
context 'with only one scope' do context 'with only one scope' do
it 'should return scopes assigned to DeployToken' do it 'returns scopes assigned to DeployToken' do
deploy_token = create(:deploy_token, read_registry: false) deploy_token = create(:deploy_token, read_registry: false)
expect(deploy_token.scopes).to eq([:read_repository]) expect(deploy_token.scopes).to eq([:read_repository])
end end
...@@ -50,7 +50,7 @@ describe DeployToken do ...@@ -50,7 +50,7 @@ describe DeployToken do
end end
describe '#revoke!' do describe '#revoke!' do
it 'should update revoke attribute' do it 'updates revoke attribute' do
deploy_token.revoke! deploy_token.revoke!
expect(deploy_token.revoked?).to be_truthy expect(deploy_token.revoked?).to be_truthy
end end
...@@ -58,20 +58,20 @@ describe DeployToken do ...@@ -58,20 +58,20 @@ describe DeployToken do
describe "#active?" do describe "#active?" do
context "when it has been revoked" do context "when it has been revoked" do
it 'should return false' do it 'returns false' do
deploy_token.revoke! deploy_token.revoke!
expect(deploy_token.active?).to be_falsy expect(deploy_token.active?).to be_falsy
end end
end end
context "when it hasn't been revoked and is not expired" do context "when it hasn't been revoked and is not expired" do
it 'should return true' do it 'returns true' do
expect(deploy_token.active?).to be_truthy expect(deploy_token.active?).to be_truthy
end end
end end
context "when it hasn't been revoked and is expired" do context "when it hasn't been revoked and is expired" do
it 'should return true' do it 'returns true' do
deploy_token.update_attribute(:expires_at, Date.today - 5.days) deploy_token.update_attribute(:expires_at, Date.today - 5.days)
expect(deploy_token.active?).to be_falsy expect(deploy_token.active?).to be_falsy
end end
...@@ -80,7 +80,7 @@ describe DeployToken do ...@@ -80,7 +80,7 @@ describe DeployToken do
context "when it hasn't been revoked and has no expiry" do context "when it hasn't been revoked and has no expiry" do
let(:deploy_token) { create(:deploy_token, expires_at: nil) } let(:deploy_token) { create(:deploy_token, expires_at: nil) }
it 'should return true' do it 'returns true' do
expect(deploy_token.active?).to be_truthy expect(deploy_token.active?).to be_truthy
end end
end end
...@@ -126,7 +126,7 @@ describe DeployToken do ...@@ -126,7 +126,7 @@ describe DeployToken do
context 'when using Forever.date' do context 'when using Forever.date' do
let(:deploy_token) { create(:deploy_token, expires_at: nil) } let(:deploy_token) { create(:deploy_token, expires_at: nil) }
it 'should return nil' do it 'returns nil' do
expect(deploy_token.expires_at).to be_nil expect(deploy_token.expires_at).to be_nil
end end
end end
...@@ -135,7 +135,7 @@ describe DeployToken do ...@@ -135,7 +135,7 @@ describe DeployToken do
let(:expires_at) { Date.today + 5.months } let(:expires_at) { Date.today + 5.months }
let(:deploy_token) { create(:deploy_token, expires_at: expires_at) } let(:deploy_token) { create(:deploy_token, expires_at: expires_at) }
it 'should return the personalized date' do it 'returns the personalized date' do
expect(deploy_token.expires_at).to eq(expires_at) expect(deploy_token.expires_at).to eq(expires_at)
end end
end end
...@@ -145,7 +145,7 @@ describe DeployToken do ...@@ -145,7 +145,7 @@ describe DeployToken do
context 'when passing nil' do context 'when passing nil' do
let(:deploy_token) { create(:deploy_token, expires_at: nil) } let(:deploy_token) { create(:deploy_token, expires_at: nil) }
it 'should assign Forever.date' do it 'assigns Forever.date' do
expect(deploy_token.read_attribute(:expires_at)).to eq(Forever.date) expect(deploy_token.read_attribute(:expires_at)).to eq(Forever.date)
end end
end end
...@@ -154,7 +154,7 @@ describe DeployToken do ...@@ -154,7 +154,7 @@ describe DeployToken do
let(:expires_at) { Date.today + 5.months } let(:expires_at) { Date.today + 5.months }
let(:deploy_token) { create(:deploy_token, expires_at: expires_at) } let(:deploy_token) { create(:deploy_token, expires_at: expires_at) }
it 'should respect the value' do it 'respects the value' do
expect(deploy_token.read_attribute(:expires_at)).to eq(expires_at) expect(deploy_token.read_attribute(:expires_at)).to eq(expires_at)
end end
end end
...@@ -166,14 +166,14 @@ describe DeployToken do ...@@ -166,14 +166,14 @@ describe DeployToken do
subject { project.deploy_tokens.gitlab_deploy_token } subject { project.deploy_tokens.gitlab_deploy_token }
context 'with a gitlab deploy token associated' do context 'with a gitlab deploy token associated' do
it 'should return the gitlab deploy token' do it 'returns the gitlab deploy token' do
deploy_token = create(:deploy_token, :gitlab_deploy_token, projects: [project]) deploy_token = create(:deploy_token, :gitlab_deploy_token, projects: [project])
is_expected.to eq(deploy_token) is_expected.to eq(deploy_token)
end end
end end
context 'with no gitlab deploy token associated' do context 'with no gitlab deploy token associated' do
it 'should return nil' do it 'returns nil' do
is_expected.to be_nil is_expected.to be_nil
end end
end end
......
...@@ -788,14 +788,14 @@ describe Group do ...@@ -788,14 +788,14 @@ describe Group do
describe '#has_parent?' do describe '#has_parent?' do
context 'when the group has a parent' do context 'when the group has a parent' do
it 'should be truthy' do it 'is truthy' do
group = create(:group, :nested) group = create(:group, :nested)
expect(group.has_parent?).to be_truthy expect(group.has_parent?).to be_truthy
end end
end end
context 'when the group has no parent' do context 'when the group has no parent' do
it 'should be falsy' do it 'is falsy' do
group = create(:group, parent: nil) group = create(:group, parent: nil)
expect(group.has_parent?).to be_falsy expect(group.has_parent?).to be_falsy
end end
......
...@@ -740,14 +740,14 @@ describe Namespace do ...@@ -740,14 +740,14 @@ describe Namespace do
describe '#full_path_was' do describe '#full_path_was' do
context 'when the group has no parent' do context 'when the group has no parent' do
it 'should return the path was' do it 'returns the path was' do
group = create(:group, parent: nil) group = create(:group, parent: nil)
expect(group.full_path_was).to eq(group.path_was) expect(group.full_path_was).to eq(group.path_was)
end end
end end
context 'when a parent is assigned to a group with no previous parent' do context 'when a parent is assigned to a group with no previous parent' do
it 'should return the path was' do it 'returns the path was' do
group = create(:group, parent: nil) group = create(:group, parent: nil)
parent = create(:group) parent = create(:group)
...@@ -758,7 +758,7 @@ describe Namespace do ...@@ -758,7 +758,7 @@ describe Namespace do
end end
context 'when a parent is removed from the group' do context 'when a parent is removed from the group' do
it 'should return the parent full path' do it 'returns the parent full path' do
parent = create(:group) parent = create(:group)
group = create(:group, parent: parent) group = create(:group, parent: parent)
group.parent = nil group.parent = nil
...@@ -768,7 +768,7 @@ describe Namespace do ...@@ -768,7 +768,7 @@ describe Namespace do
end end
context 'when changing parents' do context 'when changing parents' do
it 'should return the previous parent full path' do it 'returns the previous parent full path' do
parent = create(:group) parent = create(:group)
group = create(:group, parent: parent) group = create(:group, parent: parent)
new_parent = create(:group) new_parent = create(:group)
......
...@@ -22,7 +22,7 @@ describe Network::Graph do ...@@ -22,7 +22,7 @@ describe Network::Graph do
expect(commits).to all( be_kind_of(Network::Commit) ) expect(commits).to all( be_kind_of(Network::Commit) )
end end
it 'it the commits by commit date (descending)' do it 'sorts commits by commit date (descending)' do
# Remove duplicate timestamps because they make it harder to # Remove duplicate timestamps because they make it harder to
# assert that the commits are sorted as expected. # assert that the commits are sorted as expected.
commits = graph.commits.uniq(&:date) commits = graph.commits.uniq(&:date)
......
...@@ -117,7 +117,7 @@ describe ProjectAutoDevops do ...@@ -117,7 +117,7 @@ describe ProjectAutoDevops do
context 'when the project is public' do context 'when the project is public' do
let(:project) { create(:project, :repository, :public) } let(:project) { create(:project, :repository, :public) }
it 'should not create a gitlab deploy token' do it 'does not create a gitlab deploy token' do
expect do expect do
auto_devops.save auto_devops.save
end.not_to change { DeployToken.count } end.not_to change { DeployToken.count }
...@@ -127,7 +127,7 @@ describe ProjectAutoDevops do ...@@ -127,7 +127,7 @@ describe ProjectAutoDevops do
context 'when the project is internal' do context 'when the project is internal' do
let(:project) { create(:project, :repository, :internal) } let(:project) { create(:project, :repository, :internal) }
it 'should create a gitlab deploy token' do it 'creates a gitlab deploy token' do
expect do expect do
auto_devops.save auto_devops.save
end.to change { DeployToken.count }.by(1) end.to change { DeployToken.count }.by(1)
...@@ -137,7 +137,7 @@ describe ProjectAutoDevops do ...@@ -137,7 +137,7 @@ describe ProjectAutoDevops do
context 'when the project is private' do context 'when the project is private' do
let(:project) { create(:project, :repository, :private) } let(:project) { create(:project, :repository, :private) }
it 'should create a gitlab deploy token' do it 'creates a gitlab deploy token' do
expect do expect do
auto_devops.save auto_devops.save
end.to change { DeployToken.count }.by(1) end.to change { DeployToken.count }.by(1)
...@@ -148,7 +148,7 @@ describe ProjectAutoDevops do ...@@ -148,7 +148,7 @@ describe ProjectAutoDevops do
let(:project) { create(:project, :repository, :internal) } let(:project) { create(:project, :repository, :internal) }
let(:auto_devops) { build(:project_auto_devops, project: project) } let(:auto_devops) { build(:project_auto_devops, project: project) }
it 'should create a deploy token' do it 'creates a deploy token' do
expect do expect do
auto_devops.save auto_devops.save
end.to change { DeployToken.count }.by(1) end.to change { DeployToken.count }.by(1)
...@@ -159,7 +159,7 @@ describe ProjectAutoDevops do ...@@ -159,7 +159,7 @@ describe ProjectAutoDevops do
let(:project) { create(:project, :repository, :internal) } let(:project) { create(:project, :repository, :internal) }
let(:auto_devops) { build(:project_auto_devops, enabled: nil, project: project) } let(:auto_devops) { build(:project_auto_devops, enabled: nil, project: project) }
it 'should create a deploy token' do it 'creates a deploy token' do
allow(Gitlab::CurrentSettings).to receive(:auto_devops_enabled?).and_return(true) allow(Gitlab::CurrentSettings).to receive(:auto_devops_enabled?).and_return(true)
expect do expect do
...@@ -172,7 +172,7 @@ describe ProjectAutoDevops do ...@@ -172,7 +172,7 @@ describe ProjectAutoDevops do
let(:project) { create(:project, :repository, :internal) } let(:project) { create(:project, :repository, :internal) }
let(:auto_devops) { build(:project_auto_devops, :disabled, project: project) } let(:auto_devops) { build(:project_auto_devops, :disabled, project: project) }
it 'should not create a deploy token' do it 'does not create a deploy token' do
expect do expect do
auto_devops.save auto_devops.save
end.not_to change { DeployToken.count } end.not_to change { DeployToken.count }
...@@ -184,7 +184,7 @@ describe ProjectAutoDevops do ...@@ -184,7 +184,7 @@ describe ProjectAutoDevops do
let!(:deploy_token) { create(:deploy_token, :gitlab_deploy_token, projects: [project]) } let!(:deploy_token) { create(:deploy_token, :gitlab_deploy_token, projects: [project]) }
let(:auto_devops) { build(:project_auto_devops, project: project) } let(:auto_devops) { build(:project_auto_devops, project: project) }
it 'should not create a deploy token' do it 'does not create a deploy token' do
expect do expect do
auto_devops.save auto_devops.save
end.not_to change { DeployToken.count } end.not_to change { DeployToken.count }
...@@ -196,7 +196,7 @@ describe ProjectAutoDevops do ...@@ -196,7 +196,7 @@ describe ProjectAutoDevops do
let!(:deploy_token) { create(:deploy_token, :gitlab_deploy_token, :expired, projects: [project]) } let!(:deploy_token) { create(:deploy_token, :gitlab_deploy_token, :expired, projects: [project]) }
let(:auto_devops) { build(:project_auto_devops, project: project) } let(:auto_devops) { build(:project_auto_devops, project: project) }
it 'should not create a deploy token' do it 'does not create a deploy token' do
expect do expect do
auto_devops.save auto_devops.save
end.not_to change { DeployToken.count } end.not_to change { DeployToken.count }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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