summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-01-08 13:21:00 -0800
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-01-08 13:21:00 -0800
commit939c046a9872c1d7c38d73dc08860681ecebd1f1 (patch)
tree084daaaf574146379744ca61550752bceffa6578
parentd0a50985ec613584821806062df4eaa39337449c (diff)
downloadgitlab-ce-939c046a9872c1d7c38d73dc08860681ecebd1f1.tar.gz
Fix feature and tests
-rw-r--r--app/controllers/registrations_controller.rb2
-rw-r--r--spec/helpers/application_helper_spec.rb2
-rw-r--r--spec/models/application_setting_spec.rb4
-rw-r--r--spec/requests/api/users_spec.rb4
4 files changed, 5 insertions, 7 deletions
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb
index 981dc2d8023..52db44bf822 100644
--- a/app/controllers/registrations_controller.rb
+++ b/app/controllers/registrations_controller.rb
@@ -26,7 +26,7 @@ class RegistrationsController < Devise::RegistrationsController
private
def signup_enabled?
- if current_application_settings.signup_enabled?
+ unless current_application_settings.signup_enabled?
redirect_to(new_user_session_path)
end
end
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index 07dd33b211b..9cdbc846b19 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -87,7 +87,7 @@ describe ApplicationHelper do
let(:user_email) { 'user@email.com' }
it "should return a generic avatar path when Gravatar is disabled" do
- Gitlab.config.gravatar.stub(:enabled).and_return(false)
+ ApplicationSetting.any_instance.stub(gravatar_enabled?: false)
gravatar_icon(user_email).should match('no_avatar.png')
end
diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb
index 3a8d52c11c4..039775dddda 100644
--- a/spec/models/application_setting_spec.rb
+++ b/spec/models/application_setting_spec.rb
@@ -1,7 +1,5 @@
require 'spec_helper'
describe ApplicationSetting, models: true do
- describe 'should exists on start' do
- it { ApplicationSetting.count.should_not be_zero }
- end
+ it { ApplicationSetting.create_from_defaults.should be_valid }
end
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb
index 1ecc79ea7ef..dec488c6d00 100644
--- a/spec/requests/api/users_spec.rb
+++ b/spec/requests/api/users_spec.rb
@@ -186,7 +186,7 @@ describe API::API, api: true do
describe "GET /users/sign_up" do
context 'enabled' do
before do
- Gitlab.config.gitlab.stub(:signup_enabled).and_return(true)
+ ApplicationSetting.any_instance.stub(signup_enabled?: true)
end
it "should return sign up page if signup is enabled" do
@@ -197,7 +197,7 @@ describe API::API, api: true do
context 'disabled' do
before do
- Gitlab.config.gitlab.stub(:signup_enabled).and_return(false)
+ ApplicationSetting.any_instance.stub(signup_enabled?: false)
end
it "should redirect to sign in page if signup is disabled" do