aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/user_spec.rb
diff options
context:
space:
mode:
authorGareth Rees <gareth@mysociety.org>2015-02-18 13:27:19 +0000
committerGareth Rees <gareth@mysociety.org>2015-02-24 13:23:17 +0000
commitae648fc4ff414eb33ef17744d4434a0e4a43e606 (patch)
tree8753c498c676e84e57660c836cb0e7305006d032 /spec/models/user_spec.rb
parentf7974a3c5243279f9a739a7d84174af953b38434 (diff)
Add User#banned?
- Redefined User#public_banned? to User#banned? - Add specs for User#banned? - Deprecate User#public_banned? - Replace use of User#public_banned? with User#banned?
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r--spec/models/user_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 7dcd3ab8a..2245a024f 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -369,3 +369,21 @@ describe User, "when calculating if a user has exceeded the request limit" do
end
+
+describe User do
+
+ describe :banned? do
+
+ it 'is banned if the user has ban_text' do
+ user = FactoryGirl.build(:user, :ban_text => 'banned')
+ expect(user).to be_banned
+ end
+
+ it 'is not banned if the user has no ban_text' do
+ user = FactoryGirl.build(:user, :ban_text => '')
+ expect(user).to_not be_banned
+ end
+
+ end
+
+end