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:
parent
bc48ed16f9
commit
455e59e442
2 changed files with 11 additions and 1 deletions
|
|
@ -83,6 +83,16 @@ SQL
|
||||||
SQL
|
SQL
|
||||||
end
|
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
|
def sign_in_count_sql
|
||||||
<<SQL
|
<<SQL
|
||||||
SELECT users.id AS id, users.sign_in_count AS count
|
SELECT users.id AS id, users.sign_in_count AS count
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ describe Statistics do
|
||||||
{"id" => local_luke.id , "count" => 0, "connected" => 0 },
|
{"id" => local_luke.id , "count" => 0, "connected" => 0 },
|
||||||
{"id" => local_leia.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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue