public
Description: I suppose it's a document database. Or a tuple store. But really, it's just data sloshing around, waiting to be used.
Clone URL: git://github.com/lazyatom/soup.git
We should be able to delete snips
lazyatom (author)
Wed Jul 02 14:32:00 -0700 2008
commit  bd83db1d3e0b31309f3b0ab011774c9369f9ce45
tree    a2de8c7ba83308c985a42bbb60a9fa16d5bc8726
parent  ebe4da49d6419a03be34601c1eff28457a770434
...
80
81
82
 
 
 
 
 
83
84
85
...
80
81
82
83
84
85
86
87
88
89
90
0
@@ -80,6 +80,11 @@ module Soup
0
     results.length == 1 ? results.first : results
0
   end
0
   
0
+ def self.destroy(snip_name)
0
+ snip = sieve(:name => snip_name)[0]
0
+ snip.destroy
0
+ end
0
+
0
   # ==== (interface ends) =====
0
   
0
   # Save the current state of the soup into a YAML file.
...
145
146
147
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
149
...
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
0
@@ -145,4 +145,22 @@ describe Soup do
0
       Soup[:powers => 'yes'].should == [@james, @murray]
0
     end
0
   end
0
+
0
+ describe "when deleting snips" do
0
+ before(:each) do
0
+ Soup.base = {:database => "soup_test.db"}
0
+ Soup.flavour = :active_record
0
+ Soup.prepare
0
+ clear_database
0
+ end
0
+
0
+ it "should allow deletion of snips" do
0
+ snip = Soup << {:name => 'test', :content => 'content'}
0
+ Soup['test'].should == snip
0
+
0
+ Soup.destroy('test')
0
+ Soup['test'].should be_empty
0
+ end
0
+
0
+ end
0
 end
0
\ No newline at end of file

Comments

    No one has commented yet.