public
Rubygem
Description: Extras for DataMapper, including bridges to DataObjects::Migrations and Merb::DataMapper
Homepage: http://datamapper.org
Clone URL: git://github.com/sam/dm-more.git
default task is spec. failing spec for [#257]. fix for [#257]
Adam French (author)
Wed May 07 10:10:06 -0700 2008
commit  a55dc09669177299de9d8c6f9d4a67bc8e9db980
tree    c54d16a93e1fb23913f71a2cd21298d1caa3f4b6
parent  b3da5cd121ad16e4763dbd4cdc51cb53ed49988f
...
42
43
44
 
 
45
...
42
43
44
45
46
47
0
@@ -42,3 +42,5 @@ Spec::Rake::SpecTask.new('spec') do |t|
0
   t.spec_opts = ["--format", "specdoc", "--colour"]
0
   t.spec_files = Pathname.glob(Pathname.new(__FILE__).parent.join("spec").join("**").join("*_spec.rb"))
0
 end
0
+
0
+task :default => ['spec']
0
\ No newline at end of file
...
9
10
11
12
 
13
14
15
...
9
10
11
 
12
13
14
15
0
@@ -9,7 +9,7 @@ module DataMapper
0
       end
0
       
0
       def call(target)
0
-        includes = @options[:set].include?(target.instance_variable_get("@#{@field_name}"))
0
+        includes = @options[:set].include?(target.attribute_get(field_name))
0
         return true if includes    
0
         
0
         s = ''
...
823
824
825
 
 
 
 
 
 
 
826
827
828
...
833
834
835
 
 
 
 
 
836
837
838
...
823
824
825
826
827
828
829
830
831
832
833
834
835
...
840
841
842
843
844
845
846
847
848
849
850
0
@@ -823,6 +823,13 @@ end
0
         property :type_of_number, String, :auto_validation => false   
0
         validates_within :type_of_number, :set => ['Home','Work','Cell']   
0
       end
0
+      
0
+      class Reciever
0
+        include DataMapper::Resource
0
+        include DataMapper::Validate
0
+        property :holder, String, :auto_validation => false, :default => 'foo'
0
+        validates_within :holder, :set => ['foo', 'bar', 'bang']
0
+      end
0
     end
0
     
0
     it "should validate a value on an instance of a resource within a predefined set of values" do
0
@@ -833,6 +840,11 @@ end
0
       tel.type_of_number = 'Cell'
0
       tel.valid?.should == true
0
     end
0
+    
0
+    it "should validate a value by it's default" do
0
+      tel = Reciever.new
0
+      tel.should be_valid
0
+    end
0
   end  
0
 
0
   #-------------------------------------------------------------------------------

Comments