soup 0.9.11 → 0.9.12
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/soup/backends/yaml_backend.rb +3 -3
- data/test/soup_test.rb +5 -0
- metadata +2 -2
data/Rakefile
CHANGED
@@ -45,9 +45,9 @@ class Soup
|
|
45
45
|
|
46
46
|
def save_snip(attributes)
|
47
47
|
File.open(path_for(attributes[:name]), 'w') do |f|
|
48
|
-
|
49
|
-
f.write content
|
50
|
-
f.write
|
48
|
+
attributes_without_content = attributes.dup
|
49
|
+
f.write attributes_without_content.delete(:content)
|
50
|
+
f.write attributes_without_content.to_yaml.gsub(/^---\s/, ATTRIBUTE_TOKEN) if attributes_without_content.any?
|
51
51
|
end
|
52
52
|
Snip.new(attributes, self)
|
53
53
|
end
|
data/test/soup_test.rb
CHANGED
@@ -27,6 +27,11 @@ class SoupTest < Test::Unit::TestCase
|
|
27
27
|
assert_equal "I like stuff, and things", @soup['test'].content
|
28
28
|
end
|
29
29
|
|
30
|
+
should "return a snip when storing content" do
|
31
|
+
snip = @soup << {:name => 'test', :content => "I like stuff, and things"}
|
32
|
+
assert_equal "I like stuff, and things", snip.content
|
33
|
+
end
|
34
|
+
|
30
35
|
context "when sieving the soup" do
|
31
36
|
setup do
|
32
37
|
@james = @soup << {:name => 'james', :spirit_guide => 'fox', :colour => 'blue', :powers => 'yes'}
|