Sha256: dd93f44d4595a2143b3f1ab336b3578782074451972d6a8491fac27feb21fdca

Contents?: true

Size: 1.13 KB

Versions: 11

Compression:

Stored size: 1.13 KB

Contents

shared_examples_for "decoration-aware #==" do |subject|
  it "is true for itself" do
    expect(subject == subject).to be_truthy
  end

  it "is false for another object" do
    expect(subject == Object.new).to be_falsey
  end

  it "is true for a decorated version of itself" do
    decorated = double(object: subject, decorated?: true)

    expect(subject == decorated).to be_truthy
  end

  it "is false for a decorated other object" do
    decorated = double(object: Object.new, decorated?: true)

    expect(subject == decorated).to be_falsey
  end

  it "is false for a decoratable object with a `object` association" do
    decoratable = double(object: subject, decorated?: false)

    expect(subject == decoratable).to be_falsey
  end

  it "is false for an undecoratable object with a `object` association" do
    undecoratable = double(object: subject)

    expect(subject == undecoratable).to be_falsey
  end

  it "is true for a multiply-decorated version of itself" do
    decorated = double(object: subject, decorated?: true)
    redecorated = double(object: decorated, decorated?: true)

    expect(subject == redecorated).to be_truthy
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
draper-4.0.2 spec/support/shared_examples/decoratable_equality.rb
draper-4.0.1 spec/support/shared_examples/decoratable_equality.rb
draper-4.0.0 spec/support/shared_examples/decoratable_equality.rb
draper-3.1.0 spec/support/shared_examples/decoratable_equality.rb
draper-3.0.1 spec/support/shared_examples/decoratable_equality.rb
draper-3.0.0 spec/support/shared_examples/decoratable_equality.rb
draper-3.0.0.pre1 spec/support/shared_examples/decoratable_equality.rb
draper_new-3.0.0 spec/support/shared_examples/decoratable_equality.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/draper-2.1.0/spec/support/shared_examples/decoratable_equality.rb
draper-2.1.0 spec/support/shared_examples/decoratable_equality.rb
draper-2.0.0 spec/support/shared_examples/decoratable_equality.rb