Permalink
Browse files

Fixed specs.

  • Loading branch information...
1 parent 4fcebcd commit 19d6c9829a297c4140f7b3e772ac3e05035abf96 @sam sam committed Apr 10, 2008
Showing with 6 additions and 6 deletions.
  1. +4 −2 lib/data_mapper/types/yaml.rb
  2. +2 −4 spec/integration/type_spec.rb
@@ -11,7 +11,7 @@ def self.load(value)
if value.nil?
nil
elsif value.is_a?(String)
- YAML.parse(value)
+ ::YAML.load(value)
else
raise ArgumentError.new("+value+ must be nil or a String")
end
@@ -20,8 +20,10 @@ def self.load(value)
def self.dump(value)
if value.nil?
nil
+ elsif value.is_a?(String) && value =~ /^---/
+ value
else
- YAML.dump(value)
+ ::YAML.dump(value)
end
end
end # class Yaml
@@ -42,16 +42,14 @@ class Coconut
Blue Goose, 5, 1
EOS
- @stuff = <<-EOS.margin
- Happy Cow!: true,
- Sad Cow!: false
- EOS
+ @stuff = YAML::dump({ 'Happy Cow!' => true, 'Sad Cow!' => false })
end
it "should instantiate an object with custom types" do
coconut = TypeTests::Coconut.new(:faked => 'bob', :document => @document, :stuff => @stuff)
coconut.faked.should == 'bob'
coconut.document.should be_a_kind_of(Array)
+ p coconut.stuff
coconut.stuff.should be_a_kind_of(Hash)
end

0 comments on commit 19d6c98

Please sign in to comment.