Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed specs.

  • Loading branch information...
commit 19d6c9829a297c4140f7b3e772ac3e05035abf96 1 parent 4fcebcd
Sam Smoot sam authored
6 lib/data_mapper/types/yaml.rb
@@ -11,7 +11,7 @@ def self.load(value)
11 11 if value.nil?
12 12 nil
13 13 elsif value.is_a?(String)
14   - YAML.parse(value)
  14 + ::YAML.load(value)
15 15 else
16 16 raise ArgumentError.new("+value+ must be nil or a String")
17 17 end
@@ -20,8 +20,10 @@ def self.load(value)
20 20 def self.dump(value)
21 21 if value.nil?
22 22 nil
  23 + elsif value.is_a?(String) && value =~ /^---/
  24 + value
23 25 else
24   - YAML.dump(value)
  26 + ::YAML.dump(value)
25 27 end
26 28 end
27 29 end # class Yaml
6 spec/integration/type_spec.rb
@@ -42,16 +42,14 @@ class Coconut
42 42 Blue Goose, 5, 1
43 43 EOS
44 44
45   - @stuff = <<-EOS.margin
46   - Happy Cow!: true,
47   - Sad Cow!: false
48   - EOS
  45 + @stuff = YAML::dump({ 'Happy Cow!' => true, 'Sad Cow!' => false })
49 46 end
50 47
51 48 it "should instantiate an object with custom types" do
52 49 coconut = TypeTests::Coconut.new(:faked => 'bob', :document => @document, :stuff => @stuff)
53 50 coconut.faked.should == 'bob'
54 51 coconut.document.should be_a_kind_of(Array)
  52 + p coconut.stuff
55 53 coconut.stuff.should be_a_kind_of(Hash)
56 54 end
57 55

0 comments on commit 19d6c98

Please sign in to comment.
Something went wrong with that request. Please try again.