spec/unit/sql/relation_spec.rb in rom-repository-0.2.0 vs spec/unit/sql/relation_spec.rb in rom-repository-0.3.0

- old
+ new

@@ -5,20 +5,20 @@ let(:users) { rom.relation(:users) } it 'has valid column names' do expect(users.attributes).to eql([:id, :name]) - expect(users.by_id.attributes).to eql([:name]) - expect(users.by_id(1).attributes).to eql([:name]) + expect(users.by_pk.attributes).to eql([:name]) + expect(users.by_pk(1).attributes).to eql([:name]) end end describe '.view' do context 'using short syntax' do before do configuration.relation(:users) do - view(:by_id, [:name]) do |name| + view(:by_pk, [:name]) do |name| where(name: name).select(:name) end end end @@ -26,11 +26,11 @@ end context 'with multi-block syntax' do before do configuration.relation(:users) do - view(:by_id) do + view(:by_pk) do header [:name] relation do |name| where(name: name).select(:name) end @@ -43,10 +43,10 @@ context 'with multi-block when first block has args' do it 'raises error' do expect { configuration.relation(:users) do - view(:by_id) { |args| } + view(:by_pk) { |args| } end }.to raise_error(ArgumentError) end end end