From 4db521657dda8d8276db983ee0b7de3060d5fee5 Mon Sep 17 00:00:00 2001 From: Himanshu Chhetri Date: Fri, 29 Oct 2010 20:31:45 -0700 Subject: [PATCH 1/3] Use FileUtils for all file operations. Also uses Kernel.system to execute shell commands in a secure fashion. --- lib/collect_user_photos.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/collect_user_photos.rb b/lib/collect_user_photos.rb index 4b0fedea2..d95aa386a 100644 --- a/lib/collect_user_photos.rb +++ b/lib/collect_user_photos.rb @@ -17,12 +17,12 @@ module PhotoMover current_photo_location = "#{Rails.root}/public/uploads/images/#{photo.image_filename}" new_photo_location = "#{album_dir}/#{photo.image_filename}" - `cp #{current_photo_location} #{new_photo_location}` + FileUtils::cp current_photo_location new_photo_location end end - `tar cf #{user.id}.tar #{user.id}` - `rm -r #{user.id}` + system("tar", "cf #{user.id}.tar #{user.id}") + FileUtils::rm_r user.id, :secure => true, :force => true "#{Rails.root}/#{temp_dir}.tar" end From cb09249058b0a045d0fb0c2c7e83e29cfb86d7d4 Mon Sep 17 00:00:00 2001 From: Sarah Mei Date: Sun, 31 Oct 2010 22:49:40 -0700 Subject: [PATCH 2/3] Refactor aspect cucumber feature - now happy path only. --- features/manages_aspects.feature | 14 ++++++++++++++ features/user_creates_an_aspect.feature | 21 --------------------- 2 files changed, 14 insertions(+), 21 deletions(-) create mode 100644 features/manages_aspects.feature delete mode 100644 features/user_creates_an_aspect.feature diff --git a/features/manages_aspects.feature b/features/manages_aspects.feature new file mode 100644 index 000000000..74f6744f4 --- /dev/null +++ b/features/manages_aspects.feature @@ -0,0 +1,14 @@ +@aspects @javascript +Feature: User manages aspects + In order to share with a limited group + As a User + I want to create new aspects + + Scenario: creating an aspect + Given I am signed in + When I follow "Manage" in the header + And I follow "Add a new aspect" + And I fill in "Name" with "Dorm Mates" in the modal window + And I press "Create" in the modal window + Then I should see "Dorm Mates" in the header + And I should see "Your aspect 'Dorm Mates' is empty." diff --git a/features/user_creates_an_aspect.feature b/features/user_creates_an_aspect.feature deleted file mode 100644 index d611d412f..000000000 --- a/features/user_creates_an_aspect.feature +++ /dev/null @@ -1,21 +0,0 @@ -@aspects @javascript -Feature: User creates an aspect - In order to share with a limited group - As a User - I want to create a new aspect - - Background: - Given I am signed in - And I follow "Manage" in the header - And I follow "Add a new aspect" - - Scenario: success - Given I fill in "Name" with "Dorm Mates" in the modal window - When I press "Create" in the modal window - Then I should see "Dorm Mates" in the header - And I should see "Your aspect 'Dorm Mates' is empty." - - Scenario: I omit the name - Given I fill in "Name" with "" in the modal window - When I press "Create" in the modal window - Then I should see "Aspect creation failed." From 9594e11ded9fe1c5338aecd046c3c8e0f4101d8c Mon Sep 17 00:00:00 2001 From: Sarah Mei Date: Sun, 31 Oct 2010 22:50:20 -0700 Subject: [PATCH 3/3] Add feature for skipping the setup wizard. --- features/signs_up.feature | 16 ++++------------ features/step_definitions/custom_web_steps.rb | 4 ++++ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/features/signs_up.feature b/features/signs_up.feature index e64b066e7..d449034cf 100644 --- a/features/signs_up.feature +++ b/features/signs_up.feature @@ -1,7 +1,7 @@ @javascript Feature: new user registration - Scenario: new user sees profile wizard + Background: When I go to the new user registration page And I fill in "Username" with "ohai" And I fill in "Email" with "ohai@example.com" @@ -11,6 +11,7 @@ Feature: new user registration Then I should be on the getting started page And I should see "Welcome to Diaspora!" + Scenario: new user goes through the setup wizard When I fill in "person_profile_first_name" with "O" And I fill in "person_profile_last_name" with "Hai" And I press "Save and continue" @@ -32,17 +33,8 @@ Feature: new user registration Then I should be on the home page And I should see "We know you have friends, bring them to Diaspora!" - @wip - Scenario: new user can skip the profile wizard - When I go to the new user registration page - And I fill in "Username" with "ohai" - And I fill in "Email" with "ohai@example.com" - And I fill in "Password" with "secret" - And I fill in "Password confirmation" with "secret" - And I press "Sign up" - Then I should be on the getting started page - And I should see "Welcome to Diaspora!" - + Scenario: new user skips the setup wizard When I follow "skip getting started" + And I wait for the home page to load Then I should be on the home page And I should see "We know you have friends, bring them to Diaspora!" diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index d213cbf4d..c98150d3d 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -20,4 +20,8 @@ Then /^I should see "([^\"]*)" in the main content area$/ do |stuff| within("#stream") do Then "I should see #{stuff}" end +end + +When /^I wait for the home page to load$/ do + wait_until { current_path == root_path } end \ No newline at end of file