forked from hotsh/rstat.us
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request hotsh#620 from carols10cents/account_deletion
Account deletion
- Loading branch information
Showing
18 changed files
with
199 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#delete | ||
%h3 Warning | ||
|
||
%p | ||
You are about to delete your account. This will also delete all your status updates, and this cannot be undone. | ||
|
||
%p | ||
If you are sure you want to do this, please type your username as confirmation: | ||
|
||
= form_tag user_path(current_user), :class => "delete_account_confirm" do | ||
%input{:type => "hidden", :name => "_method", :value => "delete"} | ||
%input{:type => :text, :name => :username_confirmation, :class => "username"} | ||
|
||
-# We have both a submit button and links here because of a Firefox | ||
-# CSS bug that sets line-height on buttons that can't be overridden. | ||
-# Since Cancel should be a link that goes back to the edit profile | ||
-# page, to match the height in Firefox, both Delete and Cancel are links. | ||
-# Having the submit button, which is hidden using CSS, allows enter to | ||
-# submit the form and makes something that will work without javascript. | ||
|
||
%input{:type => "submit", :value => "Delete Account", :class => "delete_account_submit button"} | ||
= link_to "Delete Account", "#", :id => "delete_account", :class => "button destructive_action" | ||
= link_to "Cancel", edit_user_path(current_user), :class => "button" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
require 'require_relative' if RUBY_VERSION[0,3] == '1.8' | ||
require_relative 'acceptance_helper' | ||
|
||
describe "Delete your account" do | ||
include AcceptanceHelper | ||
|
||
before do | ||
@u = Fabricate(:user) | ||
@update = Fabricate(:update) | ||
@u.feed.updates << @update | ||
log_in_username(@u) | ||
end | ||
|
||
it "lets you delete your account and deletes all your updates" do | ||
visit "/users/#{@u.username}/edit" | ||
click_link "Delete Account" | ||
|
||
fill_in "username_confirmation", :with => @u.username | ||
click_button "Delete Account" | ||
|
||
within flash do | ||
assert has_content?("Your account has been deleted. We're sorry to see you go.") | ||
end | ||
|
||
assert logged_out? | ||
|
||
visit "/updates" | ||
within "#updates" do | ||
assert has_no_content?(@update.text) | ||
end | ||
end | ||
|
||
it "returns you to your edit page if you click cancel" do | ||
visit "/users/#{@u.username}/edit" | ||
click_link "Delete Account" | ||
click_link "Cancel" | ||
page.current_url.must_match("/users/#{@u.username}/edit") | ||
end | ||
|
||
it "returns you to your edit page if you dont type a username" do | ||
visit "/users/#{@u.username}/edit" | ||
click_link "Delete Account" | ||
click_button "Delete Account" | ||
|
||
page.current_url.must_match("/users/#{@u.username}/edit") | ||
within flash do | ||
assert has_content?("Nothing was deleted since you did not type your username.") | ||
end | ||
end | ||
|
||
it "returns you to your edit page if you type your username wrong" do | ||
visit "/users/#{@u.username}/edit" | ||
click_link "Delete Account" | ||
fill_in "username_confirmation", :with => "nopenopenope" | ||
click_button "Delete Account" | ||
|
||
page.current_url.must_match("/users/#{@u.username}/edit") | ||
within flash do | ||
assert has_content?("Nothing was deleted since you did not type your username.") | ||
end | ||
end | ||
|
||
it "does not let you delete someone else's account" do | ||
@someone_else = Fabricate(:user, :username => "someone_else") | ||
delete "/users/someone_else" | ||
|
||
visit "/users/someone_else" | ||
within "span.user-text" do | ||
assert has_content?("someone_else") | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters