Sha256: 9f6d36f06762e1eb0074654e84a2ec98d69bd35d713c98417636847ac61d3a0a

Contents?: true

Size: 802 Bytes

Versions: 4

Compression:

Stored size: 802 Bytes

Contents

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

describe Daijobu::Scheme::JSON do
  
  before do
    @scheme = Daijobu::Scheme::JSON.new
  end
  
  describe "#parse" do
    before do
      @stringy = '{ "thing" : 10 }'
    end
    
    it "should parse the given string with the JSON module" do
      ::JSON.expects(:parse).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
      ::JSON.expects(:unparse).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/json_spec.rb
sander6-daijobu-0.1.1 spec/daijobu/schemes/json_spec.rb
sander6-daijobu-0.2.0 spec/daijobu/schemes/json_spec.rb
sander6-daijobu-0.2.1 spec/daijobu/schemes/json_spec.rb