2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-10 17:26:30 +08:00

Improve the unsubscribe to digest experience. Give a link in case it

fails, provide a different message if you are logged in as a different
user, increase expiry to 2 months from 1 week.
This commit is contained in:
Robin Ward 2014-07-15 17:19:45 -04:00
parent 82bdef2047
commit f2dd35ab08
6 changed files with 47 additions and 21 deletions

View file

@ -50,8 +50,18 @@ describe EmailController do
user.email_digests.should be_false
end
it "does not set the not_found instance variable" do
assigns(:not_found).should be_blank
it "sets the appropriate instance variables" do
assigns(:success).should be_present
end
end
context "with an expired key or invalid key" do
before do
get :unsubscribe, key: 'watwatwat'
end
it "sets the appropriate instance variables" do
assigns(:success).should be_blank
end
end
@ -67,8 +77,9 @@ describe EmailController do
user.email_digests.should be_true
end
it 'sets not found' do
assigns(:not_found).should be_true
it 'sets the appropriate instance variables' do
assigns(:success).should be_blank
assigns(:different_user).should be_present
end
end
@ -84,8 +95,8 @@ describe EmailController do
user.email_digests.should be_false
end
it "doesn't set not found" do
assigns(:not_found).should be_blank
it 'sets the appropriate instance variables' do
assigns(:success).should be_present
end
end