Sha256: fcde4ad3f3ab8740ec6dc3579ec9232344808dfcdfb806aa9a861231638dac3f

Contents?: true

Size: 488 Bytes

Versions: 4

Compression:

Stored size: 488 Bytes

Contents

require "spec_helper"

describe "equalizer" do
  it "uses #to_h for comparison" do
    class Test::Foo < Evil::Struct
      attribute :foo
    end

    expect(Test::Foo.new foo: "bar").to eq foo: "bar"
    expect(Test::Foo.new foo: "bar").to eq double(to_h: { foo: "bar" })
  end

  it "makes struct not equal to nil" do
    class Test::Foo < Evil::Struct
      attribute :foo, optional: true
    end

    expect(Test::Foo.new).to eq({})
    expect(Test::Foo.new).not_to eq nil
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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