diff options
author | Boyan Tabakov <boyan.tabakov@futurice.com> | 2015-02-20 14:50:44 +0200 |
---|---|---|
committer | Boyan Tabakov <boyan.tabakov@futurice.com> | 2015-04-22 08:03:38 +0300 |
commit | e5b32f3c20834e593e853e285a71d0e1bbaff500 (patch) | |
tree | 85caeb97e5d20fc6e5481fee13332b32761eea1e | |
parent | 56404451082d11ce937ee4f0a1964581f17750ef (diff) | |
download | gitlab-ce-e5b32f3c20834e593e853e285a71d0e1bbaff500.tar.gz |
Fix user API tests succeeding for the wrong reason
The requests were missing multiple required attributes, while testing for single attribute missing.
Added test for checking username as required attribute.
-rw-r--r-- | spec/requests/api/users_spec.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index 081400cdedd..a0acc4d9c11 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -110,17 +110,22 @@ describe API::API, api: true do end it 'should return 400 error if name not given' do - post api('/users', admin), email: 'test@example.com', password: 'pass1234' + post api('/users', admin), attributes_for(:user).except(:name) expect(response.status).to eq(400) end it 'should return 400 error if password not given' do - post api('/users', admin), email: 'test@example.com', name: 'test' + post api('/users', admin), attributes_for(:user).except(:password) expect(response.status).to eq(400) end - it "should return 400 error if email not given" do - post api('/users', admin), password: 'pass1234', name: 'test' + it 'should return 400 error if email not given' do + post api('/users', admin), attributes_for(:user).except(:email) + expect(response.status).to eq(400) + end + + it 'should return 400 error if username not given' do + post api('/users', admin), attributes_for(:user).except(:username) expect(response.status).to eq(400) end |