public
Description: Library for accessing ThruDB documents.
Clone URL: git://github.com/technoweenie/activedocument.git
Add ActiveDocument::Schema#include?
technoweenie (author)
Wed Jan 16 17:46:31 -0800 2008
commit  82efef67eb2adb1fe7c4af1f9afcbddc190ce659
tree    c2eed7ade18becf6084641eb5c1ca09671527710
parent  5832f33388f2f845878ae4e963d8afd79a9b3b7c
...
31
32
33
 
 
 
 
34
35
36
...
31
32
33
34
35
36
37
38
39
40
0
@@ -31,6 +31,10 @@ module ActiveDocument
0
       @property_index[key] = value
0
     end
0
     
0
+ def include?(key)
0
+ !@property_index[key].nil?
0
+ end
0
+
0
     class Property
0
       attr_reader :name
0
 
...
16
17
18
19
 
20
21
22
...
38
39
40
 
 
 
 
 
 
 
 
41
42
...
16
17
18
 
19
20
21
22
...
38
39
40
41
42
43
44
45
46
47
48
49
50
0
@@ -16,7 +16,7 @@ describe ActiveDocument::Schema do
0
     end
0
   end
0
   
0
- describe "#property" do
0
+ describe "#property(type, name)" do
0
     before :all do
0
       @adding_property = lambda do
0
         MockRecord::Generic.schema { property :string, :name }
0
@@ -38,4 +38,12 @@ describe ActiveDocument::Schema do
0
       MockRecord::Generic.schema[:name].should == ActiveDocument::Schema::StringProperty.new(:name)
0
     end
0
   end
0
+
0
+ describe "#include?" do
0
+ it "knows if the given property has been created" do
0
+ MockRecord::Generic.schema { property :string, :name }
0
+ MockRecord::Generic.schema.should include(:name)
0
+ MockRecord::Generic.schema.should_not include(:foo)
0
+ end
0
+ end
0
 end
0
\ No newline at end of file

Comments

    No one has commented yet.