bellmyer-validates_blacklist 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,8 +42,12 @@ module Bellmyer
|
|
42
42
|
save_blacklist
|
43
43
|
end
|
44
44
|
|
45
|
-
def unblacklist
|
46
|
-
|
45
|
+
def unblacklist(attribute, value)
|
46
|
+
attribute = attribute.to_s
|
47
|
+
|
48
|
+
load_blacklist
|
49
|
+
self.blacklist_attributes[attribute].reject!{|a| a.is_a?(Array) ? a.first == value : a == value}
|
50
|
+
save_blacklist
|
47
51
|
end
|
48
52
|
|
49
53
|
def load_blacklist
|
@@ -247,4 +247,18 @@ class FriendUpdateableTest < Test::Unit::TestCase
|
|
247
247
|
list = FriendUpdateable.load_blacklist
|
248
248
|
assert_equal 1, list['name'].select{|node| node.is_a?(Array) ? node.first == 'Vanessa' : node == 'Vanessa'}.size
|
249
249
|
end
|
250
|
+
|
251
|
+
def test_should_remove_an_existing_blacklist_item
|
252
|
+
FriendUpdateable.unblacklist(:name, 'Vanessa')
|
253
|
+
|
254
|
+
friend = FriendUpdateable.new(:name => 'Vanessa')
|
255
|
+
assert friend.valid?
|
256
|
+
end
|
257
|
+
|
258
|
+
def test_should_ignore_removal_request_for_nonexisting_blacklist_item
|
259
|
+
FriendUpdateable.unblacklist(:name, 'Cookie Monster')
|
260
|
+
|
261
|
+
friend = FriendUpdateable.new(:name => 'Cookie Monster')
|
262
|
+
assert friend.valid?
|
263
|
+
end
|
250
264
|
end
|
data/validates_blacklist.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bellmyer-validates_blacklist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jaime Bellmyer
|
@@ -48,7 +48,6 @@ files:
|
|
48
48
|
- test/validates_blacklist_test.rb
|
49
49
|
has_rdoc: true
|
50
50
|
homepage: http://github.com/bellmyer/validates_blacklist
|
51
|
-
licenses:
|
52
51
|
post_install_message:
|
53
52
|
rdoc_options:
|
54
53
|
- --main
|
@@ -70,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
69
|
requirements: []
|
71
70
|
|
72
71
|
rubyforge_project:
|
73
|
-
rubygems_version: 1.
|
72
|
+
rubygems_version: 1.2.0
|
74
73
|
signing_key:
|
75
74
|
specification_version: 2
|
76
75
|
summary: Allows models to be validated against yaml-based blacklists
|