Sha256: d56faa1a8e18840ec6539e1be41b563a9e7db5bc818058fc40a6346312620c9d

Contents?: true

Size: 649 Bytes

Versions: 23

Compression:

Stored size: 649 Bytes

Contents

RSpec.describe ROM::Relation, '#prefix' 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
      prefixed = relation.sorted.prefix(:user)

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

    it 'uses singularized table name as the default prefix' do
      prefixed = relation.sorted.prefix

      expect(prefixed.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/prefix_spec.rb
rom-sql-1.3.4 spec/unit/relation/prefix_spec.rb
rom-sql-2.0.0.beta2 spec/unit/relation/prefix_spec.rb
rom-sql-2.0.0.beta1 spec/unit/relation/prefix_spec.rb
rom-sql-1.3.3 spec/unit/relation/prefix_spec.rb
rom-sql-1.3.2 spec/unit/relation/prefix_spec.rb
rom-sql-1.3.1 spec/unit/relation/prefix_spec.rb
rom-sql-1.3.0 spec/unit/relation/prefix_spec.rb
rom-sql-1.2.2 spec/unit/relation/prefix_spec.rb
rom-sql-1.2.1 spec/unit/relation/prefix_spec.rb
rom-sql-1.2.0 spec/unit/relation/prefix_spec.rb
rom-sql-1.1.2 spec/unit/relation/prefix_spec.rb
rom-sql-1.1.1 spec/unit/relation/prefix_spec.rb
rom-sql-1.1.0 spec/unit/relation/prefix_spec.rb
rom-sql-1.0.3 spec/unit/relation/prefix_spec.rb
rom-sql-1.0.2 spec/unit/relation/prefix_spec.rb
rom-sql-1.0.1 spec/unit/relation/prefix_spec.rb
rom-sql-1.0.0 spec/unit/relation/prefix_spec.rb
rom-sql-1.0.0.rc2 spec/unit/relation/prefix_spec.rb
rom-sql-1.0.0.rc1 spec/unit/relation/prefix_spec.rb