spec/unit/relation_spec.rb in rom-sql-0.4.0.beta1 vs spec/unit/relation_spec.rb in rom-sql-0.4.0.beta2
- old
+ new
@@ -12,9 +12,24 @@
order(:id)
end
end
end
+ describe '#distinct' do
+ it 'delegates to dataset and returns a new relation' do
+ expect(users.dataset).to receive(:distinct).with(:name).and_call_original
+ expect(users.distinct(:name)).to_not eq(users)
+ end
+ end
+
+ describe '#exclude' do
+ it 'delegates to dataset and returns a new relation' do
+ expect(users.dataset)
+ .to receive(:exclude).with(name: 'Piotr').and_call_original
+ expect(users.exclude(name: 'Piotr')).to_not eq(users)
+ end
+ end
+
describe '#map' do
it 'yields tuples' do
result = []
users.map { |tuple| result << tuple }
expect(result).to eql([{ id: 1, name: 'Piotr' }])