Sha256: 248abf36e5d3e864972b945e0ee22729af4ad859627e82e5716ac704fd5affdb

Contents?: true

Size: 492 Bytes

Versions: 23

Compression:

Stored size: 492 Bytes

Contents

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

  include_context 'users and tasks'

  before do
    conf.relation(:users) do
      schema(infer: true)

      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

23 entries across 23 versions & 1 rubygems

Version Path
rom-sql-1.3.5 spec/unit/relation/rename_spec.rb
rom-sql-1.3.4 spec/unit/relation/rename_spec.rb
rom-sql-2.0.0.beta2 spec/unit/relation/rename_spec.rb
rom-sql-2.0.0.beta1 spec/unit/relation/rename_spec.rb
rom-sql-1.3.3 spec/unit/relation/rename_spec.rb
rom-sql-1.3.2 spec/unit/relation/rename_spec.rb
rom-sql-1.3.1 spec/unit/relation/rename_spec.rb
rom-sql-1.3.0 spec/unit/relation/rename_spec.rb
rom-sql-1.2.2 spec/unit/relation/rename_spec.rb
rom-sql-1.2.1 spec/unit/relation/rename_spec.rb
rom-sql-1.2.0 spec/unit/relation/rename_spec.rb
rom-sql-1.1.2 spec/unit/relation/rename_spec.rb
rom-sql-1.1.1 spec/unit/relation/rename_spec.rb
rom-sql-1.1.0 spec/unit/relation/rename_spec.rb
rom-sql-1.0.3 spec/unit/relation/rename_spec.rb
rom-sql-1.0.2 spec/unit/relation/rename_spec.rb
rom-sql-1.0.1 spec/unit/relation/rename_spec.rb
rom-sql-1.0.0 spec/unit/relation/rename_spec.rb
rom-sql-1.0.0.rc2 spec/unit/relation/rename_spec.rb
rom-sql-1.0.0.rc1 spec/unit/relation/rename_spec.rb