spec/kamerling/repo_spec.rb in kamerling-0.0.1 vs spec/kamerling/repo_spec.rb in kamerling-0.0.2

- old
+ new

@@ -1,9 +1,9 @@ require_relative '../spec_helper' module Kamerling describe Repo do - Tune = Kamerling.UUIDObject :genre + Tune = Class.new(UUIDEntity) { attribute :genre, Symbol } describe '#<<' do it 'passes the Hash version of an object to the source' do tune = Tune.new genre: :chap_hop source = fake Sequel::Dataset @@ -13,11 +13,11 @@ it 'updates the source’s version if it exists there' do dataset = fake Sequel::Dataset source = fake Sequel::Dataset tune = Tune.new genre: :chap_hop - stub(source).<<(tune.to_h) { raise Sequel::UniqueConstraintViolation } + stub(source).<<(tune.to_h) { fail Sequel::UniqueConstraintViolation } stub(source).where(uuid: tune.uuid) { dataset } Repo.new(Tune, source) << tune dataset.must_have_received :update, [tune.to_h] end end @@ -37,10 +37,10 @@ describe '#all' do it 'returns all objects' do tune = Tune.new genre: :chap_hop, uuid: UUID.new source = fake Sequel::Dataset, - all: [{ genre: :chap_hop, uuid: tune.uuid }] + all: [{ genre: :chap_hop, uuid: tune.uuid }] Repo.new(Tune, source).all.must_equal [tune] end end describe '#related_to' do