Sha256: 870fdfac977c7e478a68952b9e51e683806627049c48c5a779555b0f9c28dc6f

Contents?: true

Size: 449 Bytes

Versions: 4

Compression:

Stored size: 449 Bytes

Contents

require "spec_helper"

describe "attributes" do
  before do
    class Test::Foo < Evil::Struct
      attribute :"some argument", as: "qux"
    end
  end

  let(:struct) { Test::Foo.new "some argument": "bar" }

  it "accessible via method" do
    expect(struct.qux).to eq "bar"
  end

  it "accessible by symbolic key" do
    expect(struct[:qux]).to eq "bar"
  end

  it "accessible by string key" do
    expect(struct["qux"]).to eq "bar"
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
evil-struct-0.0.4 spec/features/attributes_spec.rb
evil-struct-0.0.3 spec/features/attributes_spec.rb
evil-struct-0.0.2 spec/features/attributes_spec.rb
evil-struct-0.0.1 spec/features/attributes_spec.rb