Sha256: f39189ff9dc8462a629f8b739497ce6c9d214a155b36cd63c2d14f5e14b88490

Contents?: true

Size: 767 Bytes

Versions: 4

Compression:

Stored size: 767 Bytes

Contents

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

describe Daijobu::Scheme::Eval do
  
  before do
    @scheme = Daijobu::Scheme::Eval.new
  end
  
  describe "#parse" do
    before do
      @stringy = '{ "thing" => 10 }'
    end
    
    it "should parse the given string using Kernel::eval" do
      @scheme.expects(:eval).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 inspect the given object" do
      @hashy.expects(:inspect)
      @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/eval_spec.rb
sander6-daijobu-0.1.1 spec/daijobu/schemes/eval_spec.rb
sander6-daijobu-0.2.0 spec/daijobu/schemes/eval_spec.rb
sander6-daijobu-0.2.1 spec/daijobu/schemes/eval_spec.rb