User tracking state implementation progress for live unread / new counts

This commit is contained in:
Sam
2013-05-23 15:21:07 +10:00
parent cdbe6f64c7
commit fcc7192fd2
5 changed files with 142 additions and 34 deletions

View File

@ -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*/")