From 4bc061117ad298eb61cd15871717eb48415c957c Mon Sep 17 00:00:00 2001 From: root Date: Sat, 15 Jan 2011 16:46:10 -0500 Subject: [PATCH] Private Issue - Cucumber test for closing an account --- features/closes_account.feature | 28 +++++++++++++++++++ features/step_definitions/custom_web_steps.rb | 6 ++++ features/step_definitions/user_steps.rb | 2 +- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 features/closes_account.feature diff --git a/features/closes_account.feature b/features/closes_account.feature new file mode 100644 index 000000000..70aee5bfc --- /dev/null +++ b/features/closes_account.feature @@ -0,0 +1,28 @@ +@javascript +Feature: Close Account + In order to close an existing account + As a user + I want to sign in, close my account and try to log in again + + Scenario: user closes account + Given a user with username "ohai" and password "secret" + When I go to the new user session page + And I fill in "Username" with "ohai" + And I fill in "Password" with "secret" + And I press "Sign in" + Then I should be on the aspects page + + When I click on my name in the header + And I follow "account settings" + And I click ok in the confirm dialog to appear next + And I follow "Close Account" + Then I should be on the home page + + When I go to the new user session page + And I fill in "Username" with "ohai" + And I fill in "Password" with "secret" + And I press "Sign in" + #Then I should not be on the aspects page + Then I should be on the new user session page + And I wait for the ajax to finish + Then I should see "Invalid email or password." diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index 88a82d4e4..a1ae7fa65 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -43,3 +43,9 @@ end When /^I wait for the ajax to finish$/ do wait_until { evaluate_script("$.active") == 0 } end + +When /^I click ok in the confirm dialog to appear next$/ do + evaluate_script <<-JS + window.confirm = function() { return true; }; + JS +end diff --git a/features/step_definitions/user_steps.rb b/features/step_definitions/user_steps.rb index 4f052f998..000ab01c3 100644 --- a/features/step_definitions/user_steps.rb +++ b/features/step_definitions/user_steps.rb @@ -1,5 +1,5 @@ Given /^a user with username "([^\"]*)" and password "([^\"]*)"$/ do |username, password| - Factory(:user, :username => username, :password => password, + @me ||= Factory(:user, :username => username, :password => password, :password_confirmation => password, :getting_started => false) end