Sha256: 4b978c81c4f14b1af5d5a6ca504b9a7d63cbe166dcb0df8692988bdef8d71e87
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
require "spec_helper_lite" describe Undo do subject { described_class } describe "#wrap" do let(:object) { double :object, change: true } before do subject.configure do |config| config.mutator_methods = [:change] end end it "is a decorator" do object = [:a, :b] decorator = subject.wrap object expect(object).to receive(:some_method) decorator.some_method expect(object.class).to eq Array end it "restores object" do undoable_model = subject.wrap object undoable_model.change restored_object = subject.restore undoable_model.uuid expect(restored_object).to eq object end describe "with options" do it "restores using provided options" do storage = double expect(storage).to receive(:put) expect(storage).to receive(:fetch) { object } undoable_model = subject.wrap object, storage: storage undoable_model.change restored_object = subject.restore undoable_model.uuid, storage: storage expect(restored_object).to eq object end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
undo-0.0.1 | spec/undo_spec.rb |