Sha256: b47f8cdb599a9757378c3a5ed3d1c13e281dcd4311525238162c8149ec604e3b

Contents?: true

Size: 712 Bytes

Versions: 6

Compression:

Stored size: 712 Bytes

Contents

shared_examples_for "a decoratable model" do
  describe ".decorate" do
    it "applies a collection decorator to a scope" do
      described_class.create
      decorated = described_class.limit(1).decorate

      expect(decorated).to have(1).items
      expect(decorated).to be_decorated
    end
  end

  describe "#==" do
    it "is true for other instances' decorators" do
      pending "Mongoid < 3.1 overrides `#==`" if defined?(Mongoid) && Mongoid::VERSION.to_f < 3.1 && described_class < Mongoid::Document

      described_class.create
      one = described_class.first
      other = described_class.first

      expect(one).not_to be other
      expect(one == other.decorate).to be_true
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
draper-1.4.0 spec/dummy/spec/shared_examples/decoratable.rb
draper-1.3.1 spec/dummy/spec/shared_examples/decoratable.rb
draper-1.3.0 spec/dummy/spec/shared_examples/decoratable.rb
draper-1.2.1 spec/dummy/spec/shared_examples/decoratable.rb
draper-1.2.0 spec/dummy/spec/shared_examples/decoratable.rb
jamesgolick-draper-1.1.1a spec/dummy/spec/shared_examples/decoratable.rb