Sha256: b228306bb56102d62a3d5897607e40a2c25882e30a70009797e3782b6623d734

Contents?: true

Size: 796 Bytes

Versions: 4

Compression:

Stored size: 796 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe Daijobu::Scheme::YAML do

  before do
    @scheme = Daijobu::Scheme::YAML.new
  end
  
  describe "#parse" do
    before do
      @stringy = '{ "thing" : 10 }'
    end
    
    it "should parse the given string with the YAML module" do
      ::YAML.expects(:load).with(@stringy)
      @scheme.parse(@stringy)
    end
    
    describe "when the input string is nil" do
      it "should return nil" do
        @scheme.parse(nil).should be_nil
      end
    end
  end
  
  describe "#unparse" do
    before do
      @hashy = { "thing" => 10 }
    end
    
    it "should unparse the given object with the JSON module" do
      ::YAML.expects(:dump).with(@hashy)
      @scheme.unparse(@hashy)
    end    
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sander6-daijobu-0.1.0 spec/daijobu/schemes/yaml_spec.rb
sander6-daijobu-0.1.1 spec/daijobu/schemes/yaml_spec.rb
sander6-daijobu-0.2.0 spec/daijobu/schemes/yaml_spec.rb
sander6-daijobu-0.2.1 spec/daijobu/schemes/yaml_spec.rb