Sha256: d24eca55c0d5290a9733d3ba2fe4b94eb8b0362d76b0bf2208e1f99be26720d4
Contents?: true
Size: 1.16 KB
Versions: 2
Compression:
Stored size: 1.16 KB
Contents
require File.expand_path("../../teststrap", __FILE__) describe ConfigLeaf do describe ".wrap" do it "should fail without a block" do lambda { ConfigLeaf.wrap Object.new }.should raise_error ArgumentError, "block is required" end context "without block arguments" do it "should alter the context to that of the wrapper within the block" do passed = nil ConfigLeaf.wrap Object.new do passed = self end passed.should be_kind_of ConfigLeaf::Wrapper end end context "with block arguments" do it "should pass object into the block" do object = Object.new passed = nil ConfigLeaf.wrap object do |x| passed = x end passed.should eq object end it "should not alter the context in the block" do object = Object.new block_self = nil original_self = self ConfigLeaf.wrap object do |x| block_self = self end # Use id or the two rspec contexts will barf. original_self.__id__.should eq block_self.__id__ end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
config_leaf-0.0.2 | spec/config_leaf/config_leaf_spec.rb |
config_leaf-0.0.1 | spec/config_leaf/config_leaf_spec.rb |