Introduce #fb_connected_distribution to make statistics_spec.rb pass under PostgreSQL.

Statistics can still be gathered the same way when MySQL is being used; no alteration there.
This commit is contained in:
Pistos 2011-10-12 22:36:42 -04:00
parent bc48ed16f9
commit 455e59e442
2 changed files with 11 additions and 1 deletions

View file

@ -83,6 +83,16 @@ SQL
SQL
end
def fb_connected_distribution
User.connection.select_all(fb_connected_distribution_sql).map { |row|
Hash[
row.map { |k,v|
[k, v.to_i]
}
]
}
end
def sign_in_count_sql
<<SQL
SELECT users.id AS id, users.sign_in_count AS count

View file

@ -99,7 +99,7 @@ describe Statistics do
{"id" => local_luke.id , "count" => 0, "connected" => 0 },
{"id" => local_leia.id , "count" => 0, "connected" => 0 }]
User.connection.select_all(@stats.fb_connected_distribution_sql).should =~ @result
@stats.fb_connected_distribution.should =~ @result
end
end