diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-09-05 16:39:57 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-09-05 17:05:29 +0100 |
commit | c5c815d6450b4ecd4be004ae20fb0ecb1b62fa0d (patch) | |
tree | e28543c8bc8fa070643027256c757ae9790d964b /spec/models/info_request_spec.rb | |
parent | a84f1f84bbaf2c890b0f45bc0e9c460e0848e274 (diff) |
Save cached columns once updated.
Diffstat (limited to 'spec/models/info_request_spec.rb')
-rw-r--r-- | spec/models/info_request_spec.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb index 3f2e02189..ab36a201c 100644 --- a/spec/models/info_request_spec.rb +++ b/spec/models/info_request_spec.rb @@ -896,8 +896,9 @@ describe InfoRequest do describe 'when changing a described_state' do - it "should change the counts on its PublicBody" do + it "should change the counts on its PublicBody without saving a new version" do pb = public_bodies(:geraldine_public_body) + old_version_count = pb.versions.count old_successful_count = pb.info_requests_successful_count old_not_held_count = pb.info_requests_not_held_count ir = InfoRequest.new(:external_url => 'http://www.example.com', @@ -909,15 +910,19 @@ describe InfoRequest do pb.info_requests_successful_count.should == (old_successful_count + 1) ir.described_state = 'not_held' ir.save! + pb.reload pb.info_requests_successful_count.should == old_successful_count pb.info_requests_not_held_count.should == (old_not_held_count + 1) ir.described_state = 'successful' ir.save! + pb.reload pb.info_requests_successful_count.should == (old_successful_count + 1) pb.info_requests_not_held_count.should == old_not_held_count ir.destroy + pb.reload pb.info_requests_successful_count.should == old_successful_count pb.info_requests_successful_count.should == old_not_held_count + pb.versions.count.should == old_version_count end end |