Commit 20bc9e99 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Adjust EE specs to rely on Namespace#path

In most cases (building urls) we need to rely on the `Namespace#path`
instead of the `Namespace#name`.
parent a7c31766
...@@ -21,7 +21,7 @@ describe 'Reset namespace pipeline minutes' do ...@@ -21,7 +21,7 @@ describe 'Reset namespace pipeline minutes' do
end end
expect(page).to have_selector('.flash-notice') expect(page).to have_selector('.flash-notice')
expect(current_path).to include(namespace.name) expect(current_path).to include(namespace.path)
expect(namespace.namespace_statistics.reload.shared_runners_seconds).to eq(0) expect(namespace.namespace_statistics.reload.shared_runners_seconds).to eq(0)
expect(namespace.namespace_statistics.reload.shared_runners_seconds_last_reset).to be_like_time(time) expect(namespace.namespace_statistics.reload.shared_runners_seconds_last_reset).to be_like_time(time)
...@@ -38,7 +38,7 @@ describe 'Reset namespace pipeline minutes' do ...@@ -38,7 +38,7 @@ describe 'Reset namespace pipeline minutes' do
it 'renders edit page with an error' do it 'renders edit page with an error' do
click_link 'Reset pipeline minutes' click_link 'Reset pipeline minutes'
expect(current_path).to include(namespace.name) expect(current_path).to include(namespace.path)
expect(page).to have_selector('.flash-error') expect(page).to have_selector('.flash-error')
end end
end end
...@@ -57,15 +57,15 @@ describe 'Reset namespace pipeline minutes' do ...@@ -57,15 +57,15 @@ describe 'Reset namespace pipeline minutes' do
expect(page).to have_link('Reset pipeline minutes', href: reset_runners_minutes_admin_user_path(user)) expect(page).to have_link('Reset pipeline minutes', href: reset_runners_minutes_admin_user_path(user))
end end
include_examples "resetting pipeline minutes" include_examples 'resetting pipeline minutes'
include_examples "rendering error" include_examples 'rendering error'
end end
describe 'when creating a new group' do describe 'when creating a new group' do
before do before do
visit admin_groups_path visit admin_groups_path
page.within '#content-body' do page.within '#content-body' do
click_link "New group" click_link 'New group'
end end
end end
...@@ -87,7 +87,7 @@ describe 'Reset namespace pipeline minutes' do ...@@ -87,7 +87,7 @@ describe 'Reset namespace pipeline minutes' do
expect(page).to have_link('Reset pipeline minutes', href: admin_group_reset_runners_minutes_path(group)) expect(page).to have_link('Reset pipeline minutes', href: admin_group_reset_runners_minutes_path(group))
end end
include_examples "resetting pipeline minutes" include_examples 'resetting pipeline minutes'
include_examples "rendering error" include_examples 'rendering error'
end end
end end
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe 'Admin updates EE-only settings' do describe 'Admin updates EE-only settings' do
...@@ -21,7 +23,7 @@ describe 'Admin updates EE-only settings' do ...@@ -21,7 +23,7 @@ describe 'Admin updates EE-only settings' do
expect(current_settings.geo_status_timeout).to eq(15) expect(current_settings.geo_status_timeout).to eq(15)
expect(current_settings.geo_node_allowed_ips).to eq('192.34.34.34') expect(current_settings.geo_node_allowed_ips).to eq('192.34.34.34')
expect(page).to have_content "Application settings saved successfully" expect(page).to have_content 'Application settings saved successfully'
end end
end end
...@@ -31,7 +33,7 @@ describe 'Admin updates EE-only settings' do ...@@ -31,7 +33,7 @@ describe 'Admin updates EE-only settings' do
visit geo_admin_application_settings_path visit geo_admin_application_settings_path
expect(page).to have_content "Discover GitLab Geo" expect(page).to have_content 'Discover GitLab Geo'
end end
end end
end end
...@@ -44,7 +46,7 @@ describe 'Admin updates EE-only settings' do ...@@ -44,7 +46,7 @@ describe 'Admin updates EE-only settings' do
click_button 'Save changes' click_button 'Save changes'
end end
expect(page).to have_content "Application settings saved successfully" expect(page).to have_content 'Application settings saved successfully'
end end
context 'Elasticsearch settings' do context 'Elasticsearch settings' do
...@@ -67,7 +69,7 @@ describe 'Admin updates EE-only settings' do ...@@ -67,7 +69,7 @@ describe 'Admin updates EE-only settings' do
expect(current_settings.elasticsearch_search).to be_truthy expect(current_settings.elasticsearch_search).to be_truthy
expect(current_settings.elasticsearch_shards).to eq(120) expect(current_settings.elasticsearch_shards).to eq(120)
expect(current_settings.elasticsearch_replicas).to eq(2) expect(current_settings.elasticsearch_replicas).to eq(2)
expect(page).to have_content "Application settings saved successfully" expect(page).to have_content 'Application settings saved successfully'
end end
end end
...@@ -114,7 +116,7 @@ describe 'Admin updates EE-only settings' do ...@@ -114,7 +116,7 @@ describe 'Admin updates EE-only settings' do
expect(current_settings.elasticsearch_limit_indexing).to be_truthy expect(current_settings.elasticsearch_limit_indexing).to be_truthy
expect(ElasticsearchIndexedNamespace.exists?(namespace_id: namespace.id)).to be_truthy expect(ElasticsearchIndexedNamespace.exists?(namespace_id: namespace.id)).to be_truthy
expect(ElasticsearchIndexedProject.exists?(project_id: project.id)).to be_truthy expect(ElasticsearchIndexedProject.exists?(project_id: project.id)).to be_truthy
expect(page).to have_content "Application settings saved successfully" expect(page).to have_content 'Application settings saved successfully'
end end
it 'Allows removing all namespaces and projects', :js do it 'Allows removing all namespaces and projects', :js do
...@@ -131,13 +133,13 @@ describe 'Admin updates EE-only settings' do ...@@ -131,13 +133,13 @@ describe 'Admin updates EE-only settings' do
page.within('.as-elasticsearch') do page.within('.as-elasticsearch') do
expect(page).to have_content('Namespaces to index') expect(page).to have_content('Namespaces to index')
expect(page).to have_content('Projects to index') expect(page).to have_content('Projects to index')
expect(page).to have_content(namespace.full_path) expect(page).to have_content(namespace.full_name)
expect(page).to have_content(project.full_name) expect(page).to have_content(project.full_name)
find('.js-limit-namespaces .select2-search-choice-close').click find('.js-limit-namespaces .select2-search-choice-close').click
find('.js-limit-projects .select2-search-choice-close').click find('.js-limit-projects .select2-search-choice-close').click
expect(page).not_to have_content(namespace.full_path) expect(page).not_to have_content(namespace.full_name)
expect(page).not_to have_content(project.full_name) expect(page).not_to have_content(project.full_name)
click_button 'Save changes' click_button 'Save changes'
...@@ -145,7 +147,7 @@ describe 'Admin updates EE-only settings' do ...@@ -145,7 +147,7 @@ describe 'Admin updates EE-only settings' do
expect(ElasticsearchIndexedNamespace.count).to eq(0) expect(ElasticsearchIndexedNamespace.count).to eq(0)
expect(ElasticsearchIndexedProject.count).to eq(0) expect(ElasticsearchIndexedProject.count).to eq(0)
expect(page).to have_content "Application settings saved successfully" expect(page).to have_content 'Application settings saved successfully'
end end
end end
...@@ -159,7 +161,7 @@ describe 'Admin updates EE-only settings' do ...@@ -159,7 +161,7 @@ describe 'Admin updates EE-only settings' do
click_button 'Save changes' click_button 'Save changes'
end end
expect(page).to have_content "Application settings saved successfully" expect(page).to have_content 'Application settings saved successfully'
end end
context 'Templates page' do context 'Templates page' do
...@@ -169,13 +171,13 @@ describe 'Admin updates EE-only settings' do ...@@ -169,13 +171,13 @@ describe 'Admin updates EE-only settings' do
it 'Render "Templates" section' do it 'Render "Templates" section' do
page.within('.as-visibility-access') do page.within('.as-visibility-access') do
expect(page).to have_content "Templates" expect(page).to have_content 'Templates'
end end
end end
it 'Render "Custom project templates" section' do it 'Render "Custom project templates" section' do
page.within('.as-custom-project-templates') do page.within('.as-custom-project-templates') do
expect(page).to have_content "Custom project templates" expect(page).to have_content 'Custom project templates'
end end
end end
end end
......
...@@ -109,7 +109,7 @@ describe API::V3::Github do ...@@ -109,7 +109,7 @@ describe API::V3::Github do
end end
it 'returns an empty Array for events' do it 'returns an empty Array for events' do
jira_get v3_api("/repos/-/jira/events", user) jira_get v3_api('/repos/-/jira/events', user)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
expect(json_response).to eq([]) expect(json_response).to eq([])
...@@ -278,7 +278,7 @@ describe API::V3::Github do ...@@ -278,7 +278,7 @@ describe API::V3::Github do
raise "Project #{project.full_path} not present in response" if hash.nil? raise "Project #{project.full_path} not present in response" if hash.nil?
expect(hash['owner']['login']).to eq(namespace.name) expect(hash['owner']['login']).to eq(namespace.path)
end end
expect(json_response.size).to eq(projects.size) expect(json_response.size).to eq(projects.size)
end end
...@@ -351,7 +351,7 @@ describe API::V3::Github do ...@@ -351,7 +351,7 @@ describe API::V3::Github do
context 'unauthenticated' do context 'unauthenticated' do
it 'returns 401' do it 'returns 401' do
jira_get v3_api("/users/foo/repos", nil) jira_get v3_api('/users/foo/repos', nil)
expect(response).to have_gitlab_http_status(401) expect(response).to have_gitlab_http_status(401)
end end
...@@ -374,7 +374,7 @@ describe API::V3::Github do ...@@ -374,7 +374,7 @@ describe API::V3::Github do
it 'responds with not found status' do it 'responds with not found status' do
stub_licensed_features(jira_dev_panel_integration: true) stub_licensed_features(jira_dev_panel_integration: true)
jira_get v3_api("/users/noo/repos", user) jira_get v3_api('/users/noo/repos', user)
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(404)
end end
......
require "spec_helper" require 'spec_helper'
describe "routes to the proper webhooks controller", type: :routing do describe 'routes to the proper webhooks controller', type: :routing do
context 'with a project context' do context 'with a project context' do
let(:project) { create(:project) } let(:project) { create(:project) }
let(:project_hook) { create(:project_hook) } let(:project_hook) { create(:project_hook) }
it "routes the test action" do it 'routes the test action' do
expect( expect(
post: polymorphic_path([project.namespace.becomes(Namespace), project, project_hook], action: :test) post: polymorphic_path([project.namespace.becomes(Namespace), project, project_hook], action: :test)
).to route_to(controller: 'projects/hooks', ).to route_to(controller: 'projects/hooks',
action: 'test', action: 'test',
namespace_id: project.namespace.name, namespace_id: project.namespace.path,
project_id: project.path, project_id: project.path,
id: project_hook.id.to_s) id: project_hook.id.to_s)
end end
it "routes a single record" do it 'routes a single record' do
expect( expect(
delete: polymorphic_path([project.namespace.becomes(Namespace), project, project_hook]) delete: polymorphic_path([project.namespace.becomes(Namespace), project, project_hook])
).to route_to(controller: 'projects/hooks', ).to route_to(controller: 'projects/hooks',
action: 'destroy', action: 'destroy',
namespace_id: project.namespace.name, namespace_id: project.namespace.path,
project_id: project.path, project_id: project.path,
id: project_hook.id.to_s) id: project_hook.id.to_s)
end end
...@@ -30,16 +30,16 @@ describe "routes to the proper webhooks controller", type: :routing do ...@@ -30,16 +30,16 @@ describe "routes to the proper webhooks controller", type: :routing do
let(:group) { create(:group, name: 'gitlab') } let(:group) { create(:group, name: 'gitlab') }
let(:group_hook) { create(:group_hook) } let(:group_hook) { create(:group_hook) }
it "routes the test action" do it 'routes the test action' do
expect( expect(
post: polymorphic_path([group, group_hook], action: :test) post: polymorphic_path([group, group_hook], action: :test)
).to route_to(controller: 'groups/hooks', ).to route_to(controller: 'groups/hooks',
action: 'test', action: 'test',
group_id: group.name, group_id: group.path,
id: group_hook.id.to_s) id: group_hook.id.to_s)
end end
it "routes a single record" do it 'routes a single record' do
expect( expect(
delete: polymorphic_path([group, group_hook]) delete: polymorphic_path([group, group_hook])
).to route_to(controller: 'groups/hooks', ).to route_to(controller: 'groups/hooks',
......
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