Skip to content
Snippets Groups Projects
Commit 31040b5b authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 185f428f
No related branches found
No related tags found
No related merge requests found
Showing
with 375 additions and 115 deletions
# frozen_string_literal: true
module QA
module Support
module Dates
def current_date_yyyy_mm_dd
current_date.strftime("%Y/%m/%d")
end
def next_month_yyyy_mm_dd
current_date.next_month.strftime("%Y/%m/%d")
end
private
def current_date
DateTime.now
end
end
end
end
Loading
Loading
@@ -24,11 +24,12 @@ describe HealthController do
it 'responds with readiness checks data' do
subject
 
expect(json_response['db_check']['status']).to eq('ok')
expect(json_response['cache_check']['status']).to eq('ok')
expect(json_response['queues_check']['status']).to eq('ok')
expect(json_response['shared_state_check']['status']).to eq('ok')
expect(json_response['gitaly_check']['status']).to eq('ok')
expect(json_response['db_check']).to contain_exactly({ 'status' => 'ok' })
expect(json_response['cache_check']).to contain_exactly({ 'status' => 'ok' })
expect(json_response['queues_check']).to contain_exactly({ 'status' => 'ok' })
expect(json_response['shared_state_check']).to contain_exactly({ 'status' => 'ok' })
expect(json_response['gitaly_check']).to contain_exactly(
{ 'status' => 'ok', 'labels' => { 'shard' => 'default' } })
end
 
it 'responds with readiness checks data when a failure happens' do
Loading
Loading
@@ -37,9 +38,9 @@ describe HealthController do
 
subject
 
expect(json_response['redis_check']['status']).to eq('failed')
expect(json_response['redis_check']['message']).to eq('check error')
expect(json_response['cache_check']['status']).to eq('ok')
expect(json_response['cache_check']).to contain_exactly({ 'status' => 'ok' })
expect(json_response['redis_check']).to contain_exactly(
{ 'status' => 'failed', 'message' => 'check error' })
 
expect(response.status).to eq(503)
expect(response.headers['X-GitLab-Custom-Error']).to eq(1)
Loading
Loading
@@ -90,7 +91,7 @@ describe HealthController do
it 'responds with liveness checks data' do
subject
 
expect(json_response['status']).to eq('ok')
expect(json_response).to eq('status' => 'ok')
end
end
 
Loading
Loading
Loading
Loading
@@ -2,7 +2,7 @@
 
require 'spec_helper'
 
describe 'Signup' do
shared_examples 'Signup' do
include TermsHelper
 
before do
Loading
Loading
@@ -13,8 +13,7 @@ describe 'Signup' do
 
describe 'username validation', :js do
before do
visit root_path
click_link 'Register'
visit new_user_registration_path
end
 
it 'does not show an error border if the username is available' do
Loading
Loading
@@ -130,8 +129,7 @@ describe 'Signup' do
 
describe 'user\'s full name validation', :js do
before do
visit root_path
click_link 'Register'
visit new_user_registration_path
end
 
it 'does not show an error border if the user\'s fullname length is not longer than 128 characters' do
Loading
Loading
@@ -177,13 +175,17 @@ describe 'Signup' do
end
 
it 'creates the user account and sends a confirmation email' do
visit root_path
visit new_user_registration_path
 
fill_in 'new_user_name', with: new_user.name
fill_in 'new_user_username', with: new_user.username
fill_in 'new_user_email', with: new_user.email
fill_in 'new_user_email_confirmation', with: new_user.email
fill_in 'new_user_password', with: new_user.password
fill_in 'new_user_name', with: new_user.name
fill_in 'new_user_username', with: new_user.username
fill_in 'new_user_email', with: new_user.email
unless Feature.enabled?(:experimental_separate_sign_up_flow)
fill_in 'new_user_email_confirmation', with: new_user.email
end
fill_in 'new_user_password', with: new_user.password
 
expect { click_button 'Register' }.to change { User.count }.by(1)
 
Loading
Loading
@@ -198,13 +200,17 @@ describe 'Signup' do
end
 
it 'creates the user account and sends a confirmation email' do
visit root_path
visit new_user_registration_path
fill_in 'new_user_name', with: new_user.name
fill_in 'new_user_username', with: new_user.username
fill_in 'new_user_email', with: new_user.email
unless Feature.enabled?(:experimental_separate_sign_up_flow)
fill_in 'new_user_email_confirmation', with: new_user.email
end
 
fill_in 'new_user_name', with: new_user.name
fill_in 'new_user_username', with: new_user.username
fill_in 'new_user_email', with: new_user.email
fill_in 'new_user_email_confirmation', with: new_user.email
fill_in 'new_user_password', with: new_user.password
fill_in 'new_user_password', with: new_user.password
 
expect { click_button 'Register' }.to change { User.count }.by(1)
 
Loading
Loading
@@ -216,13 +222,17 @@ describe 'Signup' do
 
context "when sigining up with different cased emails" do
it "creates the user successfully" do
visit root_path
visit new_user_registration_path
 
fill_in 'new_user_name', with: new_user.name
fill_in 'new_user_username', with: new_user.username
fill_in 'new_user_email', with: new_user.email
fill_in 'new_user_email_confirmation', with: new_user.email.capitalize
fill_in 'new_user_password', with: new_user.password
fill_in 'new_user_name', with: new_user.name
fill_in 'new_user_username', with: new_user.username
fill_in 'new_user_email', with: new_user.email
unless Feature.enabled?(:experimental_separate_sign_up_flow)
fill_in 'new_user_email_confirmation', with: new_user.email.capitalize
end
fill_in 'new_user_password', with: new_user.password
click_button "Register"
 
expect(current_path).to eq dashboard_projects_path
Loading
Loading
@@ -236,13 +246,17 @@ describe 'Signup' do
end
 
it 'creates the user account and goes to dashboard' do
visit root_path
visit new_user_registration_path
fill_in 'new_user_name', with: new_user.name
fill_in 'new_user_username', with: new_user.username
fill_in 'new_user_email', with: new_user.email
 
fill_in 'new_user_name', with: new_user.name
fill_in 'new_user_username', with: new_user.username
fill_in 'new_user_email', with: new_user.email
fill_in 'new_user_email_confirmation', with: new_user.email
fill_in 'new_user_password', with: new_user.password
unless Feature.enabled?(:experimental_separate_sign_up_flow)
fill_in 'new_user_email_confirmation', with: new_user.email
end
fill_in 'new_user_password', with: new_user.password
click_button "Register"
 
expect(current_path).to eq dashboard_projects_path
Loading
Loading
@@ -255,28 +269,34 @@ describe 'Signup' do
it "displays the errors" do
existing_user = create(:user)
 
visit root_path
visit new_user_registration_path
 
fill_in 'new_user_name', with: new_user.name
fill_in 'new_user_name', with: new_user.name
fill_in 'new_user_username', with: new_user.username
fill_in 'new_user_email', with: existing_user.email
fill_in 'new_user_email', with: existing_user.email
fill_in 'new_user_password', with: new_user.password
click_button "Register"
 
expect(current_path).to eq user_registration_path
expect(page).to have_content("errors prohibited this user from being saved")
expect(page).to have_content("Email has already been taken")
expect(page).to have_content("Email confirmation doesn't match")
if Feature.enabled?(:experimental_separate_sign_up_flow)
expect(page).to have_content("error prohibited this user from being saved")
expect(page).to have_content("Email has already been taken")
else
expect(page).to have_content("errors prohibited this user from being saved")
expect(page).to have_content("Email has already been taken")
expect(page).to have_content("Email confirmation doesn't match")
end
end
 
it 'does not redisplay the password' do
existing_user = create(:user)
 
visit root_path
visit new_user_registration_path
 
fill_in 'new_user_name', with: new_user.name
fill_in 'new_user_name', with: new_user.name
fill_in 'new_user_username', with: new_user.username
fill_in 'new_user_email', with: existing_user.email
fill_in 'new_user_email', with: existing_user.email
fill_in 'new_user_password', with: new_user.password
click_button "Register"
 
Loading
Loading
@@ -291,13 +311,17 @@ describe 'Signup' do
end
 
it 'requires the user to check the checkbox' do
visit root_path
visit new_user_registration_path
fill_in 'new_user_name', with: new_user.name
fill_in 'new_user_username', with: new_user.username
fill_in 'new_user_email', with: new_user.email
unless Feature.enabled?(:experimental_separate_sign_up_flow)
fill_in 'new_user_email_confirmation', with: new_user.email
end
 
fill_in 'new_user_name', with: new_user.name
fill_in 'new_user_username', with: new_user.username
fill_in 'new_user_email', with: new_user.email
fill_in 'new_user_email_confirmation', with: new_user.email
fill_in 'new_user_password', with: new_user.password
fill_in 'new_user_password', with: new_user.password
 
click_button 'Register'
 
Loading
Loading
@@ -306,13 +330,17 @@ describe 'Signup' do
end
 
it 'asks the user to accept terms before going to the dashboard' do
visit root_path
visit new_user_registration_path
fill_in 'new_user_name', with: new_user.name
fill_in 'new_user_username', with: new_user.username
fill_in 'new_user_email', with: new_user.email
unless Feature.enabled?(:experimental_separate_sign_up_flow)
fill_in 'new_user_email_confirmation', with: new_user.email
end
 
fill_in 'new_user_name', with: new_user.name
fill_in 'new_user_username', with: new_user.username
fill_in 'new_user_email', with: new_user.email
fill_in 'new_user_email_confirmation', with: new_user.email
fill_in 'new_user_password', with: new_user.password
fill_in 'new_user_password', with: new_user.password
check :terms_opt_in
 
click_button "Register"
Loading
Loading
@@ -321,3 +349,20 @@ describe 'Signup' do
end
end
end
describe 'With original flow' do
it_behaves_like 'Signup' do
before do
stub_feature_flags(experimental_separate_sign_up_flow: false)
end
end
end
describe 'With experimental flow on GitLab.com' do
it_behaves_like 'Signup' do
before do
expect(Gitlab).to receive(:com?).and_return(true).at_least(:once)
stub_feature_flags(experimental_separate_sign_up_flow: true)
end
end
end
# frozen_string_literal: true
require 'spec_helper'
describe Gitlab::HealthChecks::Probes::Liveness do
let(:liveness) { described_class.new }
describe '#call' do
subject { liveness.execute }
it 'responds with liveness checks data' do
expect(subject.http_status).to eq(200)
expect(subject.json[:status]).to eq('ok')
end
end
end
# frozen_string_literal: true
require 'spec_helper'
describe Gitlab::HealthChecks::Probes::Readiness do
let(:readiness) { described_class.new }
describe '#call' do
subject { readiness.execute }
it 'responds with readiness checks data' do
expect(subject.http_status).to eq(200)
expect(subject.json[:status]).to eq('ok')
expect(subject.json['db_check']).to contain_exactly(status: 'ok')
expect(subject.json['cache_check']).to contain_exactly(status: 'ok')
expect(subject.json['queues_check']).to contain_exactly(status: 'ok')
expect(subject.json['shared_state_check']).to contain_exactly(status: 'ok')
expect(subject.json['gitaly_check']).to contain_exactly(
status: 'ok', labels: { shard: 'default' })
end
context 'when Redis fails' do
before do
allow(Gitlab::HealthChecks::Redis::RedisCheck).to receive(:readiness).and_return(
Gitlab::HealthChecks::Result.new('redis_check', false, "check error"))
end
it 'responds with failure' do
expect(subject.http_status).to eq(503)
expect(subject.json[:status]).to eq('failed')
expect(subject.json['cache_check']).to contain_exactly(status: 'ok')
expect(subject.json['redis_check']).to contain_exactly(
status: 'failed', message: 'check error')
end
end
end
end
Loading
Loading
@@ -4,35 +4,42 @@ require 'spec_helper'
 
describe Gitlab::Metrics::Exporter::BaseExporter do
let(:exporter) { described_class.new }
let(:server) { double('server') }
let(:socket) { double('socket') }
let(:log_filename) { File.join(Rails.root, 'log', 'sidekiq_exporter.log') }
let(:settings) { double('settings') }
 
before do
allow(::WEBrick::HTTPServer).to receive(:new).and_return(server)
allow(server).to receive(:mount)
allow(server).to receive(:start)
allow(server).to receive(:shutdown)
allow(server).to receive(:listeners) { [socket] }
allow(socket).to receive(:close)
allow_any_instance_of(described_class).to receive(:log_filename).and_return(log_filename)
allow_any_instance_of(described_class).to receive(:settings).and_return(settings)
end
 
describe 'when exporter is enabled' do
before do
allow(::WEBrick::HTTPServer).to receive(:new).with(
Port: anything,
BindAddress: anything,
Logger: anything,
AccessLog: anything
).and_wrap_original do |m, *args|
m.call(DoNotListen: true, Logger: args.first[:Logger])
end
allow_any_instance_of(::WEBrick::HTTPServer).to receive(:start)
allow(settings).to receive(:enabled).and_return(true)
allow(settings).to receive(:port).and_return(3707)
allow(settings).to receive(:port).and_return(8082)
allow(settings).to receive(:address).and_return('localhost')
end
 
after do
exporter.stop
end
describe 'when exporter is stopped' do
describe '#start' do
it 'starts the exporter' do
expect { exporter.start.join }.to change { exporter.thread? }.from(false).to(true)
expect_any_instance_of(::WEBrick::HTTPServer).to receive(:start)
 
expect(server).to have_received(:start)
expect { exporter.start.join }.to change { exporter.thread? }.from(false).to(true)
end
 
describe 'with custom settings' do
Loading
Loading
@@ -45,23 +52,25 @@ describe Gitlab::Metrics::Exporter::BaseExporter do
end
 
it 'starts server with port and address from settings' do
exporter.start.join
expect(::WEBrick::HTTPServer).to have_received(:new).with(
expect(::WEBrick::HTTPServer).to receive(:new).with(
Port: port,
BindAddress: address,
Logger: anything,
AccessLog: anything
)
).and_wrap_original do |m, *args|
m.call(DoNotListen: true, Logger: args.first[:Logger])
end
exporter.start.join
end
end
end
 
describe '#stop' do
it "doesn't shutdown stopped server" do
expect { exporter.stop }.not_to change { exporter.thread? }
expect_any_instance_of(::WEBrick::HTTPServer).not_to receive(:shutdown)
 
expect(server).not_to have_received(:shutdown)
expect { exporter.stop }.not_to change { exporter.thread? }
end
end
end
Loading
Loading
@@ -73,20 +82,66 @@ describe Gitlab::Metrics::Exporter::BaseExporter do
 
describe '#start' do
it "doesn't start running server" do
expect { exporter.start.join }.not_to change { exporter.thread? }
expect_any_instance_of(::WEBrick::HTTPServer).not_to receive(:start)
 
expect(server).to have_received(:start).once
expect { exporter.start.join }.not_to change { exporter.thread? }
end
end
 
describe '#stop' do
it 'shutdowns server' do
expect_any_instance_of(::WEBrick::HTTPServer).to receive(:shutdown)
expect { exporter.stop }.to change { exporter.thread? }.from(true).to(false)
end
end
end
end
describe 'request handling' do
using RSpec::Parameterized::TableSyntax
 
expect(socket).to have_received(:close)
expect(server).to have_received(:shutdown)
where(:method_class, :path, :http_status) do
Net::HTTP::Get | '/metrics' | 200
Net::HTTP::Get | '/liveness' | 200
Net::HTTP::Get | '/readiness' | 200
Net::HTTP::Get | '/' | 404
end
before do
allow(settings).to receive(:enabled).and_return(true)
allow(settings).to receive(:port).and_return(0)
allow(settings).to receive(:address).and_return('127.0.0.1')
# We want to wrap original method
# and run handling of requests
# in separate thread
allow_any_instance_of(::WEBrick::HTTPServer)
.to receive(:start).and_wrap_original do |m, *args|
Thread.new do
m.call(*args)
rescue IOError
# is raised as we close listeners
end
end
exporter.start.join
end
after do
exporter.stop
end
with_them do
let(:config) { exporter.server.config }
let(:request) { method_class.new(path) }
it 'responds with proper http_status' do
http = Net::HTTP.new(config[:BindAddress], config[:Port])
response = http.request(request)
expect(response.code).to eq(http_status.to_s)
end
end
end
 
Loading
Loading
@@ -97,18 +152,18 @@ describe Gitlab::Metrics::Exporter::BaseExporter do
 
describe '#start' do
it "doesn't start" do
expect_any_instance_of(::WEBrick::HTTPServer).not_to receive(:start)
expect(exporter.start).to be_nil
expect { exporter.start }.not_to change { exporter.thread? }
expect(server).not_to have_received(:start)
end
end
 
describe '#stop' do
it "doesn't shutdown" do
expect { exporter.stop }.not_to change { exporter.thread? }
expect_any_instance_of(::WEBrick::HTTPServer).not_to receive(:shutdown)
 
expect(server).not_to have_received(:shutdown)
expect { exporter.stop }.not_to change { exporter.thread? }
end
end
end
Loading
Loading
Loading
Loading
@@ -880,22 +880,6 @@ describe Group do
end
end
 
describe '#has_parent?' do
context 'when the group has a parent' do
it 'is truthy' do
group = create(:group, :nested)
expect(group.has_parent?).to be_truthy
end
end
context 'when the group has no parent' do
it 'is falsy' do
group = create(:group, parent: nil)
expect(group.has_parent?).to be_falsy
end
end
end
context 'with uploads' do
it_behaves_like 'model with uploads', true do
let(:model_object) { create(:group, :with_avatar) }
Loading
Loading
Loading
Loading
@@ -933,4 +933,25 @@ describe Namespace do
end
end
end
describe '#has_parent?' do
it 'returns true when the group has a parent' do
group = create(:group, :nested)
expect(group.has_parent?).to be_truthy
end
it 'returns true when the group has an unsaved parent' do
parent = build(:group)
group = build(:group, parent: parent)
expect(group.has_parent?).to be_truthy
end
it 'returns false when the group has no parent' do
group = create(:group, parent: nil)
expect(group.has_parent?).to be_falsy
end
end
end
Loading
Loading
@@ -41,7 +41,7 @@ describe BugzillaService do
{ project_url: url, issues_url: url, new_issue_url: url }
end
 
# this will be removed as part of https://gitlab.com/gitlab-org/gitlab-foss/issues/63084
# this will be removed as part of https://gitlab.com/gitlab-org/gitlab/issues/29404
context 'when data are stored in properties' do
let(:properties) { access_params.merge(title: title, description: description) }
let(:service) do
Loading
Loading
Loading
Loading
@@ -55,7 +55,7 @@ describe CustomIssueTrackerService do
{ project_url: url, issues_url: url, new_issue_url: url }
end
 
# this will be removed as part of https://gitlab.com/gitlab-org/gitlab-foss/issues/63084
# this will be removed as part of https://gitlab.com/gitlab-org/gitlab/issues/29404
context 'when data are stored in properties' do
let(:properties) { access_params.merge(title: title, description: description) }
let(:service) do
Loading
Loading
Loading
Loading
@@ -58,7 +58,7 @@ describe GitlabIssueTrackerService do
{ project_url: url, issues_url: url, new_issue_url: url }
end
 
# this will be removed as part of https://gitlab.com/gitlab-org/gitlab-foss/issues/63084
# this will be removed as part of https://gitlab.com/gitlab-org/gitlab/issues/29404
context 'when data are stored in properties' do
let(:properties) { access_params.merge(title: title, description: description) }
let(:service) do
Loading
Loading
Loading
Loading
@@ -278,7 +278,7 @@ describe JiraService do
end
end
 
# this will be removed as part of https://gitlab.com/gitlab-org/gitlab-foss/issues/63084
# this will be removed as part of https://gitlab.com/gitlab-org/gitlab/issues/29404
context 'when data are stored in properties' do
let(:properties) { data_params.merge(title: title, description: description) }
let!(:service) do
Loading
Loading
Loading
Loading
@@ -57,7 +57,7 @@ describe RedmineService do
{ project_url: url, issues_url: url, new_issue_url: url }
end
 
# this will be removed as part of https://gitlab.com/gitlab-org/gitlab-foss/issues/63084
# this will be removed as part of https://gitlab.com/gitlab-org/gitlab/issues/29404
context 'when data are stored in properties' do
let(:properties) { access_params.merge(title: title, description: description) }
let(:service) do
Loading
Loading
Loading
Loading
@@ -45,7 +45,7 @@ describe YoutrackService do
{ project_url: url, issues_url: url, new_issue_url: url }
end
 
# this will be removed as part of https://gitlab.com/gitlab-org/gitlab-foss/issues/63084
# this will be removed as part of https://gitlab.com/gitlab-org/gitlab/issues/29404
context 'when data are stored in properties' do
let(:properties) { access_params.merge(title: title, description: description) }
let(:service) do
Loading
Loading
Loading
Loading
@@ -121,7 +121,7 @@ describe Service do
end
end
 
# this will be removed as part of https://gitlab.com/gitlab-org/gitlab-foss/issues/63084
# this will be removed as part of https://gitlab.com/gitlab-org/gitlab/issues/29404
context 'when data are stored in properties' do
let(:properties) { data_params.merge(title: title, description: description) }
let!(:template) do
Loading
Loading
require 'spec_helper'
 
describe API::Groups do
include GroupAPIHelpers
include UploadHelpers
 
let(:user1) { create(:user, can_create_group: false) }
Loading
Loading
@@ -350,6 +351,13 @@ describe API::Groups do
expect(json_response['description']).to eq(group1.description)
expect(json_response['visibility']).to eq(Gitlab::VisibilityLevel.string_level(group1.visibility_level))
expect(json_response['avatar_url']).to eq(group1.avatar_url(only_path: false))
expect(json_response['share_with_group_lock']).to eq(group1.share_with_group_lock)
expect(json_response['require_two_factor_authentication']).to eq(group1.require_two_factor_authentication)
expect(json_response['two_factor_grace_period']).to eq(group1.two_factor_grace_period)
expect(json_response['auto_devops_enabled']).to eq(group1.auto_devops_enabled)
expect(json_response['emails_disabled']).to eq(group1.emails_disabled)
expect(json_response['project_creation_level']).to eq('maintainer')
expect(json_response['subgroup_creation_level']).to eq('maintainer')
expect(json_response['web_url']).to eq(group1.web_url)
expect(json_response['request_access_enabled']).to eq(group1.request_access_enabled)
expect(json_response['full_name']).to eq(group1.full_name)
Loading
Loading
@@ -485,11 +493,30 @@ describe API::Groups do
 
context 'when authenticated as the group owner' do
it 'updates the group' do
put api("/groups/#{group1.id}", user1), params: { name: new_group_name, request_access_enabled: true }
put api("/groups/#{group1.id}", user1), params: {
name: new_group_name,
request_access_enabled: true,
project_creation_level: "noone",
subgroup_creation_level: "maintainer"
}
 
expect(response).to have_gitlab_http_status(200)
expect(json_response['name']).to eq(new_group_name)
expect(json_response['description']).to eq('')
expect(json_response['visibility']).to eq('public')
expect(json_response['share_with_group_lock']).to eq(false)
expect(json_response['require_two_factor_authentication']).to eq(false)
expect(json_response['two_factor_grace_period']).to eq(48)
expect(json_response['auto_devops_enabled']).to eq(nil)
expect(json_response['emails_disabled']).to eq(nil)
expect(json_response['project_creation_level']).to eq("noone")
expect(json_response['subgroup_creation_level']).to eq("maintainer")
expect(json_response['request_access_enabled']).to eq(true)
expect(json_response['parent_id']).to eq(nil)
expect(json_response['projects']).to be_an Array
expect(json_response['projects'].length).to eq(2)
expect(json_response['shared_projects']).to be_an Array
expect(json_response['shared_projects'].length).to eq(0)
end
 
it 'returns 404 for a non existing group' do
Loading
Loading
@@ -864,7 +891,9 @@ describe API::Groups do
describe "POST /groups" do
context "when authenticated as user without group permissions" do
it "does not create group" do
post api("/groups", user1), params: attributes_for(:group)
group = attributes_for_group_api
post api("/groups", user1), params: group
 
expect(response).to have_gitlab_http_status(403)
end
Loading
Loading
@@ -896,7 +925,7 @@ describe API::Groups do
 
context "when authenticated as user with group permissions" do
it "creates group" do
group = attributes_for(:group, { request_access_enabled: false })
group = attributes_for_group_api request_access_enabled: false
 
post api("/groups", user3), params: group
 
Loading
Loading
@@ -911,7 +940,7 @@ describe API::Groups do
it "creates a nested group" do
parent = create(:group)
parent.add_owner(user3)
group = attributes_for(:group, { parent_id: parent.id })
group = attributes_for_group_api parent_id: parent.id
 
post api("/groups", user3), params: group
 
Loading
Loading
Loading
Loading
@@ -634,10 +634,47 @@ describe API::Users do
end
 
describe "GET /users/sign_up" do
it "redirects to sign in page" do
get "/users/sign_up"
expect(response).to have_gitlab_http_status(302)
expect(response).to redirect_to(new_user_session_path)
context 'when experimental_separate_sign_up_flow is active' do
before do
stub_feature_flags(experimental_separate_sign_up_flow: true)
end
context 'on gitlab.com' do
before do
allow(::Gitlab).to receive(:com?).and_return(true)
end
it "shows sign up page" do
get "/users/sign_up"
expect(response).to have_gitlab_http_status(200)
expect(response).to render_template(:new)
end
end
context 'not on gitlab.com' do
before do
allow(::Gitlab).to receive(:com?).and_return(false)
end
it "redirects to sign in page" do
get "/users/sign_up"
expect(response).to have_gitlab_http_status(302)
expect(response).to redirect_to(new_user_session_path(anchor: 'register-pane'))
end
end
end
context 'when experimental_separate_sign_up_flow is not active' do
before do
allow(::Gitlab).to receive(:com?).and_return(true)
stub_feature_flags(experimental_separate_sign_up_flow: false)
end
it "redirects to sign in page" do
get "/users/sign_up"
expect(response).to have_gitlab_http_status(302)
expect(response).to redirect_to(new_user_session_path(anchor: 'register-pane'))
end
end
end
 
Loading
Loading
# frozen_string_literal: true
module GroupAPIHelpers
extend self
def attributes_for_group_api(params = {})
# project_creation_level and subgroup_creation_level are Integers in the model
# but are strings in the API
attributes_for(:group, params).except(:project_creation_level, :subgroup_creation_level)
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment