summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2017-02-06 17:37:05 +0530
committerTimothy Andrew <mail@timothyandrew.net>2017-02-24 16:50:20 +0530
commit8e684809765fa866a125c176327825ebc565f5b3 (patch)
tree2086025a88fbdefbb355061eaf468e1db593adc9 /spec/models
parent53c34c7436112d7cac9c3887ada1d5ae630a206c (diff)
downloadgitlab-ce-8e684809765fa866a125c176327825ebc565f5b3.tar.gz
Use a `ghost` boolean to track ghost users.
Rather than using a separate `ghost` state. This lets us have the benefits of both ghost and blocked users (ghost: true, state: blocked) without having to rewrite a number of queries to include cases for `state: ghost`.
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/user_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 861d338ef95..9e2b1c9290f 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -208,6 +208,20 @@ describe User, models: true do
end
end
end
+
+ describe 'ghost users' do
+ it 'does not allow a non-blocked ghost user' do
+ user = build(:user, :ghost, state: :active)
+
+ expect(user).to be_invalid
+ end
+
+ it 'allows a blocked ghost user' do
+ user = build(:user, :ghost, state: :blocked)
+
+ expect(user).to be_valid
+ end
+ end
end
describe "scopes" do