aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/purge_request_spec.rb32
-rw-r--r--spec/models/track_thing_spec.rb2
2 files changed, 33 insertions, 1 deletions
diff --git a/spec/models/purge_request_spec.rb b/spec/models/purge_request_spec.rb
new file mode 100644
index 000000000..f7d01f784
--- /dev/null
+++ b/spec/models/purge_request_spec.rb
@@ -0,0 +1,32 @@
+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+require 'fakeweb'
+
+describe PurgeRequest, "purging things" do
+ before do
+ FakeWeb.last_request = nil
+ end
+
+ it 'should issue purge requests to the server' do
+ req = PurgeRequest.new(:url => "/begone_from_here",
+ :model => "don't care",
+ :model_id => "don't care")
+ req.save()
+ PurgeRequest.all().count.should == 1
+ PurgeRequest.purge_all()
+ PurgeRequest.all().count.should == 0
+ end
+
+ it 'should fail silently for a misconfigured server' do
+ FakeWeb.register_uri(:get, %r|brokenv|, :body => "BROKEN")
+ config = MySociety::Config.load_default()
+ config['VARNISH_HOST'] = "brokencache"
+ req = PurgeRequest.new(:url => "/begone_from_here",
+ :model => "don't care",
+ :model_id => "don't care")
+ req.save()
+ PurgeRequest.all().count.should == 1
+ PurgeRequest.purge_all()
+ PurgeRequest.all().count.should == 1
+ end
+end
+
diff --git a/spec/models/track_thing_spec.rb b/spec/models/track_thing_spec.rb
index bd122941a..93f407475 100644
--- a/spec/models/track_thing_spec.rb
+++ b/spec/models/track_thing_spec.rb
@@ -36,7 +36,7 @@ describe TrackThing, "when tracking changes" do
it "will make some sane descriptions of search-based tracks" do
tests = [['bob variety:user', "users matching text 'bob'"],
- ['bob (variety:sent OR variety:followup_sent OR variety:response OR variety:comment) (latest_status:successful OR latest_status:partially_successful OR latest_status:rejected OR latest_status:not_held)', "requests which are successful or unsuccessful or comments matching text 'bob'"],
+ ['bob (variety:sent OR variety:followup_sent OR variety:response OR variety:comment) (latest_status:successful OR latest_status:partially_successful OR latest_status:rejected OR latest_status:not_held)', "comments or requests which are successful or unsuccessful matching text 'bob'"],
['(latest_status:waiting_response OR latest_status:waiting_clarification OR waiting_classification:true)', 'requests which are awaiting a response']]
for query, description in tests
track_thing = TrackThing.create_track_for_search_query(query)