Sha256: 365923ea067f526b9fd07186342b388db199027f37406abcee928f7c51151ff5

Contents?: true

Size: 465 Bytes

Versions: 2

Compression:

Stored size: 465 Bytes

Contents

RSpec.describe ROM::Relation, '#rename' do
  subject(:relation) { container.relations.users }

  include_context 'users and tasks'

  before do
    conf.relation(:users) do
      def sorted
        order(:id)
      end
    end
  end

  with_adapters do
    it 'projects the dataset using new column names' do
      renamed = relation.sorted.rename(id: :user_id, name: :user_name)

      expect(renamed.first).to eql(user_id: 1, user_name: 'Jane')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rom-sql-0.9.1 spec/unit/relation/rename_spec.rb
rom-sql-0.9.0 spec/unit/relation/rename_spec.rb