Sha256: feee035f719d8221a203173d94e99e021151840b3e1c571ec8bd7fbec63e8ccd
Contents?: true
Size: 958 Bytes
Versions: 1
Compression:
Stored size: 958 Bytes
Contents
require "spec_helper_lite" describe Undo::Model do subject { described_class } let(:model) { subject.new object } let(:object) { double :object } describe "#uuid" do it "using object#uuid" do expect(object).to receive(:uuid) { "123" } expect(model.uuid).to eq "123" end context "object do not respond to #uuid" do it "using configured uuid gerenator" do model = subject.new object, uuid_generator: proc { "123" } expect(model.uuid).to eq "123" end it "using SecureRandom uuid gerenator by default" do expect(SecureRandom).to receive(:uuid) { "123" } expect(model.uuid).to eq "123" end it "passes object to custom uuid gerenator" do uuid_generator = double :uuid_generator expect(uuid_generator).to receive(:call).with(object) model = subject.new object, uuid_generator: uuid_generator model.uuid end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
undo-0.0.1 | spec/undo/model_spec.rb |