spec/daijobu/scheme_set_spec.rb in sander6-daijobu-0.1.1 vs spec/daijobu/scheme_set_spec.rb in sander6-daijobu-0.2.0

- old
+ new

@@ -17,15 +17,22 @@ schemes[1].should be_an_instance_of(Daijobu::Scheme::JSON) schemes[2].should be_an_instance_of(Daijobu::Scheme::YAML) schemes[3].should be_an_instance_of(Daijobu::Scheme::Eval) end + it "should accept an array of schemes" do + lambda { Daijobu::SchemeSet.new([:json, :yaml]) }.should_not raise_error + end + + it "should accept a single scheme" do + lambda { Daijobu::SchemeSet.new(:json) }.should_not raise_error + end end describe "initialization with a specified scheme pattern" do before do - @scheme_set = Daijobu::SchemeSet.new(:eval, :yaml) + @scheme_set = Daijobu::SchemeSet.new([:eval, :yaml]) end it "should have the proper schemes in the given order" do schemes = @scheme_set.instance_variable_get(:@schemes) schemes[0].should be_an_instance_of(Daijobu::Scheme::Eval) @@ -80,11 +87,11 @@ end end describe "#parse" do before do - @scheme_set = Daijobu::SchemeSet.new(:json) + @scheme_set = Daijobu::SchemeSet.new([:json]) @stringy = '{ "thing" : 10 }' @hashy = { "thing" => 10 } end describe "assuming that the string can be parsed" do @@ -116,11 +123,11 @@ describe "#parse, when the first (or any earlier) scheme doesn't work" do before do @stringy = '{ "thing" : 10 }' @hashy = { "thing" => 10 } - @scheme_set = Daijobu::SchemeSet.new(:marshal, :yaml, :json) + @scheme_set = Daijobu::SchemeSet.new([:marshal, :yaml, :json]) @schemes = @scheme_set.instance_variable_get(:@schemes) @marshal_scheme = @schemes[0] @yaml_scheme = @schemes[1] @json_scheme = @schemes[2] end @@ -134,11 +141,11 @@ end end describe "#unparse" do before do - @scheme_set = Daijobu::SchemeSet.new(:json) + @scheme_set = Daijobu::SchemeSet.new([:json]) @stringy = '{ "thing" : 10 }' @hashy = { "thing" => 10 } end describe "assuming that the object can be unparsed" do @@ -170,10 +177,10 @@ describe "#unparse, when the first (or any earlier) scheme doesn't work" do before do @stringy = '{ "thing" : 10 }' @hashy = { "thing" => 10 } - @scheme_set = Daijobu::SchemeSet.new(:marshal, :yaml, :json) + @scheme_set = Daijobu::SchemeSet.new([:marshal, :yaml, :json]) @schemes = @scheme_set.instance_variable_get(:@schemes) @marshal_scheme = @schemes[0] @yaml_scheme = @schemes[1] @json_scheme = @schemes[2] end \ No newline at end of file