Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/application_controller_spec.rb')
-rw-r--r--spec/controllers/application_controller_spec.rb55
1 files changed, 19 insertions, 36 deletions
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb
index f8d4690e9ce..188a4cb04af 100644
--- a/spec/controllers/application_controller_spec.rb
+++ b/spec/controllers/application_controller_spec.rb
@@ -795,13 +795,8 @@ RSpec.describe ApplicationController do
end
let(:user) { create(:user) }
- let(:experiment_enabled) { true }
- before do
- stub_experiment_for_user(signup_flow: experiment_enabled)
- end
-
- context 'experiment enabled and user with required role' do
+ context 'user with required role' do
before do
user.set_role_required!
sign_in(user)
@@ -811,7 +806,7 @@ RSpec.describe ApplicationController do
it { is_expected.to redirect_to users_sign_up_welcome_path }
end
- context 'experiment enabled and user without a required role' do
+ context 'user without a required role' do
before do
sign_in(user)
get :index
@@ -819,43 +814,31 @@ RSpec.describe ApplicationController do
it { is_expected.not_to redirect_to users_sign_up_welcome_path }
end
+ end
- context 'experiment disabled' do
- let(:experiment_enabled) { false }
+ describe 'rescue_from Gitlab::Auth::IpBlacklisted' do
+ controller(described_class) do
+ skip_before_action :authenticate_user!
- before do
- user.set_role_required!
- sign_in(user)
- get :index
+ def index
+ raise Gitlab::Auth::IpBlacklisted
end
-
- it { is_expected.not_to redirect_to users_sign_up_welcome_path }
end
- describe 'rescue_from Gitlab::Auth::IpBlacklisted' do
- controller(described_class) do
- skip_before_action :authenticate_user!
-
- def index
- raise Gitlab::Auth::IpBlacklisted
- end
- end
-
- it 'returns a 403 and logs the request' do
- expect(Gitlab::AuthLogger).to receive(:error).with({
- message: 'Rack_Attack',
- env: :blocklist,
- remote_ip: '1.2.3.4',
- request_method: 'GET',
- path: '/anonymous'
- })
+ it 'returns a 403 and logs the request' do
+ expect(Gitlab::AuthLogger).to receive(:error).with({
+ message: 'Rack_Attack',
+ env: :blocklist,
+ remote_ip: '1.2.3.4',
+ request_method: 'GET',
+ path: '/anonymous'
+ })
- request.remote_addr = '1.2.3.4'
+ request.remote_addr = '1.2.3.4'
- get :index
+ get :index
- expect(response).to have_gitlab_http_status(:forbidden)
- end
+ expect(response).to have_gitlab_http_status(:forbidden)
end
end