Sha256: 406a33982726780bc05f2712c0be2d38d9be8eccccfe1dca641e316abb44d1f4

Contents?: true

Size: 874 Bytes

Versions: 25

Compression:

Stored size: 874 Bytes

Contents

shared_examples_for 'a relation that returns one tuple' do
  describe '#one' do
    it 'returns first tuple' do
      users_relation.delete(name: 'Joe', email: 'joe@doe.org')
      expect(relation.one).to eql(name: 'Jane', email: 'jane@doe.org')
    end

    it 'raises error when there is more than one tuple' do
      expect { relation.one }.to raise_error(ROM::TupleCountMismatchError)
    end
  end

  describe '#one!' do
    it 'returns first tuple' do
      users_relation.delete(name: 'Joe', email: 'joe@doe.org')
      expect(relation.one!).to eql(name: 'Jane', email: 'jane@doe.org')
    end

    it 'raises error when there is no tuples' do
      users_relation.delete(name: 'Jane', email: 'jane@doe.org')
      users_relation.delete(name: 'Joe', email: 'joe@doe.org')

      expect { relation.one! }.to raise_error(ROM::TupleCountMismatchError)
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
rom-3.3.3 spec/shared/one_behavior.rb
rom-3.3.2 spec/shared/one_behavior.rb
rom-3.3.1 spec/shared/one_behavior.rb
rom-3.3.0 spec/shared/one_behavior.rb
rom-3.2.3 spec/shared/one_behavior.rb
rom-3.2.2 spec/shared/one_behavior.rb
rom-3.2.1 spec/shared/one_behavior.rb
rom-3.2.0 spec/shared/one_behavior.rb
rom-3.1.0 spec/shared/one_behavior.rb
rom-3.0.3 spec/shared/one_behavior.rb
rom-3.0.2 spec/shared/one_behavior.rb
rom-3.0.1 spec/shared/one_behavior.rb
rom-3.0.0 spec/shared/one_behavior.rb
rom-3.0.0.rc2 spec/shared/one_behavior.rb
rom-3.0.0.rc1 spec/shared/one_behavior.rb
rom-3.0.0.beta3 spec/shared/one_behavior.rb
rom-3.0.0.beta2 spec/shared/one_behavior.rb
rom-3.0.0.beta1 spec/shared/one_behavior.rb
rom-2.0.2 spec/shared/one_behavior.rb
rom-2.0.1 spec/shared/one_behavior.rb