shoulda-matchers 1.5.5 → 1.5.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shoulda-matchers (1.5.5)
4
+ shoulda-matchers (1.5.6)
5
5
  activesupport (>= 3.0.0)
6
6
  bourne (~> 1.3)
7
7
 
data/NEWS.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # HEAD
2
2
 
3
+ # v 1.5.6
4
+ * Revert previous change in `AllowValueMatcher` that added a check for a
5
+ properly-set attribute.
6
+
3
7
  # v 1.5.5
4
8
  * `AllowValueMatcher` checks that the right value is used for attempts at
5
9
  setting the attribute with it
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/melissaxie/thoughtbot/shoulda-matchers
3
3
  specs:
4
- shoulda-matchers (1.5.5)
4
+ shoulda-matchers (1.5.6)
5
5
  activesupport (>= 3.0.0)
6
6
  bourne (~> 1.3)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/melissaxie/thoughtbot/shoulda-matchers
3
3
  specs:
4
- shoulda-matchers (1.5.5)
4
+ shoulda-matchers (1.5.6)
5
5
  activesupport (>= 3.0.0)
6
6
  bourne (~> 1.3)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/melissaxie/thoughtbot/shoulda-matchers
3
3
  specs:
4
- shoulda-matchers (1.5.5)
4
+ shoulda-matchers (1.5.6)
5
5
  activesupport (>= 3.0.0)
6
6
  bourne (~> 1.3)
7
7
 
@@ -56,9 +56,10 @@ module Shoulda # :nodoc:
56
56
  def matches?(instance)
57
57
  self.instance = instance
58
58
 
59
- values_to_match.all? do |current_value|
60
- set_attribute_on_instance(current_value)
61
- matches_attribute_value?(current_value) && errors_do_not_match?
59
+ values_to_match.none? do |value|
60
+ self.value = value
61
+ instance.send("#{attribute}=", value)
62
+ errors_match?
62
63
  end
63
64
  end
64
65
 
@@ -79,21 +80,12 @@ module Shoulda # :nodoc:
79
80
  attr_accessor :values_to_match, :message_finder_factory,
80
81
  :instance, :attribute, :value, :matched_error
81
82
 
82
- def set_attribute_on_instance(current_value)
83
- self.value = current_value
84
- instance.send("#{attribute}=", current_value)
83
+ def errors_match?
84
+ has_messages? && errors_for_attribute_match?
85
85
  end
86
86
 
87
- def matches_attribute_value?(current_value)
88
- instance.send(attribute.to_sym) == current_value
89
- end
90
-
91
- def errors_do_not_match?
92
- has_no_messages? || !errors_for_attribute_match?
93
- end
94
-
95
- def has_no_messages?
96
- !message_finder.has_messages?
87
+ def has_messages?
88
+ message_finder.has_messages?
97
89
  end
98
90
 
99
91
  def errors_for_attribute_match?
@@ -1,5 +1,5 @@
1
1
  module Shoulda
2
2
  module Matchers
3
- VERSION = '1.5.5'.freeze
3
+ VERSION = '1.5.6'.freeze
4
4
  end
5
5
  end
@@ -79,13 +79,6 @@ describe Shoulda::Matchers::ActiveModel::EnsureInclusionOfMatcher do
79
79
  end
80
80
 
81
81
  context 'an attribute which must be included in an array' do
82
- context 'given an attribute that does not accept strings' do
83
- it 'allows an attribute to be set as an integer' do
84
- validating_inclusion(:in => [0,1,2], :column_type => :integer).
85
- should ensure_inclusion_of(:attr).in_array([0,1,2])
86
- end
87
- end
88
-
89
82
  it 'accepts with correct array' do
90
83
  validating_inclusion(:in => %w(one two)).
91
84
  should ensure_inclusion_of(:attr).in_array(%w(one two))
@@ -172,9 +165,7 @@ describe Shoulda::Matchers::ActiveModel::EnsureInclusionOfMatcher do
172
165
  end
173
166
 
174
167
  def validating_inclusion(options)
175
- options[:column_type] ||= :string
176
-
177
- define_model(:example, :attr => options[:column_type]) do
168
+ define_model(:example, :attr => :string) do
178
169
  validates_inclusion_of :attr, options
179
170
  end.new
180
171
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shoulda-matchers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.5
4
+ version: 1.5.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2013-03-28 00:00:00.000000000 Z
17
+ date: 2013-03-29 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: activesupport
@@ -309,7 +309,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
309
309
  version: '0'
310
310
  segments:
311
311
  - 0
312
- hash: -727795483328027229
312
+ hash: 1811541480195488740
313
313
  required_rubygems_version: !ruby/object:Gem::Requirement
314
314
  none: false
315
315
  requirements:
@@ -318,7 +318,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
318
318
  version: '0'
319
319
  segments:
320
320
  - 0
321
- hash: -727795483328027229
321
+ hash: 1811541480195488740
322
322
  requirements: []
323
323
  rubyforge_project:
324
324
  rubygems_version: 1.8.25