spec/element_reference_spec.rb in rubysl-ostruct-2.0.4 vs spec/element_reference_spec.rb in rubysl-ostruct-2.1.0

- old
+ new

@@ -1,20 +1,15 @@ require "ostruct" describe "OpenStruct#[]" do before :each do - @os = OpenStruct.new + @os = OpenStruct.new(:foo => 42) end - ruby_version_is ""..."2.0" do - it "raises a NoMethodError" do - lambda { @os[:foo] }.should raise_error(NoMethodError) - end + it "returns the associated value using a symbol" do + @os[:foo].should == 42 end - ruby_version_is "2.0" do - it "returns the associated value" do - @os.foo = 42 - @os[:foo].should == 42 - end + it "returns the associated value using a string" do + @os["foo"].should == 42 end end