mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-23 03:26:07 +10:00
Tnx to @jacobvosmaer for the suggestion source: http://stackoverflow.com/questions/4394381/rails-url-helper-not-encoding-ampersands
35 lines
853 B
Ruby
35 lines
853 B
Ruby
require 'spec_helper'
|
|
|
|
describe UnsubscribesController do
|
|
let!(:user) { create :user, email: 'me@example.com' }
|
|
|
|
describe "show" do
|
|
it "responds with success" do
|
|
get :show, email: CGI.escape('me@example.com')
|
|
|
|
assert_response :success
|
|
end
|
|
|
|
it "behaves the same if email address isn't known in the system" do
|
|
get :show, email: CGI.escape('i@dont_exists.com')
|
|
|
|
assert_response :success
|
|
end
|
|
end
|
|
|
|
describe "create" do
|
|
it "unsubscribes the connected user" do
|
|
post :create, email: CGI.escape('me@example.com')
|
|
|
|
assert user.reload.admin_email_unsubscribed_at
|
|
end
|
|
|
|
# Don't tell if the email does not exists
|
|
it "behaves the same if email address isn't known in the system" do
|
|
post :create, email: CGI.escape('i@dont_exists.com')
|
|
|
|
assert_response :redirect
|
|
end
|
|
end
|
|
end
|