marnen-validation_reflection 1.0.0.60320e6beb088808fd625a8d958dbd0d2661d494

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ Yjc3OTgxN2Y5MWYzNzY0YzE3ZDU4N2M3N2I1ZjNhM2Y4NWM4ZWVkMg==
5
+ data.tar.gz: !binary |-
6
+ ZjE3ZjdmNDIxZjYxYTY2NTM4ZTI5M2E0Y2YwYWI5ODU2MTVmMWEyYQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ OTU4MTUwZTY2Yjc1NjgyYjUyZWU4YjE4MjI4ZWQ0NzlmZDM5YzkyM2JhMjA0
10
+ M2QzOGQ0NTgxNGQ1ZDMxZjc5Y2JjMWNlNmY1Mjk1ZWE1NjgzOWFiMTVmNDli
11
+ ZWZlODk1NjMyODBhZDZiZmQzMDUxYzVkZWZkY2ZjMWU5ODViMjk=
12
+ data.tar.gz: !binary |-
13
+ OGEzYTIxN2RjNTgzZmE2Mzk4ODQ5YTlkN2NhMWE3MmZmNDRjYjBlNGQzZWU2
14
+ YTczYTRmNmM5YTFlYjY4YmM0NWVhY2U2ZjVjZDY2MWQ5N2U1ZmE2YzFjOTc3
15
+ Y2IxZWY4YWZhODQxZDNhMjlkOGJjNTdkOGE0ZGM5Nzg3YTEzZGY=
data/CHANGELOG ADDED
@@ -0,0 +1,63 @@
1
+ == 1.0.0 2010-10-08
2
+ * 1.0 release for Rails 3
3
+
4
+ == 1.0.0-rc.1 2010-07-30
5
+ * Fixed reload bug
6
+
7
+ == 1.0.0-beta4 2010-06-12
8
+ * Changed initialization to reflect new initialization in Rails 3.
9
+
10
+ == 0.3.8 2010-07-30
11
+ * Enhancement from Sutto:
12
+ ** Fix reload bug
13
+
14
+ == 0.3.7 2010-06-11
15
+ * Enhancement from Sutto:
16
+ ** Use Rails.root if available over RAILS_ROOT
17
+
18
+ == 0.3.6 2010-02-14
19
+ * Enhancement from skoppensboer:
20
+ ** Changes Jeweler spec to reflect only Gemcutter
21
+ * Enhancement from duritong:
22
+ ** fix remembering of attributes defined as an array
23
+
24
+ == 0.3.5, 2009-10-09
25
+ * version bump
26
+
27
+ == 0.3.4, 2009-10-09
28
+ * Enhancements from Jonas Grimfelt
29
+ ** Don't include instead of explicit namespaces to make the code much DRY:er and readable
30
+ ** Avoid mutable strings
31
+ ** Be clear about the namespaces for external classes (to avoid Ruby 1.9.x issues)
32
+ ** Fixing gem loading issues on Ruby 1.9.x
33
+ ** Removed the freezing of validations
34
+
35
+ == 0.3.3, 2009-09-12
36
+ * version bump
37
+
38
+ == 0.3.2, 2009-09-12
39
+ * gemified by Christopher Redinger
40
+
41
+ == 0.3.1, 2008-01-03
42
+ * require 'ostruct'; thanks to Georg Friedrich.
43
+
44
+ == 0.3, 2008-01-01
45
+ * Added configurability in config/plugins/validation_reflection.rb
46
+
47
+ == 0.2.1, 2006-12-28
48
+ * Moved lib files into subfolder boiler_plate.
49
+
50
+ == 0.2, 2006-08-06
51
+ ?
52
+
53
+ = Deprecation Notice
54
+
55
+ Version 0.1 had supplied three methods
56
+
57
+ - validates_presence_of_mandatory_content_columns
58
+ - validates_lengths_of_string_attributes
59
+ - validates_all_associated
60
+
61
+ These have been removed. Please use the Enforce Schema Rules plugin instead
62
+
63
+ http://enforce-schema-rules.googlecode.com/svn/trunk/enforce_schema_rules/
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,62 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ marnen-validation_reflection (1.0.0.60320e6beb088808fd625a8d958dbd0d2661d494)
5
+ marnen-validation_reflection
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.3.6)
11
+ builder (3.2.2)
12
+ descendants_tracker (0.0.4)
13
+ thread_safe (~> 0.3, >= 0.3.1)
14
+ faraday (0.9.0)
15
+ multipart-post (>= 1.2, < 3)
16
+ git (1.2.8)
17
+ github_api (0.12.0)
18
+ addressable (~> 2.3)
19
+ descendants_tracker (~> 0.0.4)
20
+ faraday (~> 0.8, < 0.10)
21
+ hashie (>= 3.2)
22
+ multi_json (>= 1.7.5, < 2.0)
23
+ nokogiri (~> 1.6.3)
24
+ oauth2
25
+ hashie (3.2.0)
26
+ highline (1.6.21)
27
+ jeweler (2.0.1)
28
+ builder
29
+ bundler (>= 1.0)
30
+ git (>= 1.2.5)
31
+ github_api
32
+ highline (>= 1.6.15)
33
+ nokogiri (>= 1.5.10)
34
+ rake
35
+ rdoc
36
+ json (1.8.1)
37
+ jwt (1.0.0)
38
+ mini_portile (0.6.0)
39
+ multi_json (1.10.1)
40
+ multi_xml (0.5.5)
41
+ multipart-post (2.0.0)
42
+ nokogiri (1.6.3.1)
43
+ mini_portile (= 0.6.0)
44
+ oauth2 (1.0.0)
45
+ faraday (>= 0.8, < 0.10)
46
+ jwt (~> 1.0)
47
+ multi_json (~> 1.3)
48
+ multi_xml (~> 0.5)
49
+ rack (~> 1.2)
50
+ rack (1.5.2)
51
+ rake (0.9.6)
52
+ rdoc (4.1.1)
53
+ json (~> 1.4)
54
+ thread_safe (0.3.4)
55
+
56
+ PLATFORMS
57
+ ruby
58
+
59
+ DEPENDENCIES
60
+ jeweler
61
+ marnen-validation_reflection!
62
+ rake (< 10)
data/MIT-LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2009 Christopher Redinger
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
data/README ADDED
@@ -0,0 +1,68 @@
1
+ Validation Reflection
2
+ =====================
3
+
4
+ Version 1.0.0, 2010-10-08
5
+
6
+ This plugin adds reflective access to validations
7
+
8
+ - ModelClass.reflect_on_all_validations
9
+ - ModelClass.reflect_on_validations_for(:property)
10
+
11
+ Both of these methods return arrays containing instances of
12
+ ActiveRecord::Reflection::MacroReflection. For example
13
+
14
+ class Person < ActiveRecord::Base
15
+ validates_presence_of :name
16
+ validates_numericality_of :size, :only_integer => true
17
+ end
18
+
19
+ refl = Person.reflect_on_validations_for(:name)
20
+ refl[0].macro
21
+ # => :validates_presence_of
22
+
23
+ refl = Person.reflect_on_validations_for(:size)
24
+ refl[0].macro
25
+ # => :validates_numericality_of
26
+ refl[0].options
27
+ # => { :only_integer => true }
28
+
29
+
30
+ == Customization
31
+
32
+ Usually, all the standard Rails validations are reflected.
33
+ You can change this -- add or remove validations -- in an
34
+ application-specific initializer,
35
+
36
+ config/initializers/validation_reflection.rb
37
+
38
+ In that file change config.reflected_validations to suit your
39
+ needs. Say, you have a custom validation for email addresses,
40
+ validates_as_email, then you could add it like this
41
+
42
+ config.reflected_validations << :validates_as_email
43
+
44
+ If validates_as_email is implemented in terms of other validation
45
+ methods, these validations are added to the reflection metadata,
46
+ too. As that may not be what you want, you can disable reflection
47
+ for these subordinate validations
48
+
49
+ config.reflected_validations << {
50
+ :method => :validates_as_email,
51
+ :ignore_subvalidations => true
52
+ }
53
+
54
+ You have to make sure that all reflected validations are defined
55
+ before this plugin is loaded. To this end, you may have to
56
+ explicitly set the load order of plugins somewhere in the environment
57
+ configuration using
58
+
59
+ config.plugins = [...]
60
+
61
+
62
+ == Special Thanks
63
+
64
+ To Michael Schuerig, michael@schuerig.de for his initial concept and implementation of this plugin.
65
+
66
+ == License
67
+
68
+ ValidationReflection uses the MIT license. Please check the LICENSE file for more details.
data/Rakefile ADDED
@@ -0,0 +1,38 @@
1
+ # encoding: utf-8
2
+ require 'rake'
3
+ require 'rake/testtask'
4
+ require 'rake/rdoctask'
5
+
6
+ desc 'Default: run unit tests.'
7
+ task :default => :test
8
+
9
+ desc 'Test the validation_reflection plugin.'
10
+ Rake::TestTask.new(:test) do |t|
11
+ t.libs << 'lib'
12
+ t.pattern = 'test/**/*_test.rb'
13
+ t.verbose = true
14
+ end
15
+
16
+ desc 'Generate documentation for the validation_reflection plugin.'
17
+ Rake::RDocTask.new(:rdoc) do |rdoc|
18
+ rdoc.rdoc_dir = 'rdoc'
19
+ rdoc.title = 'ValidationReflection'
20
+ rdoc.options << '--line-numbers' << '--inline-source'
21
+ rdoc.rdoc_files.include('README')
22
+ rdoc.rdoc_files.include('lib/**/*.rb')
23
+ end
24
+
25
+ begin
26
+ require 'jeweler'
27
+ Jeweler::Tasks.new do |gemspec|
28
+ gemspec.name = "marnen-validation_reflection"
29
+ gemspec.summary = "Adds reflective access to validations"
30
+ gemspec.description = "Adds reflective access to validations"
31
+ gemspec.email = ["redinger@gmail.com", 'marnen@marnen.org']
32
+ gemspec.homepage = "http://github.com/marnen/validation_reflection"
33
+ gemspec.authors = ["Christopher Redinger", 'Marnen Laibow-Koser']
34
+ end
35
+ Jeweler::RubyforgeTasks.new
36
+ rescue LoadError
37
+ puts "Jeweler not available. Install it with: sudo gem install jeweler"
38
+ end
data/VERSION.yml ADDED
@@ -0,0 +1,5 @@
1
+ ---
2
+ :major: 1
3
+ :minor: 0
4
+ :patch: 0
5
+ :build: 60320e6beb088808fd625a8d958dbd0d2661d494
@@ -0,0 +1,104 @@
1
+ require 'ostruct'
2
+
3
+ module ValidationReflection # :nodoc:
4
+
5
+ extend self
6
+
7
+ CORE_VALIDATONS = [
8
+ :validates_acceptance_of,
9
+ :validates_associated,
10
+ :validates_confirmation_of,
11
+ :validates_exclusion_of,
12
+ :validates_format_of,
13
+ :validates_inclusion_of,
14
+ :validates_length_of,
15
+ :validates_numericality_of,
16
+ :validates_presence_of,
17
+ :validates_uniqueness_of,
18
+ ].freeze
19
+
20
+ @@reflected_validations = CORE_VALIDATONS.dup
21
+
22
+ @@in_ignored_subvalidation = false
23
+
24
+ mattr_accessor :reflected_validations,
25
+ :in_ignored_subvalidation
26
+
27
+ def included(base) # :nodoc:
28
+ return if base.kind_of?(::ValidationReflection::ClassMethods)
29
+ base.extend(ClassMethods)
30
+ end
31
+
32
+ # Iterate through all validations and store/cache the info
33
+ # for later easy access.
34
+ #
35
+ def install(base)
36
+ base.send :class_attribute, :validations
37
+
38
+ @@reflected_validations.each do |validation_type|
39
+ next if base.respond_to?(:"#{validation_type}_with_reflection")
40
+ ignore_subvalidations = false
41
+
42
+ if validation_type.kind_of?(::Hash)
43
+ ignore_subvalidations = validation_type[:ignore_subvalidations]
44
+ validation_type = validation_type[:method]
45
+ end
46
+
47
+ base.class_eval %{
48
+ class << self
49
+ def #{validation_type}_with_reflection(*attr_names)
50
+ ignoring_subvalidations(#{ignore_subvalidations}) do
51
+ #{validation_type}_without_reflection(*attr_names)
52
+ remember_validation_metadata(:#{validation_type}, *attr_names)
53
+ end
54
+ end
55
+ alias_method_chain :#{validation_type}, :reflection
56
+ end
57
+ }, __FILE__, __LINE__
58
+ end
59
+ end
60
+
61
+ module ClassMethods
62
+
63
+ include ::ValidationReflection
64
+
65
+ # Returns an array of MacroReflection objects for all validations in the class
66
+ def reflect_on_all_validations
67
+ validations || []
68
+ end
69
+
70
+ # Returns an array of MacroReflection objects for all validations defined for the field +attr_name+.
71
+ def reflect_on_validations_for(attr_name)
72
+ self.reflect_on_all_validations.select do |reflection|
73
+ reflection.name == attr_name.to_sym
74
+ end
75
+ end
76
+
77
+ private
78
+
79
+ # Store validation info for easy and fast access.
80
+ #
81
+ def remember_validation_metadata(validation_type, *attr_names)
82
+ configuration = attr_names.last.is_a?(::Hash) ? attr_names.pop : {}
83
+ self.validations ||= []
84
+ attr_names.flatten.each do |attr_name|
85
+ self.validations << ::ActiveRecord::Reflection::MacroReflection.new(validation_type, attr_name.to_sym, configuration, self)
86
+ end
87
+ end
88
+
89
+ def ignoring_subvalidations(ignore)
90
+ save_ignore = self.in_ignored_subvalidation
91
+ unless self.in_ignored_subvalidation
92
+ self.in_ignored_subvalidation = ignore
93
+ yield
94
+ end
95
+ ensure
96
+ self.in_ignored_subvalidation = save_ignore
97
+ end
98
+ end
99
+ end
100
+
101
+ ActiveSupport.on_load(:active_record) do
102
+ include ValidationReflection
103
+ ::ValidationReflection.install(self)
104
+ end
@@ -0,0 +1,62 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+ # stub: marnen-validation_reflection 1.0.0.60320e6beb088808fd625a8d958dbd0d2661d494 ruby lib
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "marnen-validation_reflection"
9
+ s.version = "1.0.0.60320e6beb088808fd625a8d958dbd0d2661d494"
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
12
+ s.authors = ["Christopher Redinger", "Marnen Laibow-Koser"]
13
+ s.date = "2014-08-02"
14
+ s.description = "Adds reflective access to validations"
15
+ s.email = ["redinger@gmail.com", "marnen@marnen.org"]
16
+ s.extra_rdoc_files = [
17
+ "README"
18
+ ]
19
+ s.files = [
20
+ "CHANGELOG",
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "MIT-LICENSE",
24
+ "README",
25
+ "Rakefile",
26
+ "VERSION.yml",
27
+ "lib/validation_reflection.rb",
28
+ "marnen-validation_reflection.gemspec",
29
+ "rails/init.rb",
30
+ "test/test_helper.rb",
31
+ "test/validation_reflection_test.rb"
32
+ ]
33
+ s.homepage = "http://github.com/marnen/validation_reflection"
34
+ s.require_paths = ["lib"]
35
+ s.rubygems_version = "2.1.11"
36
+ s.summary = "Adds reflective access to validations"
37
+
38
+ if s.respond_to? :specification_version then
39
+ s.specification_version = 4
40
+
41
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
42
+ s.add_runtime_dependency(%q<marnen-validation_reflection>, [">= 0"])
43
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
44
+ s.add_development_dependency(%q<rake>, ["< 10"])
45
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
46
+ s.add_development_dependency(%q<rake>, ["< 10"])
47
+ else
48
+ s.add_dependency(%q<marnen-validation_reflection>, [">= 0"])
49
+ s.add_dependency(%q<jeweler>, [">= 0"])
50
+ s.add_dependency(%q<rake>, ["< 10"])
51
+ s.add_dependency(%q<jeweler>, [">= 0"])
52
+ s.add_dependency(%q<rake>, ["< 10"])
53
+ end
54
+ else
55
+ s.add_dependency(%q<marnen-validation_reflection>, [">= 0"])
56
+ s.add_dependency(%q<jeweler>, [">= 0"])
57
+ s.add_dependency(%q<rake>, ["< 10"])
58
+ s.add_dependency(%q<jeweler>, [">= 0"])
59
+ s.add_dependency(%q<rake>, ["< 10"])
60
+ end
61
+ end
62
+
data/rails/init.rb ADDED
@@ -0,0 +1,2 @@
1
+ # encoding: utf-8
2
+ require 'validation_reflection'
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+ ENV['RAILS_ENV'] = 'test'
3
+ RAILS_ROOT = File.join(File.dirname(__FILE__))
4
+
5
+ require 'rubygems'
6
+
7
+ begin
8
+ require 'active_record'
9
+ rescue LoadError
10
+ gem 'activerecord', '>= 1.2.3'
11
+ require 'active_record'
12
+ end
13
+
14
+ begin
15
+ require 'test/unit'
16
+ rescue LoadError
17
+ gem 'test-unit', '>= 1.2.3'
18
+ require 'test/unit'
19
+ end
@@ -0,0 +1,126 @@
1
+ # encoding: utf-8
2
+ require File.join(File.dirname(__FILE__), 'test_helper')
3
+
4
+ ActiveRecord::Base.class_eval do
5
+ def self.validates_something_weird(*cols)
6
+ cols.each do |col|
7
+ validates_format_of col, :with => /weird/
8
+ end
9
+ end
10
+ def self.validates_something_selfcontained(*cols)
11
+ cols.each do |col|
12
+ validates_format_of col, :with => /blablabla/
13
+ end
14
+ end
15
+ end
16
+
17
+ require 'validation_reflection'
18
+
19
+ ActiveRecord::Base.class_eval do
20
+ include ValidationReflection
21
+ ::ValidationReflection.reflected_validations << :validates_something_weird
22
+ ::ValidationReflection.reflected_validations << {
23
+ :method => :validates_something_selfcontained,
24
+ :ignore_subvalidations => true
25
+ }
26
+ ::ValidationReflection.install(self)
27
+ end
28
+
29
+
30
+ class ValidationReflectionTest < Test::Unit::TestCase
31
+
32
+ class Dummy < ActiveRecord::Base
33
+ class << self
34
+
35
+ def create_fake_column(name, null = true, limit = nil)
36
+ sql_type = limit ? "varchar (#{limit})" : nil
37
+ col = ActiveRecord::ConnectionAdapters::Column.new(name, nil, sql_type, null)
38
+ col
39
+ end
40
+
41
+ def columns
42
+ [
43
+ create_fake_column('col0'),
44
+ create_fake_column('col1'),
45
+ create_fake_column('col1a'),
46
+ create_fake_column('col1b'),
47
+ create_fake_column('col2', false, 100),
48
+ create_fake_column('col3'),
49
+ create_fake_column('col4'),
50
+ create_fake_column('col5'),
51
+ create_fake_column('col6'),
52
+ create_fake_column('col7')
53
+ ]
54
+ end
55
+ end
56
+
57
+ has_one :nothing
58
+
59
+ validates_presence_of :col1
60
+ validates_presence_of [ :col1a, :col1b ]
61
+ validates_length_of :col2, :maximum => 100
62
+ validates_format_of :col3, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
63
+ validates_numericality_of :col4, :only_integer => true
64
+ validates_numericality_of :col5, :less_than => 5
65
+ validates_something_weird :col6
66
+ validates_something_selfcontained :col7
67
+ end
68
+
69
+ def test_sanity
70
+ assert_equal [], Dummy.reflect_on_validations_for(:col0)
71
+ end
72
+
73
+ def test_validates_presence_of_is_reflected
74
+ reflections = Dummy.reflect_on_validations_for(:col1)
75
+ assert reflections.all? { |r| r.name.to_s == 'col1' }
76
+ assert reflections.find { |r| r.macro == :validates_presence_of }
77
+ end
78
+
79
+ def test_string_limit_is_reflected
80
+ reflections = Dummy.reflect_on_validations_for(:col2)
81
+ assert reflections.any? { |r| r.macro == :validates_length_of && r.options[:maximum] == 100 }
82
+ end
83
+
84
+ def test_format_is_reflected
85
+ reflections = Dummy.reflect_on_validations_for(:col3)
86
+ assert reflections.any? { |r| r.macro == :validates_format_of && r.options[:with] == /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i }
87
+ end
88
+
89
+ def test_numeric_integer_is_reflected
90
+ reflections = Dummy.reflect_on_validations_for(:col4)
91
+ assert reflections.any? { |r| r.macro == :validates_numericality_of && r.options[:only_integer] }
92
+ end
93
+
94
+ def test_numeric_is_reflected
95
+ reflections = Dummy.reflect_on_validations_for(:col5)
96
+ assert reflections.any? { |r| r.macro == :validates_numericality_of }
97
+ end
98
+
99
+ def test_validation_options_are_reflected
100
+ reflections = Dummy.reflect_on_validations_for(:col5)
101
+ refl = reflections[0]
102
+ assert_equal 5, refl.options[:less_than]
103
+ end
104
+
105
+ def test_custom_validations_are_reflected
106
+ reflections = Dummy.reflect_on_validations_for(:col6)
107
+ assert reflections.any? { |r| r.macro == :validates_something_weird }
108
+ assert reflections.any? { |r| r.macro == :validates_format_of }
109
+ end
110
+
111
+ def test_custom_validations_with_options_are_reflected
112
+ reflections = Dummy.reflect_on_validations_for(:col7)
113
+ assert reflections.any? { |r| r.macro == :validates_something_selfcontained }
114
+ end
115
+
116
+ def test_subvalidations_are_reflected
117
+ reflections = Dummy.reflect_on_validations_for(:col6)
118
+ assert_equal 2, reflections.size
119
+ end
120
+
121
+ def test_ignored_subvalidations_are_not_reflected
122
+ reflections = Dummy.reflect_on_validations_for(:col7)
123
+ assert_equal 1, reflections.size
124
+ end
125
+
126
+ end
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: marnen-validation_reflection
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0.60320e6beb088808fd625a8d958dbd0d2661d494
5
+ platform: ruby
6
+ authors:
7
+ - Christopher Redinger
8
+ - Marnen Laibow-Koser
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-08-02 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: marnen-validation_reflection
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ! '>='
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ! '>='
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: jeweler
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ! '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ! '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rake
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - <
47
+ - !ruby/object:Gem::Version
48
+ version: '10'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - <
54
+ - !ruby/object:Gem::Version
55
+ version: '10'
56
+ - !ruby/object:Gem::Dependency
57
+ name: jeweler
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rake
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - <
75
+ - !ruby/object:Gem::Version
76
+ version: '10'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - <
82
+ - !ruby/object:Gem::Version
83
+ version: '10'
84
+ description: Adds reflective access to validations
85
+ email:
86
+ - redinger@gmail.com
87
+ - marnen@marnen.org
88
+ executables: []
89
+ extensions: []
90
+ extra_rdoc_files:
91
+ - README
92
+ files:
93
+ - CHANGELOG
94
+ - Gemfile
95
+ - Gemfile.lock
96
+ - MIT-LICENSE
97
+ - README
98
+ - Rakefile
99
+ - VERSION.yml
100
+ - lib/validation_reflection.rb
101
+ - marnen-validation_reflection.gemspec
102
+ - rails/init.rb
103
+ - test/test_helper.rb
104
+ - test/validation_reflection_test.rb
105
+ homepage: http://github.com/marnen/validation_reflection
106
+ licenses: []
107
+ metadata: {}
108
+ post_install_message:
109
+ rdoc_options: []
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ! '>='
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ! '>'
120
+ - !ruby/object:Gem::Version
121
+ version: 1.3.1
122
+ requirements: []
123
+ rubyforge_project:
124
+ rubygems_version: 2.1.11
125
+ signing_key:
126
+ specification_version: 4
127
+ summary: Adds reflective access to validations
128
+ test_files: []