Commit e0e88cddd805a1aa5f467dcea826c24a64187df0

Authored by Dmitriy Zaporozhets
1 parent 90dc5ff5

Fix tests

spec/models/user_spec.rb
@@ -209,6 +209,7 @@ describe User do @@ -209,6 +209,7 @@ describe User do
209 209
210 describe 'without defaults' do 210 describe 'without defaults' do
211 let(:user) { User.new } 211 let(:user) { User.new }
  212 +
212 it "should not apply defaults to user" do 213 it "should not apply defaults to user" do
213 user.projects_limit.should == 10 214 user.projects_limit.should == 10
214 user.can_create_group.should be_true 215 user.can_create_group.should be_true
@@ -218,19 +219,21 @@ describe User do @@ -218,19 +219,21 @@ describe User do
218 context 'as admin' do 219 context 'as admin' do
219 describe 'with defaults' do 220 describe 'with defaults' do
220 let(:user) { User.build_user({}, as: :admin) } 221 let(:user) { User.build_user({}, as: :admin) }
  222 +
221 it "should apply defaults to user" do 223 it "should apply defaults to user" do
222 user.projects_limit.should == 42 224 user.projects_limit.should == 42
223 user.can_create_group.should be_false 225 user.can_create_group.should be_false
224 - user.theme_id.should == Gitlab::Theme::BASIC 226 + user.theme_id.should == Gitlab::Theme::MARS
225 end 227 end
226 end 228 end
227 229
228 describe 'with default overrides' do 230 describe 'with default overrides' do
229 - let(:user) { User.build_user({projects_limit: 123, can_create_group: true, can_create_team: true, theme_id: Gitlab::Theme::MARS}, as: :admin) } 231 + let(:user) { User.build_user({projects_limit: 123, can_create_group: true, can_create_team: true, theme_id: Gitlab::Theme::BASIC}, as: :admin) }
  232 +
230 it "should apply defaults to user" do 233 it "should apply defaults to user" do
231 user.projects_limit.should == 123 234 user.projects_limit.should == 123
232 user.can_create_group.should be_true 235 user.can_create_group.should be_true
233 - user.theme_id.should == Gitlab::Theme::MARS 236 + user.theme_id.should == Gitlab::Theme::BASIC
234 end 237 end
235 end 238 end
236 end 239 end
@@ -238,26 +241,29 @@ describe User do @@ -238,26 +241,29 @@ describe User do
238 context 'as user' do 241 context 'as user' do
239 describe 'with defaults' do 242 describe 'with defaults' do
240 let(:user) { User.build_user } 243 let(:user) { User.build_user }
  244 +
241 it "should apply defaults to user" do 245 it "should apply defaults to user" do
242 user.projects_limit.should == 42 246 user.projects_limit.should == 42
243 user.can_create_group.should be_false 247 user.can_create_group.should be_false
244 - user.theme_id.should == Gitlab::Theme::BASIC 248 + user.theme_id.should == Gitlab::Theme::MARS
245 end 249 end
246 end 250 end
247 251
248 describe 'with default overrides' do 252 describe 'with default overrides' do
249 - let(:user) { User.build_user(projects_limit: 123, can_create_group: true, theme_id: Gitlab::Theme::MARS) } 253 + let(:user) { User.build_user(projects_limit: 123, can_create_group: true, theme_id: Gitlab::Theme::BASIC) }
  254 +
250 it "should apply defaults to user" do 255 it "should apply defaults to user" do
251 user.projects_limit.should == 42 256 user.projects_limit.should == 42
252 user.can_create_group.should be_false 257 user.can_create_group.should be_false
253 - user.theme_id.should == Gitlab::Theme::BASIC 258 + user.theme_id.should == Gitlab::Theme::MARS
254 end 259 end
255 end 260 end
256 end 261 end
257 end 262 end
258 263
259 describe 'by_username_or_id' do 264 describe 'by_username_or_id' do
260 - let(:user1){create(:user, username: 'foo')} 265 + let(:user1) { create(:user, username: 'foo') }
  266 +
261 it "should get the correct user" do 267 it "should get the correct user" do
262 User.by_username_or_id(user1.id).should == user1 268 User.by_username_or_id(user1.id).should == user1
263 User.by_username_or_id('foo').should == user1 269 User.by_username_or_id('foo').should == user1
spec/requests/api/users_spec.rb
@@ -66,7 +66,7 @@ describe API::API do @@ -66,7 +66,7 @@ describe API::API do
66 }.to change { User.count }.by(1) 66 }.to change { User.count }.by(1)
67 user = User.find_by_username(attr[:username]) 67 user = User.find_by_username(attr[:username])
68 user.projects_limit.should == limit 68 user.projects_limit.should == limit
69 - user.theme_id.should == Gitlab::Theme::BASIC 69 + user.theme_id.should == Gitlab::Theme::MARS
70 Gitlab.config.gitlab.unstub(:default_projects_limit) 70 Gitlab.config.gitlab.unstub(:default_projects_limit)
71 end 71 end
72 72