spec/unit/projection_dsl_spec.rb in rom-sql-1.0.1 vs spec/unit/projection_dsl_spec.rb in rom-sql-1.0.2
- old
+ new
@@ -61,9 +61,17 @@
.call { int::count(id.qualified).as(:count) }
.map { |attr| attr.sql_literal(ds) }
expect(literals).to eql([%(COUNT("users"."id") AS "count")])
end
+
+ it 'supports selecting literal strings' do
+ literals = dsl
+ .call { `'event'`.as(:type) }
+ .map { |attr| attr.sql_literal(ds) }
+
+ expect(literals).to eql([%('event' AS "type")])
+ end
end
describe '#method_missing' do
it 'responds to methods matching attribute names' do
expect(dsl.id).to eql(schema[:id])