Skip to content
Snippets Groups Projects
Commit 19aca1b3 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets Committed by Wes Gurney
Browse files

Fix tests

parent 53279d93
No related branches found
No related tags found
1 merge request!4954Add support to configure webhook_timeout in gitlab.yaml
Loading
Loading
@@ -209,6 +209,7 @@ describe User do
 
describe 'without defaults' do
let(:user) { User.new }
it "should not apply defaults to user" do
user.projects_limit.should == 10
user.can_create_group.should be_true
Loading
Loading
@@ -218,19 +219,21 @@ describe User do
context 'as admin' do
describe 'with defaults' do
let(:user) { User.build_user({}, as: :admin) }
it "should apply defaults to user" do
user.projects_limit.should == 42
user.can_create_group.should be_false
user.theme_id.should == Gitlab::Theme::BASIC
user.theme_id.should == Gitlab::Theme::MARS
end
end
 
describe 'with default overrides' do
let(:user) { User.build_user({projects_limit: 123, can_create_group: true, can_create_team: true, theme_id: Gitlab::Theme::MARS}, as: :admin) }
let(:user) { User.build_user({projects_limit: 123, can_create_group: true, can_create_team: true, theme_id: Gitlab::Theme::BASIC}, as: :admin) }
it "should apply defaults to user" do
user.projects_limit.should == 123
user.can_create_group.should be_true
user.theme_id.should == Gitlab::Theme::MARS
user.theme_id.should == Gitlab::Theme::BASIC
end
end
end
Loading
Loading
@@ -238,26 +241,29 @@ describe User do
context 'as user' do
describe 'with defaults' do
let(:user) { User.build_user }
it "should apply defaults to user" do
user.projects_limit.should == 42
user.can_create_group.should be_false
user.theme_id.should == Gitlab::Theme::BASIC
user.theme_id.should == Gitlab::Theme::MARS
end
end
 
describe 'with default overrides' do
let(:user) { User.build_user(projects_limit: 123, can_create_group: true, theme_id: Gitlab::Theme::MARS) }
let(:user) { User.build_user(projects_limit: 123, can_create_group: true, theme_id: Gitlab::Theme::BASIC) }
it "should apply defaults to user" do
user.projects_limit.should == 42
user.can_create_group.should be_false
user.theme_id.should == Gitlab::Theme::BASIC
user.theme_id.should == Gitlab::Theme::MARS
end
end
end
end
 
describe 'by_username_or_id' do
let(:user1){create(:user, username: 'foo')}
let(:user1) { create(:user, username: 'foo') }
it "should get the correct user" do
User.by_username_or_id(user1.id).should == user1
User.by_username_or_id('foo').should == user1
Loading
Loading
Loading
Loading
@@ -66,7 +66,7 @@ describe API::API do
}.to change { User.count }.by(1)
user = User.find_by_username(attr[:username])
user.projects_limit.should == limit
user.theme_id.should == Gitlab::Theme::BASIC
user.theme_id.should == Gitlab::Theme::MARS
Gitlab.config.gitlab.unstub(:default_projects_limit)
end
 
Loading
Loading
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