aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/public_body_controller_spec.rb
diff options
context:
space:
mode:
authorMark Longair <mhl@pobox.com>2013-08-19 10:34:05 +0100
committerMark Longair <mhl@pobox.com>2013-08-20 12:11:45 +0100
commite5855f7fd2657574c5af99890c63d530ca3bb5d0 (patch)
tree338b64fd532af727027ada82b7a4d2042855e305 /spec/controllers/public_body_controller_spec.rb
parent32625f08b9c7e7bb65bd24099e64d7d17be5e45e (diff)
Improve calculation of PublicBody statistics columns
On PublicBody, we don't need to update info_requests_count because that's already done with :counter_cache. On the other hand, info_requests_successful_count and info_requests_not_held_count can't be updated easily with counter_cache (since they need conditions to be attached). Instead we update them in post_save and post_destroy, as suggested here: http://blog.douglasfshearer.com/post/17495285851/custom-counter-cache-with-conditions This also adds tests to ensure that the after_(save|destroy) callbacks are called and that they modify the counts correctly.
Diffstat (limited to 'spec/controllers/public_body_controller_spec.rb')
-rw-r--r--spec/controllers/public_body_controller_spec.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/spec/controllers/public_body_controller_spec.rb b/spec/controllers/public_body_controller_spec.rb
index 000d1cf80..87544b96a 100644
--- a/spec/controllers/public_body_controller_spec.rb
+++ b/spec/controllers/public_body_controller_spec.rb
@@ -233,7 +233,7 @@ describe PublicBodyController, "when showing public body statistics" do
graph['y_values'].should == [0, 50, 100, 100]
end
# Check that at least every confidence interval value is
- # numeric:
+ # a Float (rather than NilClass, say):
graph['cis_below'].each { |v| v.should be_instance_of(Float) }
graph['cis_above'].each { |v| v.should be_instance_of(Float) }
end