whyvalidationssuckin96 1.6.2 → 1.6.3

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/VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.2
1
+ 1.6.3
@@ -2,10 +2,14 @@ module WhyValidationsSuckIn96
2
2
  class ValidationCollection < Array
3
3
 
4
4
  def to_json(options={})
5
+ to_hash.to_json(options)
6
+ end
7
+
8
+ def to_hash
5
9
  inject({}) do |acc,validation|
6
10
  acc[validation.attribute] = validation.options
7
11
  acc
8
- end.to_json(options)
12
+ end
9
13
  end
10
14
 
11
15
  def select(&block)
@@ -2,11 +2,22 @@ require 'teststrap'
2
2
  require 'active_support'
3
3
 
4
4
  context "validation_collection" do
5
+ setup do
6
+ @validation_options = { :is => 3 }
7
+ @collection = WhyValidationsSuckIn96::ValidationCollection.new
8
+ @collection << WhyValidationsSuckIn96::ValidatesLength.new(Object.new, { :attribute => :thing }.merge(@validation_options))
9
+ end
10
+
11
+ context "to_hash" do
12
+ setup do
13
+ @collection.to_hash
14
+ end
15
+
16
+ asserts("is a hash") { topic.is_a?(Hash) }
17
+ end
18
+
5
19
  context "to_json" do
6
20
  setup do
7
- @validation_options = { :is => 3 }
8
- @collection = WhyValidationsSuckIn96::ValidationCollection.new
9
- @collection << WhyValidationsSuckIn96::ValidatesLength.new(Object.new, { :attribute => :thing }.merge(@validation_options))
10
21
  ActiveSupport::JSON.decode(@collection.to_json)
11
22
  end
12
23
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{whyvalidationssuckin96}
8
- s.version = "1.6.2"
8
+ s.version = "1.6.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["gabrielg", "douglasmeyer"]
12
- s.date = %q{2010-03-17}
12
+ s.date = %q{2010-05-26}
13
13
  s.description = %q{A library for setting up model validations, such as in ActiveRecord.}
14
14
  s.email = %q{gabriel.gironda@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 6
8
- - 2
9
- version: 1.6.2
8
+ - 3
9
+ version: 1.6.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - gabrielg
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-03-17 00:00:00 -05:00
18
+ date: 2010-05-26 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency