spec/undo/wrapper_spec.rb in undo-0.1.0 vs spec/undo/wrapper_spec.rb in undo-0.1.1
- old
+ new
@@ -1,17 +1,15 @@
require "spec_helper_lite"
describe Undo::Wrapper do
subject { described_class }
- let(:model) { subject.new object, uuid }
+ let(:model) { subject.new object, uuid: uuid, mutator_methods: mutator_methods }
+ let(:mutator_methods) { [:change] }
let(:object) { double :object, change: true }
let(:uuid) { double :uuid }
describe "storage" do
- let(:model) { subject.new object, uuid, mutator_methods: mutator_methods }
- let(:mutator_methods) { [:change] }
-
it "stores object when mutator method is called" do
expect(model).to receive(:store)
model.change
end
end
@@ -23,9 +21,11 @@
describe "when object respond_to uuid" do
it "uses object#uuid instead" do
expect(object).to receive(:uuid) { "123" }
expect(model.uuid).to eq "123"
+ expect(Undo).to receive(:store).with(object, hash_including(uuid: "123"))
+ model.change
end
end
end
end