aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/application_controller_spec.rb9
-rw-r--r--spec/models/info_request_event_spec.rb7
2 files changed, 16 insertions, 0 deletions
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb
index 2e0e99200..f16cee312 100644
--- a/spec/controllers/application_controller_spec.rb
+++ b/spec/controllers/application_controller_spec.rb
@@ -36,3 +36,12 @@ describe ApplicationController, "when accessing third party services" do
end
end
+describe ApplicationController, "when caching fragments" do
+ it "should not fail with long filenames" do
+ long_name = "blahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblah.txt"
+ path = self.controller.send(:foi_fragment_cache_path, long_name)
+ self.controller.send(:foi_fragment_cache_write, path, "whassap")
+ end
+
+end
+
diff --git a/spec/models/info_request_event_spec.rb b/spec/models/info_request_event_spec.rb
index 5423b8da8..63c859007 100644
--- a/spec/models/info_request_event_spec.rb
+++ b/spec/models/info_request_event_spec.rb
@@ -73,6 +73,13 @@ describe InfoRequestEvent do
event.search_text_main.strip.should == "No way! I'm not going to tell you that in a month of Thursdays.\n\nThe Geraldine Quango"
end
+ it 'should get clipped text for incoming messages, and cache it too' do
+ event = info_request_events(:useless_incoming_message_event)
+ event.incoming_message_selective_columns("cached_main_body_text_folded").cached_main_body_text_folded.should == nil
+ event.search_text_main(true).strip.should == "No way! I'm not going to tell you that in a month of Thursdays.\n\nThe Geraldine Quango"
+ event.incoming_message_selective_columns("cached_main_body_text_folded").cached_main_body_text_folded.should_not == nil
+ end
+
end