Sha256: fa0c12d0cb4450f2ceba348919a026a80c43fb844a256b06fd2b596924aab25e

Contents?: true

Size: 374 Bytes

Versions: 2

Compression:

Stored size: 374 Bytes

Contents

require "ostruct"

describe "OpenStruct#[]" do
  before :each do
    @os = OpenStruct.new
  end

  ruby_version_is ""..."2.0" do
    it "raises a NoMethodError" do
      lambda { @os[:foo] }.should raise_error(NoMethodError)
    end
  end

  ruby_version_is "2.0" do
    it "returns the associated value" do
      @os.foo = 42
      @os[:foo].should == 42
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubysl-ostruct-2.0.4 spec/element_reference_spec.rb
rubysl-ostruct-1.0.0 spec/element_reference_spec.rb