summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/models/user_spec.rb20
-rw-r--r--spec/requests/api/users_spec.rb2
2 files changed, 14 insertions, 8 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 330d22cf962..79915daa463 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -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
@@ -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
@@ -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
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb
index e42c0567ef6..2fced3ec945 100644
--- a/spec/requests/api/users_spec.rb
+++ b/spec/requests/api/users_spec.rb
@@ -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