aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/request_controller_spec.rb
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2012-04-20 19:10:10 +0100
committerSeb Bacon <seb.bacon@gmail.com>2012-04-20 19:10:10 +0100
commit4533b28661d6ce6973becf5877e82ca5656c37d2 (patch)
treee3df319f2d3a3d7a458c5637dee74db02f15bcff /spec/controllers/request_controller_spec.rb
parent8fcafad78e2fba5a09f7ad45542d906e0cdda19b (diff)
More changes and refactoring to make purges work.
Diffstat (limited to 'spec/controllers/request_controller_spec.rb')
-rw-r--r--spec/controllers/request_controller_spec.rb21
1 files changed, 8 insertions, 13 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 89d165587..9090bc26f 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -121,55 +121,50 @@ describe RequestController, "when changing things that appear on the request pag
integrate_views
- before(:each) do
- FakeWeb.last_request = nil
- end
-
it "should purge the downstream cache when mail is received" do
ir = info_requests(:fancy_dog_request)
receive_incoming_mail('incoming-request-plain.email', ir.incoming_email)
- FakeWeb.last_request.path.should include(ir.url_title)
+ PurgeRequest.all().first.model_id.should == ir.id
end
it "should purge the downstream cache when a comment is added" do
ir = info_requests(:fancy_dog_request)
- ir.should_receive(:purge_in_cache)
new_comment = info_requests(:fancy_dog_request).add_comment('I also love making annotations.', users(:bob_smith_user))
+ PurgeRequest.all().first.model_id.should == ir.id
end
it "should purge the downstream cache when a followup is made" do
session[:user_id] = users(:bob_smith_user).id
ir = info_requests(:fancy_dog_request)
post :show_response, :outgoing_message => { :body => "What a useless response! You suck.", :what_doing => 'normal_sort' }, :id => ir.id, :incoming_message_id => incoming_messages(:useless_incoming_message), :submitted_followup => 1
- FakeWeb.last_request.path.should include(ir.url_title)
+ PurgeRequest.all().first.model_id.should == ir.id
end
it "should purge the downstream cache when the request is categorised" do
ir = info_requests(:fancy_dog_request)
- ir.should_receive(:purge_in_cache)
ir.set_described_state('waiting_clarification')
+ PurgeRequest.all().first.model_id.should == ir.id
end
it "should purge the downstream cache when the authority data is changed" do
ir = info_requests(:fancy_dog_request)
ir.public_body.name = "Something new"
ir.public_body.save!
- FakeWeb.last_request.path.should include(ir.url_title)
+ PurgeRequest.all().map{|x| x.model_id}.should =~ ir.public_body.info_requests.map{|x| x.id}
end
it "should purge the downstream cache when the user details are changed" do
ir = info_requests(:fancy_dog_request)
ir.user.name = "Something new"
- FakeWeb.last_request.should == nil
ir.user.save!
- FakeWeb.last_request.path.should include(ir.url_title)
+ PurgeRequest.all().map{|x| x.model_id}.should =~ ir.user.info_requests.map{|x| x.id}
end
it "should purge the downstream cache when censor rules have changed" do
# XXX really, CensorRules should execute expiry logic as part
# of the after_save of the model. Currently this is part of
- # the AdminController logic, so must be tested from
+ # the AdminCensorRuleController logic, so must be tested from
# there. Leaving this stub test in place as a reminder
end
it "should purge the downstream cache when something is hidden by an admin" do
ir = info_requests(:fancy_dog_request)
- ir.should_receive(:purge_in_cache)
ir.prominence = 'hidden'
ir.save!
+ PurgeRequest.all().first.model_id.should == ir.id
end
end