Commit e0e88cddd805a1aa5f467dcea826c24a64187df0

Authored by Dmitriy Zaporozhets
1 parent 90dc5ff5

Fix tests

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