Commit 939c046a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix feature and tests

parent d0a50985
...@@ -26,7 +26,7 @@ class RegistrationsController < Devise::RegistrationsController ...@@ -26,7 +26,7 @@ class RegistrationsController < Devise::RegistrationsController
private private
def signup_enabled? def signup_enabled?
if current_application_settings.signup_enabled? unless current_application_settings.signup_enabled?
redirect_to(new_user_session_path) redirect_to(new_user_session_path)
end end
end end
......
...@@ -87,7 +87,7 @@ describe ApplicationHelper do ...@@ -87,7 +87,7 @@ describe ApplicationHelper do
let(:user_email) { 'user@email.com' } let(:user_email) { 'user@email.com' }
it "should return a generic avatar path when Gravatar is disabled" do 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') gravatar_icon(user_email).should match('no_avatar.png')
end end
......
require 'spec_helper' require 'spec_helper'
describe ApplicationSetting, models: true do describe ApplicationSetting, models: true do
describe 'should exists on start' do it { ApplicationSetting.create_from_defaults.should be_valid }
it { ApplicationSetting.count.should_not be_zero }
end
end end
...@@ -186,7 +186,7 @@ describe API::API, api: true do ...@@ -186,7 +186,7 @@ describe API::API, api: true do
describe "GET /users/sign_up" do describe "GET /users/sign_up" do
context 'enabled' do context 'enabled' do
before do before do
Gitlab.config.gitlab.stub(:signup_enabled).and_return(true) ApplicationSetting.any_instance.stub(signup_enabled?: true)
end end
it "should return sign up page if signup is enabled" do it "should return sign up page if signup is enabled" do
...@@ -197,7 +197,7 @@ describe API::API, api: true do ...@@ -197,7 +197,7 @@ describe API::API, api: true do
context 'disabled' do context 'disabled' do
before do before do
Gitlab.config.gitlab.stub(:signup_enabled).and_return(false) ApplicationSetting.any_instance.stub(signup_enabled?: false)
end end
it "should redirect to sign in page if signup is disabled" do it "should redirect to sign in page if signup is disabled" do
......
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