bartzon-validates_blacklist 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -0,0 +1,60 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{bartzon-validates_blacklist}
8
+ s.version = "0.0.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Bart Zonneveld"]
12
+ s.date = %q{2010-02-19}
13
+ s.description = %q{Validate Rails models against a database table}
14
+ s.email = %q{loop@superinfinite.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "bartzon-validates_blacklist.gemspec",
27
+ "generators/blacklists/blacklists_generator.rb",
28
+ "generators/blacklists/templates/blacklists.rb",
29
+ "lib/validates_blacklist.rb",
30
+ "lib/validates_blacklist/blacklist.rb",
31
+ "lib/validates_blacklist/validates.rb",
32
+ "spec/spec.opts",
33
+ "spec/spec_helper.rb",
34
+ "spec/validates_blacklist_spec.rb",
35
+ "validates_blacklist.gemspec"
36
+ ]
37
+ s.homepage = %q{http://github.com/bartzon/validates_blacklist}
38
+ s.rdoc_options = ["--charset=UTF-8"]
39
+ s.require_paths = ["lib"]
40
+ s.rubygems_version = %q{1.3.5}
41
+ s.summary = %q{Validate Rails models against a database table}
42
+ s.test_files = [
43
+ "spec/spec_helper.rb",
44
+ "spec/validates_blacklist_spec.rb"
45
+ ]
46
+
47
+ if s.respond_to? :specification_version then
48
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
49
+ s.specification_version = 3
50
+
51
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
52
+ s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
53
+ else
54
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
55
+ end
56
+ else
57
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
58
+ end
59
+ end
60
+
@@ -20,7 +20,7 @@ module ValidatesBlacklist
20
20
 
21
21
  module ClassMethods
22
22
  def blacklisted?(value)
23
- blacklist.include?(value)
23
+ blacklist.include?(value.downcase)
24
24
  end
25
25
 
26
26
  def blacklist
@@ -29,7 +29,7 @@ module ValidatesBlacklist
29
29
  else
30
30
  list = ValidatesBlacklist::Blacklist.all
31
31
  end
32
- list.map(&:value)
32
+ list.map(&:value).map(&:downcase)
33
33
  end
34
34
  end
35
35
 
@@ -70,6 +70,13 @@ describe "ValidatesBlacklist" do
70
70
  user.errors.on(:name).should == 'is blacklisted'
71
71
  end
72
72
 
73
+ it "should not care about case of blacklist values" do
74
+ create_blacklist('superbad')
75
+ user = User.new(:name => 'SuperBAD')
76
+ user.should_not be_valid
77
+ user.errors.on(:name).should == 'is not allowed'
78
+ end
79
+
73
80
  it "should be valid if the blacklisted value has a different scope" do
74
81
  create_blacklist('scoped', 'Article')
75
82
  user = UserWithAllOptions.new(:name => 'scoped')
@@ -80,8 +87,8 @@ describe "ValidatesBlacklist" do
80
87
 
81
88
  describe "Class methods" do
82
89
  before(:each) do
83
- create_blacklist('bad')
84
- create_blacklist('a_scoped', 'Article')
90
+ create_blacklist('Bad')
91
+ create_blacklist('a_SCOPED', 'Article')
85
92
  create_blacklist('u_scoped', 'User')
86
93
  end
87
94
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bartzon-validates_blacklist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bart Zonneveld
@@ -38,6 +38,7 @@ files:
38
38
  - README.rdoc
39
39
  - Rakefile
40
40
  - VERSION
41
+ - bartzon-validates_blacklist.gemspec
41
42
  - generators/blacklists/blacklists_generator.rb
42
43
  - generators/blacklists/templates/blacklists.rb
43
44
  - lib/validates_blacklist.rb