Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNihad Abbasov <narkoz.2008@gmail.com>2015-04-22 14:55:27 +0300
committerNihad Abbasov <narkoz.2008@gmail.com>2015-04-22 14:55:27 +0300
commitc3f2de68b53eb9207ea458d8ada36f99219795d4 (patch)
tree490f7b8b2291aec0b2bbde21cef506f368c7ac47 /spec/requests/api/users_spec.rb
parent8d9c7305cde484f216ca9926b48b29a63b463275 (diff)
parente5b32f3c20834e593e853e285a71d0e1bbaff500 (diff)
Merge pull request #8831 from bladealslayer/fix/api-user-tests
Fix user API tests succeeding for the wrong reason
Diffstat (limited to 'spec/requests/api/users_spec.rb')
-rw-r--r--spec/requests/api/users_spec.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb
index e6d5545f812..327f3e6d23c 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