accept_values_for 0.7.1 → 0.7.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0c68c769aa81b7f8995dc3bb5282cfff8e4d5b79
4
- data.tar.gz: 9bf7fecfab2e384eb90cfb4e854f0d299a5cddc0
3
+ metadata.gz: 2c6f068b399901b27d75288a2ad5714a5742c3af
4
+ data.tar.gz: d46db566833ad63b589d3bc909ffe449e9f0e386
5
5
  SHA512:
6
- metadata.gz: aa35e5b1984292b2e140898be8f6d58fa31865b464f55524540725b8c43b5b54cae758cb7f4f1b0865c542ddad7344d4895e9523ef3e99fe05f65bd9208cafa5
7
- data.tar.gz: 6b4388802f4b11514414c83cddab4676a66251cc714e7047196d7ea6fe830d2b8acc4a5ac08d3613062ecd2deb67c0ad6316ee13081c544930054a490fc0be79
6
+ metadata.gz: 3604e0184e5b49342069e1db9e52167d9095f6a4ea3ca505c9c3f8d0cbe92537db53370076b54052c400c40b2576b57d28aae5533480fde761648e845997d9e8
7
+ data.tar.gz: 6da39f470c2152654c4b94f5c5a4b8e10d4e79ff4da18ab5d260aef90ec39b4c7d8f89f073a8d72f5584dd7e2e2d3a97ec8e36d5b3d16ca03a4a535fd0e71d6b
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "accept_values_for"
5
- spec.version = "0.7.1"
5
+ spec.version = "0.7.2"
6
6
 
7
7
  spec.author = "Bogdan Gusiev"
8
8
  spec.email = "agresso@gmail.com"
@@ -26,8 +26,8 @@ module AcceptValuesFor
26
26
 
27
27
  def failure_message
28
28
  result = "expected #{@model.inspect} to accept values #{formatted_failed_values} for #{@attribute.inspect}, but it was not\n"
29
- @failed_values.keys.sort.each do |key|
30
- result << "\nValue: #{key}\tErrors: #{@attribute} #{@failed_values[key]}"
29
+ sorted_failed_values.each do |key|
30
+ result << "\nValue: #{key.inspect}\tErrors: #{@attribute} #{@failed_values[key]}"
31
31
  end
32
32
  result
33
33
  end
@@ -63,7 +63,11 @@ module AcceptValuesFor
63
63
  end
64
64
 
65
65
  def formatted_failed_values
66
- @failed_values.keys.sort.map(&:inspect).join(", ")
66
+ sorted_failed_values.map(&:inspect).join(", ")
67
+ end
68
+
69
+ def sorted_failed_values
70
+ @failed_values.keys.sort_by(&:to_s)
67
71
  end
68
72
  end
69
73
  end
@@ -15,7 +15,7 @@ describe "AcceptValuesFor" do
15
15
  it { should eq(false) }
16
16
  it "should have correct failure message for should" do
17
17
  accept_values_for_object.matches?(person)
18
- accept_values_for_object.failure_message_for_should.should == "expected #{person.inspect} to accept values \"INVALID\" for :gender, but it was not\n\nValue: INVALID\tErrors: gender is not included in the list"
18
+ accept_values_for_object.failure_message_for_should.should == "expected #{person.inspect} to accept values \"INVALID\" for :gender, but it was not\n\nValue: \"INVALID\"\tErrors: gender is not included in the list"
19
19
  end
20
20
  it "should assign the old value for attribute" do
21
21
  accept_values_for_object.matches?(person)
@@ -27,7 +27,21 @@ describe "AcceptValuesFor" do
27
27
  it { should eq(false) }
28
28
  it "should have correct failure message for should" do
29
29
  accept_values_for_object.matches?(person)
30
- accept_values_for_object.failure_message_for_should.should == "expected #{person.inspect} to accept values \"INVALID\", \"WRONG\" for :gender, but it was not\n\nValue: INVALID\tErrors: gender is not included in the list\nValue: WRONG\tErrors: gender is not included in the list"
30
+ accept_values_for_object.failure_message_for_should.should == "expected #{person.inspect} to accept values \"INVALID\", \"WRONG\" for :gender, but it was not\n\nValue: \"INVALID\"\tErrors: gender is not included in the list\nValue: \"WRONG\"\tErrors: gender is not included in the list"
31
+ end
32
+ end
33
+ context "when not accepte values of different types" do
34
+ let(:values) { ['INVALID', nil, 1] }
35
+ it { should eq(false) }
36
+ it "should have correct failure message for should" do
37
+ accept_values_for_object.matches?(person)
38
+ accept_values_for_object.failure_message_for_should.should == <<MSG.strip
39
+ expected #{person.inspect} to accept values nil, 1, \"INVALID\" for :gender, but it was not
40
+
41
+ Value: nil\tErrors: gender is not included in the list
42
+ Value: 1\tErrors: gender is not included in the list
43
+ Value: \"INVALID\"\tErrors: gender is not included in the list
44
+ MSG
31
45
  end
32
46
  end
33
47
  context "when one value is accept and other is not" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: accept_values_for
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bogdan Gusiev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-19 00:00:00.000000000 Z
11
+ date: 2015-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  version: '0'
124
124
  requirements: []
125
125
  rubyforge_project:
126
- rubygems_version: 2.2.2
126
+ rubygems_version: 2.4.5
127
127
  signing_key:
128
128
  specification_version: 4
129
129
  summary: Test complex Active Record validations with RSpec