Sha256: 8cb6315ac4c63096d04f5921824548642e9ae4d7437c5375f78d53974a5eaf77

Contents?: true

Size: 800 Bytes

Versions: 1

Compression:

Stored size: 800 Bytes

Contents

shared_examples "undo integration" do
  subject { Undo }
  let(:object) { Hash.new hello: :world }

  it "stores and restores object" do
    uuid = subject.store object
    expect(subject.restore uuid).to eq object
  end

  it "deletes stored object" do
    uuid = subject.store object
    subject.delete uuid
    expect { subject.restore uuid }.to raise_error(KeyError)
  end

  it "delete an unexisted key does not raise an error" do
    expect { subject.delete "does not exist" }.not_to raise_error
  end

  describe "special cases" do
    it "stores and restores nil" do
      uuid = subject.store nil
      expect(subject.restore uuid).to eq nil
    end

    it "stores and restores array" do
      uuid = subject.store [1,2,3]
      expect(subject.restore uuid).to eq [1,2,3]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
undo-1.0.0 lib/undo/integration/shared_undo_integration_examples.rb