Sha256: d913500ece7c5e8871ee0d11eda052a6b6a50b023ab51f7deec30fbf0e7db9f4
Contents?: true
Size: 856 Bytes
Versions: 16
Compression:
Stored size: 856 Bytes
Contents
require 'spec_helper' RSpec.describe ROM::SQL::RestrictionDSL, :sqlite, helpers: true do include_context 'database setup' subject(:dsl) do ROM::SQL::RestrictionDSL.new(schema) end let(:schema) do define_schema(:users, id: ROM::SQL::Types::Serial, name: ROM::SQL::Types::String) end let(:ds) do conn[:users] end describe '#call' do it 'evaluates the block and returns an SQL expression' do expect(dsl.call { count(id) >= 3 }.sql_literal(conn[:users])).to eql('(count(`id`) >= 3)') end end describe '#method_missing' do it 'responds to methods matching attribute names' do expect(dsl.id.name).to be(:id) expect(dsl.name.name).to be(:name) end it 'delegates to sequel virtual row' do expect(dsl.count(dsl.id).sql_literal(conn[:users])).to eql('count(`id`)') end end end
Version data entries
16 entries across 16 versions & 1 rubygems