spec/block_spec.rb in mutaconf-0.0.7 vs spec/block_spec.rb in mutaconf-0.1.0

- old
+ new

@@ -2,36 +2,36 @@ describe Mutaconf::DSL do let(:target){ {} } let(:dsl){ Mutaconf::DSL.new options } - let(:options){ { target: target } } + let(:options){ { attrs: { target => true } } } it "should configure properties with instance evaluation" do result = dsl.configure do a 'b' c 'd' end expected = { a: 'b', c: 'd' } - result.should be(target) + result.should be(dsl) target.should == expected end it "should configure properties with a configuration object" do result = dsl.configure do |config| config.e = 'f' config.g = 'h' config.i = 'j' end expected = { e: 'f', g: 'h', i: 'j' } - result.should be(target) + result.should be(dsl) target.should == expected end context "with restricted keys" do - let(:options){ { target: target, keys: [ :a ] } } + let(:options){ { attrs: { target => [ :a ] } } } it "should raise a key error for a unknown key with instance evaluation" do lambda{ dsl.configure{ b 'c' } }.should raise_error(Mutaconf::KeyError, /'b'/) end @@ -40,21 +40,21 @@ end end context "with restricted keys in lenient mode" do - let(:options){ { target: target, keys: [ :a, :e ], lenient: true } } + let(:options){ { attrs: { target => [ :a, :e ] }, lenient: true } } it "should configure restricted properties with instance evaluation" do result = dsl.configure do a 'b' c 'd' e 'f' g 'h' end expected = { a: 'b', e: 'f' } - result.should be(target) + result.should be(dsl) target.should == expected end it "should configure restricted properties with a configuration object" do result = dsl.configure do |config| @@ -62,10 +62,10 @@ config.c = 'd' config.e = 'f' config.g = 'h' end expected = { a: 'b', e: 'f' } - result.should be(target) + result.should be(dsl) target.should == expected end end end