spec/unit/rom/setup_spec.rb in rom-0.6.2 vs spec/unit/rom/setup_spec.rb in rom-0.7.0

- old
+ new

@@ -34,27 +34,27 @@ end it 'can register multiple relations with same dataset' do setup = ROM.setup(:memory) - Class.new(ROM::Relation[:memory]) { + Class.new(ROM::Relation[:memory]) do dataset :fruits register_as :apples def apple? true end - } + end - Class.new(ROM::Relation[:memory]) { + Class.new(ROM::Relation[:memory]) do dataset :fruits register_as :oranges def orange? true end - } + end rom = setup.finalize expect(rom.relations.apples).to be_apple expect(rom.relations.oranges).to be_orange @@ -62,18 +62,18 @@ end it "raises an error when registering relations with the same `register_as`" do setup = ROM.setup(:memory) - Class.new(ROM::Relation[:memory]) { + Class.new(ROM::Relation[:memory]) do dataset :guests register_as :users - } + end - Class.new(ROM::Relation[:memory]) { + Class.new(ROM::Relation[:memory]) do dataset :admins register_as :users - } + end expect { setup.finalize }.to raise_error( ROM::RelationAlreadyDefinedError, /register_as :users/ ) end