spec/unit/relation/having_spec.rb in rom-sql-0.9.1 vs spec/unit/relation/having_spec.rb in rom-sql-1.0.0.beta1

- old
+ new

@@ -1,20 +1,22 @@ RSpec.describe ROM::Relation, '#having' do subject(:relation) do - container.relations.users + relations[:users] .inner_join(:tasks, user_id: :id) - .select_group(:users__id, :users__name) - .select_append { count(:tasks).as(:task_count) } + .qualified + .select_group(:id, :name) + .select_append { int::count(:tasks).as(:task_count) } end include_context 'users and tasks' with_adapters :postgres do before do conn[:tasks].insert(id: 3, user_id: 2, title: "Joe's another task") end it 'restricts a relation using HAVING clause' do - expect(relation.having { count(:tasks__id) >= 2 }.to_a).to eq([{ id: 2, name: 'Joe', task_count: 2 }]) + expect(relation.having { count(id.qualified) >= 2 }.to_a). + to eq([{ id: 2, name: 'Joe', task_count: 2 }]) end end end