|
|
@ -334,24 +334,42 @@ describe AccountController do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "with manual activation" do |
|
|
|
context "with manual activation" do |
|
|
|
before do |
|
|
|
let(:user_hash) do |
|
|
|
allow(Setting).to receive(:self_registration).and_return("2") |
|
|
|
{ :login => 'register', |
|
|
|
post :register, :user => { |
|
|
|
|
|
|
|
:login => 'register', |
|
|
|
|
|
|
|
:password => 'adminADMIN!', |
|
|
|
:password => 'adminADMIN!', |
|
|
|
:password_confirmation => 'adminADMIN!', |
|
|
|
:password_confirmation => 'adminADMIN!', |
|
|
|
:firstname => 'John', |
|
|
|
:firstname => 'John', |
|
|
|
:lastname => 'Doe', |
|
|
|
:lastname => 'Doe', |
|
|
|
:mail => 'register@example.com' |
|
|
|
:mail => 'register@example.com' } |
|
|
|
} |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "redirects to the login page" do |
|
|
|
before do |
|
|
|
should redirect_to '/login' |
|
|
|
allow(Setting).to receive(:self_registration).and_return("2") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "doesn't activate the user" do |
|
|
|
context "without back_url" do |
|
|
|
expect(User.find_by_login('register')).not_to be_active |
|
|
|
before do |
|
|
|
|
|
|
|
post :register, :user => user_hash |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "redirects to the login page" do |
|
|
|
|
|
|
|
expect(response).to redirect_to '/login' |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "doesn't activate the user" do |
|
|
|
|
|
|
|
expect(User.find_by_login('register')).not_to be_active |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "with back_url" do |
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
post :register, :user => user_hash, :back_url => 'https://example.net/some_back_url' |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it 'preserves the back url' do |
|
|
|
|
|
|
|
expect(response).to redirect_to( |
|
|
|
|
|
|
|
'/login?back_url=https%3A%2F%2Fexample.net%2Fsome_back_url') |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|