Sha256: 754fba109bfbad2b1fd2d2c1e542ddd2ea4c558f3f810ab2b5d5bd141c4b9585

Contents?: true

Size: 619 Bytes

Versions: 1

Compression:

Stored size: 619 Bytes

Contents

require "spec_helper_lite"

describe Undo::Wrapper do
  subject do
    described_class.new(
      object,
      store_on: [:change]
    )
  end

  let(:object) { double :object, change: "changed" }

  describe "when mutation method is called" do
    it "calls the method and returns result" do
      expect(subject.change).to eq "changed"
    end

    it "stores object state" do
      expect(Undo).to receive(:store).with(object, anything)
      subject.change
    end

    it "does not store object state on another methods call" do
      expect(Undo).not_to receive(:store)
      subject.object_id
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
undo-wrapper-0.0.1 spec/undo/wrapper_spec.rb