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:
authorTimothy Andrew <mail@timothyandrew.net>2017-02-06 15:07:05 +0300
committerTimothy Andrew <mail@timothyandrew.net>2017-02-24 14:20:20 +0300
commit8e684809765fa866a125c176327825ebc565f5b3 (patch)
tree2086025a88fbdefbb355061eaf468e1db593adc9 /spec/models/user_spec.rb
parent53c34c7436112d7cac9c3887ada1d5ae630a206c (diff)
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/user_spec.rb')
-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