validator_attachment 0.3.0 → 1.0.0

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.
data/CHANGELOG CHANGED
@@ -1,4 +1,10 @@
1
+ v1.0.0 First stable, documented and accompanied with tests release.
2
+
1
3
  v0.3.0 now should be ok
4
+
2
5
  v0.2.0 stupid error removed
6
+
3
7
  v0.1.1 removed iml file
8
+
4
9
  v0.1.0 initial version
10
+
data/MIT-LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2011 Panayotis Matsinopoulos
2
+
3
+ Contact: panayotis@matsinopoulos.gr
4
+ Site: http://www.matsinopoulos.gr
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining
7
+ a copy of this software and associated documentation files (the
8
+ "Software"), to deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify, merge, publish,
10
+ distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to
12
+ the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Manifest CHANGED
@@ -1,6 +1,10 @@
1
1
  CHANGELOG
2
+ MIT-LICENSE
2
3
  README.rdoc
3
4
  Rakefile
4
5
  lib/validator_attachment.rb
6
+ test/dummy_validator.rb
7
+ test/test_helper.rb
8
+ test/validator_attachment_test.rb
5
9
  validator_attachment.gemspec
6
10
  Manifest
data/README.rdoc CHANGED
@@ -1,3 +1,89 @@
1
- == Validator Attachment
1
+ = Validator Attachment
2
+
3
+ It works with Rails >=3.0. Helps me test my validations on Models with less code. Assuming that Rails validations are
4
+ already tested, by Rails, then when I have a validation on an attribute of a Model, I just want to test whether the
5
+ validation is there. Nothing more.
6
+
7
+ == Usage
8
+
9
+ Assuming that you have a Model like the following:
10
+
11
+ class MyAwesomeModel < ActiveRecord::Base
12
+ validates :last_name, :presence => true
13
+ end
14
+
15
+ In your test:
16
+
17
+ test "last name has to be present" do
18
+ assert ActiveModel::PresenceValidator.is_attached?(MyAwesomeModel, :last_name)
19
+ end
20
+
21
+ will test that your +last_name+ attribute on the model +MyAwesomeModel+ has a +:presence+ validation attached. Note
22
+ that +ActiveModel+::+PresenceValidator+ is the +class+ that comes with Rails +ActiveModel+.
23
+
24
+ Optionally, you can also check whether the correct options are attached too. So, if you have a Model like:
25
+
26
+ class MyAwesomeModel < ActiveRecord::Base
27
+ validates :last_name, :length => { :minimum => 3, :maximum => 60 }
28
+ end
29
+
30
+ In your test:
31
+
32
+ test "last name should not be of correct length" do
33
+ # you do not have to check for all options
34
+ assert ActiveModel::LengthValidator.is_attached?(MyAwesomeModel, :last_name, { :minimum => 3 })
35
+ assert ActiveModel::LengthValidator.is_attached?(MyAwesomeModel, :last_name, { :maximum => 60 })
36
+
37
+ # or you can check for all
38
+ assert ActiveModel::LengthValidator.is_attached?(MyAwesomeModel, :last_name, { :minimum => 3, :maximum => 60 })
39
+
40
+ # or you can ask for those and only those, i.e. exact content match
41
+ assert !ActiveModel::LengthValidator.is_attached?(MyAwesomeModel, :last_name, { :maximum => 60 }, true)
42
+ assert ActiveModel::LengthValidator.is_attached?(MyAwesomeModel, :last_name, { :minimum > 60, :maximum => 60 }, true)
43
+ end
44
+
45
+ Another example with +with_options+:
46
+
47
+ class User < ActiveRecord::Base
48
+ with_options :if => :is_admin? do |admin|
49
+ admin.validates :password, :length => { :minimum => 10 }
50
+ admin.validates :username, :presence => true
51
+ end
52
+ end
53
+
54
+ You can test this as follows:
55
+
56
+ test "user admin validators" do
57
+ assert ActiveModel::Validations::LengthValidator.is_attached?(User, :password, { :minimum => 10, :if => :is_admin? })
58
+ assert ActiveModel::Validations::PresenceValidator.is_attached?(User, :username, { :if => :is_admin? })
59
+ end
60
+
61
+ In the file {validator_attachment_test.rb}[https://github.com/pmatsinopoulos/validator_attachment/blob/master/validator_attachment_test.rb]
62
+ you will see a lot of tests that I run to test the +gem+ and you can get ideas on you should use your assertions. You will see
63
+ there an example with a custom validator too.
64
+
65
+ == How do you know which validator class is used, in order to test it?
66
+
67
+ It is easy to derive the class of the validator. The rule of thumb is that all Validators are +ActiveModel+ validators with
68
+ one exception that of +:uniqueness+, which is an +ActiveRecord+ Validator. However, here is a list that can help you:
69
+
70
+ :acceptance:: ActiveModel::AcceptanceValidator
71
+ :confirmation:: ActiveModel::ConfirmationValidator
72
+ :exclusion:: ActiveModel::ExclusionValidator
73
+ :format:: ActiveModel::FormatValidator
74
+ :inclusion:: ActiveModel::InclusionValidator
75
+ :length:: ActiveModel::LengthValidator
76
+ :numericality:: ActiveModel::NumericalityValidator
77
+ :uniqueness:: ActiveRecord::UniquenessValidator
78
+ :presence:: ActiveModel::PresenceValidator
79
+
80
+ == Issues
81
+
82
+ If you find a problem with +validator_attachment+, please open an issue on {issue on GitHub}[https://github.com/pmatsinopoulos/validator_attachment/issues]
83
+
84
+ == Versioning
85
+
86
+ See the {CHANGELOG}[https://github.com/pmatsinopoulos/validator_attachment/blob/master/CHANGELOG] for release notes and versions
87
+ of this `gem`. Please, note that `gem` follows {Semantic Versioning}[http://semver.org/] but patch version number will be increased
88
+ if either bug fixes are introduced (as Semantic Versioning defines) or if tests or documents are added.
2
89
 
3
- (documentation will soon be provided)
data/Rakefile CHANGED
@@ -1,17 +1,44 @@
1
+ #!/usr/bin/env rake
1
2
  require 'rubygems'
2
3
  require 'rake'
3
4
  require 'echoe'
4
5
 
5
- Echoe.new('validator_attachment', '0.3.0') do |p|
6
+ Echoe.new('validator_attachment') do |p|
6
7
  p.summary = "Is this ActiveModel Validator Used?"
7
8
  p.description = "Checks whether an ActiveModel Validator is attached to an attribute of a Model and with which options"
8
9
  p.url = "http://github.com/pmatsinopoulos/validator_attachment"
9
10
  p.author = "Panayotis Matsinopoulos"
10
11
  p.email = "panayotis@matsinopoulos.gr"
11
- p.ignore_pattern = ["tmp/*", "script/*"]
12
- p.development_dependencies = []
12
+ p.ignore_pattern = ["tmp/*", "script/*", "rdoc_output/*", "rdoc_output/js/*", "rdoc_output/images/*", "rdoc_output/ActiveModel/*", "rdoc_output/lib/*",
13
+ "yard_output/*", "yard_output/js/*", "yard_output/css/*", "Gemfile", "Gemfile.lock", "*.iml"]
14
+ p.runtime_dependencies = ["rails >=3.0"]
15
+ p.development_dependencies = ["rails >=3.0", "ruby-debug", 'ruby-debug-ide', 'ruby-debug-base']
13
16
  end
14
17
 
15
18
  Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each{ |ext| load ext }
16
19
 
20
+ # additions to support testing
21
+
22
+ require 'rake/testtask'
23
+ require 'rdoc/task'
24
+
25
+ desc 'Default: run unit tests.'
26
+ task :default => :test
27
+
28
+ desc 'Test the validation_attachment gem,'
29
+ Rake::TestTask.new(:test) do |t|
30
+ t.libs << 'lib'
31
+ t.libs << 'test'
32
+ t.pattern = 'test/**/*_test.rb'
33
+ t.verbose = true
34
+ end
35
+
36
+ desc 'Generate documentation for the validation_attachment gem.'
37
+ RDoc::Task.new(:rdoc) do |rdoc|
38
+ rdoc.rdoc_dir = 'rdoc'
39
+ rdoc.title = 'ValidationAttachment'
40
+ rdoc.options << '--line-numbers' << '--inline-source'
41
+ rdoc.rdoc_files.include('README')
42
+ rdoc.rdoc_files.include('lib/**/*.rb')
43
+ end
17
44
 
@@ -1,4 +1,23 @@
1
1
  module ValidatorAttachment
2
+
3
+ # Given a +klass+ checks whether the target Validator is attached to
4
+ # the given +attribute+ of the model with class +klass+. It can also check
5
+ # whether validator is attached together with some +options+ and if these
6
+ # +options+ are the only ones used (given +exact_math+ +true+)
7
+ #
8
+ # @param [Class] klass the Model class that uses the Validator
9
+ # @param [Symbol] attribute the attribute of the Model class that we want
10
+ # to check whether it uses the Validator or not
11
+ # @param [Hash] options optional parameter that, if given, will be used to
12
+ # check whether the Validator is attached to the +attribute of the Model +klass+
13
+ # but with the given +options+, even if there are more options (not exact match).
14
+ # @param [boolean] exact_match if +true+ then the +options+ given should be matched
15
+ # with the +options+ of the Validator both in number and in content, and Validator
16
+ # should not have more or less options.
17
+ # @return [boolean] whether Validator is attached or not
18
+ #
19
+ # @see http://github.com/pmatsinopoulos/validator_attachment Please project home page for more details and examples of usage.
20
+ #
2
21
  def is_attached?(klass, attribute, options=nil, exact_match=false)
3
22
  validators = klass._validate_callbacks.map{|vc| vc.raw_filter}
4
23
  validators = validators.find_all{ |val| val.is_a?(self) }
@@ -0,0 +1,7 @@
1
+ class DummyValidator < ActiveModel::EachValidator
2
+ def validate_each(record, attribute, value)
3
+ unless value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
4
+ record.errors[attribute] << (options[:message] || "is not an email")
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'active_support'
4
+ require 'active_model'
5
+ require 'active_record'
6
+ require 'active_support/core_ext/hash/diff'
7
+ require 'active_support/core_ext/object/with_options'
8
+ require File.expand_path('../../lib/validator_attachment', __FILE__)
9
+ require 'dummy_validator'
@@ -0,0 +1,153 @@
1
+ require 'test_helper'
2
+
3
+ class ValidatorAttachmentTest < ActiveSupport::TestCase
4
+
5
+ class SampleModel
6
+ include ActiveModel::Validations
7
+ include ActiveRecord::Validations
8
+
9
+ validates :acceptance_attr_1, :acceptance => true
10
+ validates :acceptance_attr_2, :acceptance => { :allow_nil => true }
11
+ validates :acceptance_attr_3, :acceptance => { :allow_nil => false }
12
+ validates :acceptance_attr_4, :acceptance => { :accept => 'sure' }
13
+ validates :acceptance_attr_5, :acceptance => { :allow_nil => true, :accept => 'sure' }
14
+
15
+ validates :email_1, :confirmation => true
16
+ validates :email_2, :confirmation => true, :presence => true
17
+
18
+ validates :exclusion_1, :exclusion => { :in => %w(ab cd ef), :message => 'not allowed' }
19
+
20
+ validates :legacy_code, :format => { :with => /^a.+\d$/, :message => 'wrong format' }
21
+
22
+ validates :size, :inclusion => { :in => %w(small medium large),
23
+ :message => "%{value} is not a valid size" }
24
+
25
+ validates :name, :length => { :minimum => 2 }
26
+ validates :bio, :length => { :maximum => 500 }
27
+ validates :password, :length => { :in => 6..20 }
28
+ validates :registration_number, :length => { :is => 6 }
29
+ validates :account_number, :length => { :minimum => 2, :maximum => 6, :wrong_length => 'wrong length, please try again' }
30
+ validates :student_id, :length => { :maximum => 10, :too_long => 'sorry, too long', :too_short => 'sorry, too short' }
31
+ validates :mama_telephone, :length => { :is => 8 }
32
+
33
+ validates :points, :numericality => true
34
+ validates :games_played, :numericality => { :only_integer => true }
35
+ validates :num_1, :numericality => { :greater_than => 1 }
36
+ validates :num_2, :numericality => { :greater_than_or_equal_to => 2 }
37
+ validates :num_3, :numericality => { :equal_to => 3 }
38
+ validates :num_4, :numericality => { :less_than => 4 }
39
+ validates :num_5, :numericality => { :less_than_or_equal_to => 5 }
40
+ validates :num_6, :numericality => { :odd => true }
41
+ validates :num_7, :numericality => { :even => true }
42
+
43
+ validates :identity_number, :uniqueness => true
44
+ validates :identity_number_1, :uniqueness => { :scope => :num_7 }
45
+ validates :identity_number_2, :uniqueness => { :case_sensitive => true}
46
+
47
+ validates :num_8, :presence => true, :if => :paid_with_card?
48
+
49
+ with_options :if => :is_admin? do |admin|
50
+ admin.validates :num_9, :length => { :minimum => 10 }
51
+ admin.validates :num_10, :presence => true
52
+ end
53
+
54
+ validates :my_facebook_email, :presence => true, :dummy => true
55
+
56
+ def persisted?
57
+ false
58
+ end
59
+
60
+ end
61
+
62
+ test "validator attachment" do
63
+ assert ActiveModel::EachValidator.respond_to?(:is_attached?)
64
+ end
65
+
66
+ test "acceptance validator" do
67
+ assert ActiveModel::Validations::AcceptanceValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :acceptance_attr_1)
68
+ assert ActiveModel::Validations::AcceptanceValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :acceptance_attr_2, {:allow_nil => true})
69
+ assert ActiveModel::Validations::AcceptanceValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :acceptance_attr_3, {:allow_nil => false})
70
+ assert ActiveModel::Validations::AcceptanceValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :acceptance_attr_4, {:accept => 'sure'})
71
+ assert ActiveModel::Validations::AcceptanceValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :acceptance_attr_5, {:accept => 'sure'})
72
+ assert !ActiveModel::Validations::AcceptanceValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :acceptance_attr_5, {:accept => 'sure'}, true)
73
+ assert ActiveModel::Validations::AcceptanceValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :acceptance_attr_5, {:accept => 'sure', :allow_nil => true}, true)
74
+ end
75
+
76
+ test "confirmation validator" do
77
+ assert ActiveModel::Validations::ConfirmationValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :email_1)
78
+ assert !ActiveModel::Validations::ConfirmationValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :acceptance_attr_1)
79
+ assert ActiveModel::Validations::ConfirmationValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :email_2)
80
+ end
81
+
82
+ test "presence validator" do
83
+ assert ActiveModel::Validations::PresenceValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :email_2)
84
+ end
85
+
86
+ test "exclusion validator" do
87
+ assert !ActiveModel::Validations::ExclusionValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :email_2)
88
+ assert ActiveModel::Validations::ExclusionValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :exclusion_1, {:in => %w(ab cd ef)})
89
+ assert !ActiveModel::Validations::ExclusionValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :exclusion_1, {:in => %w(ab cd ef gh)})
90
+ end
91
+
92
+ test "format validator" do
93
+ assert ActiveModel::Validations::FormatValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :legacy_code)
94
+ assert ActiveModel::Validations::FormatValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :legacy_code, {:message => 'wrong format'})
95
+ assert ActiveModel::Validations::FormatValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :legacy_code, {:with => /^a.+\d$/})
96
+ assert ActiveModel::Validations::FormatValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :legacy_code, {:message => 'wrong format', :with => /^a.+\d$/})
97
+ assert !ActiveModel::Validations::FormatValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :legacy_code, {:with => /^a.+$/})
98
+ end
99
+
100
+ test "inclusion validator" do
101
+ assert ActiveModel::Validations::InclusionValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :size, {:in => %w(small medium large)})
102
+ assert ActiveModel::Validations::InclusionValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :size, {:message => "%{value} is not a valid size"})
103
+ end
104
+
105
+ test "length validator" do
106
+ assert ActiveModel::Validations::LengthValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :name)
107
+ assert ActiveModel::Validations::LengthValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :name, {:minimum => 2})
108
+ assert !ActiveModel::Validations::LengthValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :name, {:maximum => 2})
109
+ assert ActiveModel::Validations::LengthValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :bio, {:maximum => 500})
110
+ # watch out how :in has been interpreted to :minimum .. :maximum
111
+ assert ActiveModel::Validations::LengthValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :password, {:minimum => 6})
112
+ assert ActiveModel::Validations::LengthValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :password, {:maximum => 20})
113
+ assert !ActiveModel::Validations::LengthValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :registration_number, {:is => 2})
114
+ assert ActiveModel::Validations::LengthValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :registration_number, {:is => 6})
115
+ assert ActiveModel::Validations::LengthValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :account_number, {:wrong_length => 'wrong length, please try again', :minimum => 2})
116
+ assert ActiveModel::Validations::LengthValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :student_id, {:too_long => 'sorry, too long', :maximum => 10})
117
+ assert ActiveModel::Validations::LengthValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :mama_telephone, {:is => 8})
118
+ end
119
+
120
+ test "numericality" do
121
+ assert ActiveModel::Validations::NumericalityValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :points)
122
+ assert !ActiveModel::Validations::NumericalityValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :points, { :only_integer => true })
123
+ assert ActiveModel::Validations::NumericalityValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :games_played, { :only_integer => true })
124
+
125
+ assert ActiveModel::Validations::NumericalityValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :num_1, { :greater_than => 1 })
126
+ assert ActiveModel::Validations::NumericalityValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :num_2, { :greater_than_or_equal_to => 2 })
127
+ assert ActiveModel::Validations::NumericalityValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :num_3, { :equal_to => 3 })
128
+ assert ActiveModel::Validations::NumericalityValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :num_4, { :less_than => 4 })
129
+ assert ActiveModel::Validations::NumericalityValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :num_5, { :less_than_or_equal_to => 5 })
130
+ assert ActiveModel::Validations::NumericalityValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :num_6, { :odd => true })
131
+ assert ActiveModel::Validations::NumericalityValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :num_7, { :even => true })
132
+ end
133
+
134
+ test "uniqueness" do
135
+ assert ActiveRecord::Validations::UniquenessValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :identity_number)
136
+ assert ActiveRecord::Validations::UniquenessValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :identity_number_1)
137
+ assert !ActiveRecord::Validations::UniquenessValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :identity_number_1, { :scope => :num_1 })
138
+ assert ActiveRecord::Validations::UniquenessValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :identity_number_1, { :scope => :num_7 })
139
+ assert ActiveRecord::Validations::UniquenessValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :identity_number_2)
140
+ assert ActiveRecord::Validations::UniquenessValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :identity_number_2, { :case_sensitive => true})
141
+ end
142
+
143
+ test "conditional validation" do
144
+ assert ActiveModel::Validations::PresenceValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :num_8, { :if => :paid_with_card? })
145
+ assert ActiveModel::Validations::LengthValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :num_9, { :minimum => 10, :if => :is_admin? })
146
+ assert ActiveModel::Validations::PresenceValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :num_10, { :if => :is_admin? })
147
+ end
148
+
149
+ test "custom validator" do
150
+ assert DummyValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :my_facebook_email)
151
+ assert ActiveModel::Validations::PresenceValidator.is_attached?(ValidatorAttachmentTest::SampleModel, :my_facebook_email)
152
+ end
153
+ end
@@ -2,28 +2,44 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{validator_attachment}
5
- s.version = "0.3.0"
5
+ s.version = "1.0.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = [%q{Panayotis Matsinopoulos}]
9
- s.date = %q{2011-10-14}
9
+ s.date = %q{2011-10-15}
10
10
  s.description = %q{Checks whether an ActiveModel Validator is attached to an attribute of a Model and with which options}
11
11
  s.email = %q{panayotis@matsinopoulos.gr}
12
12
  s.extra_rdoc_files = [%q{CHANGELOG}, %q{README.rdoc}, %q{lib/validator_attachment.rb}]
13
- s.files = [%q{CHANGELOG}, %q{README.rdoc}, %q{Rakefile}, %q{lib/validator_attachment.rb}, %q{validator_attachment.gemspec}, %q{Manifest}]
13
+ s.files = [%q{CHANGELOG}, %q{MIT-LICENSE}, %q{README.rdoc}, %q{Rakefile}, %q{lib/validator_attachment.rb}, %q{test/dummy_validator.rb}, %q{test/test_helper.rb}, %q{test/validator_attachment_test.rb}, %q{validator_attachment.gemspec}, %q{Manifest}]
14
14
  s.homepage = %q{http://github.com/pmatsinopoulos/validator_attachment}
15
15
  s.rdoc_options = [%q{--line-numbers}, %q{--inline-source}, %q{--title}, %q{Validator_attachment}, %q{--main}, %q{README.rdoc}]
16
16
  s.require_paths = [%q{lib}]
17
17
  s.rubyforge_project = %q{validator_attachment}
18
18
  s.rubygems_version = %q{1.8.8}
19
19
  s.summary = %q{Is this ActiveModel Validator Used?}
20
+ s.test_files = [%q{test/validator_attachment_test.rb}, %q{test/test_helper.rb}]
20
21
 
21
22
  if s.respond_to? :specification_version then
22
23
  s.specification_version = 3
23
24
 
24
25
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
+ s.add_runtime_dependency(%q<rails>, [">= 3.0"])
27
+ s.add_development_dependency(%q<rails>, [">= 3.0"])
28
+ s.add_development_dependency(%q<ruby-debug>, [">= 0"])
29
+ s.add_development_dependency(%q<ruby-debug-ide>, [">= 0"])
30
+ s.add_development_dependency(%q<ruby-debug-base>, [">= 0"])
25
31
  else
32
+ s.add_dependency(%q<rails>, [">= 3.0"])
33
+ s.add_dependency(%q<rails>, [">= 3.0"])
34
+ s.add_dependency(%q<ruby-debug>, [">= 0"])
35
+ s.add_dependency(%q<ruby-debug-ide>, [">= 0"])
36
+ s.add_dependency(%q<ruby-debug-base>, [">= 0"])
26
37
  end
27
38
  else
39
+ s.add_dependency(%q<rails>, [">= 3.0"])
40
+ s.add_dependency(%q<rails>, [">= 3.0"])
41
+ s.add_dependency(%q<ruby-debug>, [">= 0"])
42
+ s.add_dependency(%q<ruby-debug-ide>, [">= 0"])
43
+ s.add_dependency(%q<ruby-debug-base>, [">= 0"])
28
44
  end
29
45
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validator_attachment
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
+ - 1
7
8
  - 0
8
- - 3
9
9
  - 0
10
- version: 0.3.0
10
+ version: 1.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Panayotis Matsinopoulos
@@ -15,9 +15,80 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-14 00:00:00 Z
19
- dependencies: []
20
-
18
+ date: 2011-10-15 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rails
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 7
29
+ segments:
30
+ - 3
31
+ - 0
32
+ version: "3.0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: rails
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 7
44
+ segments:
45
+ - 3
46
+ - 0
47
+ version: "3.0"
48
+ type: :development
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: ruby-debug
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 3
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ type: :development
63
+ version_requirements: *id003
64
+ - !ruby/object:Gem::Dependency
65
+ name: ruby-debug-ide
66
+ prerelease: false
67
+ requirement: &id004 !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 3
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ type: :development
77
+ version_requirements: *id004
78
+ - !ruby/object:Gem::Dependency
79
+ name: ruby-debug-base
80
+ prerelease: false
81
+ requirement: &id005 !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ hash: 3
87
+ segments:
88
+ - 0
89
+ version: "0"
90
+ type: :development
91
+ version_requirements: *id005
21
92
  description: Checks whether an ActiveModel Validator is attached to an attribute of a Model and with which options
22
93
  email: panayotis@matsinopoulos.gr
23
94
  executables: []
@@ -30,9 +101,13 @@ extra_rdoc_files:
30
101
  - lib/validator_attachment.rb
31
102
  files:
32
103
  - CHANGELOG
104
+ - MIT-LICENSE
33
105
  - README.rdoc
34
106
  - Rakefile
35
107
  - lib/validator_attachment.rb
108
+ - test/dummy_validator.rb
109
+ - test/test_helper.rb
110
+ - test/validator_attachment_test.rb
36
111
  - validator_attachment.gemspec
37
112
  - Manifest
38
113
  homepage: http://github.com/pmatsinopoulos/validator_attachment
@@ -74,5 +149,6 @@ rubygems_version: 1.8.8
74
149
  signing_key:
75
150
  specification_version: 3
76
151
  summary: Is this ActiveModel Validator Used?
77
- test_files: []
78
-
152
+ test_files:
153
+ - test/validator_attachment_test.rb
154
+ - test/test_helper.rb