mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
User tracking state implementation progress for live unread / new counts
This commit is contained in:
@ -18,6 +18,24 @@ describe SqlBuilder do
|
||||
end
|
||||
end
|
||||
|
||||
describe "map" do
|
||||
class SqlBuilder::TestClass
|
||||
attr_accessor :int, :string, :date, :text
|
||||
end
|
||||
|
||||
it "correctly maps to a klass" do
|
||||
rows = SqlBuilder.new("SELECT 1 AS int, 'string' AS string, CAST(NOW() at time zone 'utc' AS timestamp without time zone) AS date, 'text'::text AS text")
|
||||
.map_exec(SqlBuilder::TestClass)
|
||||
|
||||
rows.count.should == 1
|
||||
row = rows[0]
|
||||
row.int.should == 1
|
||||
row.string.should == "string"
|
||||
row.text.should == "text"
|
||||
row.date.should be_within(10.seconds).of(DateTime.now)
|
||||
end
|
||||
end
|
||||
|
||||
describe "detached" do
|
||||
before do
|
||||
@builder = SqlBuilder.new("select * from (select :a A union all select :b) as X /*where*/ /*order_by*/ /*limit*/ /*offset*/")
|
||||
|
Reference in New Issue
Block a user