public
Rubygem
Description: Makes tests easy on the fingers and the eyes
Homepage: http://www.thoughtbot.com/projects/shoulda
Clone URL: git://github.com/thoughtbot/shoulda.git
Adds failing test for detecting bug in should_ensure_length_at_least
thechrisoshow (author)
Tue Jul 01 02:56:51 -0700 2008
rmm5t (committer)
Fri Jul 11 17:56:08 -0700 2008
commit  8ba56581049dfbb427b99275f48889ef3fa9efb8
tree    6ecba792ccdf9fb4ae73217d31cbee0a6bfbfc5d
parent  13f5c2ae8228826f4d12f24a53ecf257659c9c67
...
1
2
3
 
 
 
4
...
1
2
3
4
5
6
7
0
@@ -1,4 +1,7 @@
0
 class Address < ActiveRecord::Base
0
   belongs_to :addressable, :polymorphic => true
0
   validates_uniqueness_of :title, :scope => [:addressable_type, :addressable_id]
0
+
0
+ validates_length_of :zip, :minimum => 5
0
+ validates_numericality_of :zip
0
 end
...
4
5
6
 
 
 
 
7
...
4
5
6
7
8
9
10
11
0
@@ -4,4 +4,8 @@ class AddressTest < Test::Unit::TestCase
0
   load_all_fixtures
0
   should_belong_to :addressable
0
   should_require_unique_attributes :title, :scoped_to => [:addressable_id, :addressable_type]
0
+
0
+
0
+ should_ensure_length_at_least :zip, 5
0
+ should_only_allow_numeric_values_for :zip
0
 end

Comments

    No one has commented yet.