public
Rubygem
Fork of thoughtbot/shoulda
Description: Makes tests easy on the fingers and the eyes
Homepage: http://www.thoughtbot.com/projects/shoulda
Clone URL: git://github.com/technicalpickles/shoulda.git
removed message option from should_allow_values_for (gary.tsang - 
lighthouse #24)

git-svn-id: https://svn.thoughtbot.com/plugins/shoulda/trunk@381 
7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
tsaleh (author)
Mon Mar 10 07:32:06 -0700 2008
commit  b21218df9973d42a3f3e277e2156158b5f694288
tree    bfbdef71e739d54328371b9d20e0c3269da8f450
parent  5afd6023adc4fcd1a77767d3fcae9c59fe824748
...
136
137
138
139
140
141
142
143
144
145
146
147
148
 
149
150
151
152
153
154
155
 
156
157
158
...
136
137
138
 
 
 
 
139
140
141
142
 
 
143
144
145
146
147
148
149
 
150
151
152
153
0
@@ -136,23 +136,18 @@ module ThoughtBot # :nodoc:
0
       # Ensures that the attribute can be set to the given values.
0
       # Requires an existing record
0
       #
0
- # Options:
0
- # * <tt>:message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>.
0
- # Regexp or string. Default = <tt>/invalid/</tt>
0
- #
0
       # Example:
0
       # should_allow_values_for :isbn, "isbn 1 2345 6789 0", "ISBN 1-2345-6789-0"
0
       #
0
       def should_allow_values_for(attribute, *good_values)
0
- message = get_options!(good_values, :message)
0
- message ||= /invalid/
0
+ get_options!(good_values)
0
         klass = model_class
0
         good_values.each do |v|
0
           should "allow #{attribute} to be set to \"#{v}\"" do
0
             assert object = klass.find(:first), "Can't find first #{klass}"
0
             object.send("#{attribute}=", v)
0
             object.save
0
- assert_does_not_contain(object.errors.on(attribute), message, "when set to \"#{v}\"")
0
+ assert_nil object.errors.on(attribute)
0
           end
0
         end
0
       end

Comments

    No one has commented yet.