From 6d113da242313691c1fe434a493989e2bb13c08d Mon Sep 17 00:00:00 2001 From: Kiran Soumya Date: Thu, 17 Mar 2011 00:58:40 +0530 Subject: [PATCH] Bug Fix:868 for Users unable to download photos --- features/download_photos.feature | 10 ++++++++++ features/step_definitions/custom_web_steps.rb | 4 ++++ lib/collect_user_photos.rb | 4 ++-- spec/controllers/users_controller_spec.rb | 7 +++++++ 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 features/download_photos.feature diff --git a/features/download_photos.feature b/features/download_photos.feature new file mode 100644 index 000000000..2ab7c0649 --- /dev/null +++ b/features/download_photos.feature @@ -0,0 +1,10 @@ +@javascript +Feature: Download Photos + + Scenario: Download my photos + Given I am signed in + And I click on my name in the header + And I follow "settings" + Then I should be on my account settings page + And I follow "download my photos" + Then I should get download alert diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index f86a1d29f..fe7f5a36a 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -99,3 +99,7 @@ When /^I wait for "([^\"]*)" to load$/ do |page_name| current_location == path_to(page_name) end end + +Then /^I should get download alert$/ do + page.evaluate_script("window.alert = function() { return true; }") +end diff --git a/lib/collect_user_photos.rb b/lib/collect_user_photos.rb index cd9d3d6e8..8723e1f5c 100644 --- a/lib/collect_user_photos.rb +++ b/lib/collect_user_photos.rb @@ -11,8 +11,8 @@ module PhotoMover FileUtils::mkdir_p photos_dir photos.each do |photo| - current_photo_location = "#{Rails.root}/public/uploads/images/#{photo.image_filename}" - new_photo_location = "#{photos_dir}/#{photo.image_filename}" + current_photo_location = "#{Rails.root}/public/uploads/images/#{photo.remote_photo_name}" + new_photo_location = "#{photos_dir}/#{photo.remote_photo_name}" FileUtils::cp current_photo_location, new_photo_location end diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index 2986823b3..51d490664 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -21,6 +21,13 @@ describe UsersController do end end + describe '#export_photos' do + it 'returns a tar file' do + get :export_photos + response.header["Content-Type"].should include "application/octet-stream" + end + end + describe '#public' do it 'renders xml' do sm = Factory(:status_message, :public => true, :author => @user.person)