aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/request_controller_spec.rb
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2011-09-13 11:45:45 +0100
committerSeb Bacon <seb.bacon@gmail.com>2011-09-13 18:10:59 +0100
commit50a1f019535f61f7ed7e09931d0d114e5e4fd538 (patch)
tree609196b21ad7d2c04616570f7db1e651a3f0cc3d /spec/controllers/request_controller_spec.rb
parentf4282090240e557f4a1515573bb7ccfcbef8f7f7 (diff)
Provide ability to download zip file containing complete request. Closes #11
Diffstat (limited to 'spec/controllers/request_controller_spec.rb')
-rw-r--r--spec/controllers/request_controller_spec.rb23
1 files changed, 22 insertions, 1 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 63e86b525..b4aef8470 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -216,7 +216,28 @@ describe RequestController, "when showing one request" do
response.body.should have_tag("p.attachment strong", /goodbye.txt/m)
end
-
+ it "should make a zipfile available, which has a different URL when it changes" do
+ ir = info_requests(:fancy_dog_request)
+ session[:user_id] = ir.user.id # bob_smith_user
+ receive_incoming_mail('incoming-request-two-same-name.email', ir.incoming_email)
+ title = 'why_do_you_have_such_a_fancy_dog'
+ get :download_entire_request, :url_title => title
+ assigns[:url_path].should have_text(/#{title}.zip$/)
+ old_path = assigns[:url_path]
+ response.location.should have_text(/#{assigns[:url_path]}$/)
+ zipfile = Zip::ZipFile.open(File.join(File.dirname(__FILE__), "../../cache/zips", old_path)) { |zipfile|
+ zipfile.count.should == 2
+ }
+ receive_incoming_mail('incoming-request-attachment-unknown-extension.email', ir.incoming_email)
+ get :download_entire_request, :url_title => title
+ assigns[:url_path].should have_text(/#{title}.zip$/)
+ response.location.should have_text(/#{assigns[:url_path]}/)
+ assigns[:url_path].should_not == old_path
+ zipfile = Zip::ZipFile.open(File.join(File.dirname(__FILE__), "../../cache/zips", assigns[:url_path])) { |zipfile|
+ zipfile.count.should == 4
+zipfile.entries.each {|x| puts x.name}
+ }
+ end
end
end