authenticate 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/.travis.yml +15 -8
- data/Appraisals +10 -0
- data/CHANGELOG.md +58 -26
- data/Rakefile +14 -0
- data/app/controllers/authenticate/passwords_controller.rb +14 -3
- data/authenticate.gemspec +6 -4
- data/bin/setup +15 -0
- data/gemfiles/4.2.gemfile +7 -0
- data/gemfiles/5.0.gemfile +8 -0
- data/lib/authenticate/configuration.rb +16 -1
- data/lib/authenticate/controller.rb +9 -11
- data/lib/authenticate/version.rb +1 -1
- data/lib/generators/authenticate/install/templates/authenticate.rb +3 -2
- data/spec/controllers/secured_controller_spec.rb +4 -4
- data/spec/dummy/config/application.rb +1 -1
- data/spec/dummy/config/environments/test.rb +3 -2
- data/spec/features/create_user_spec.rb +45 -0
- data/spec/features/new_user_form_spec.rb +26 -0
- data/spec/features/password_reset_spec.rb +3 -1
- data/spec/features/password_update_spec.rb +83 -11
- data/spec/features/sign_in_spec.rb +19 -0
- data/spec/features/sign_out_spec.rb +12 -1
- data/spec/model/password_reset_spec.rb +12 -10
- data/spec/requests/csrf_rotation_spec.rb +39 -0
- data/spec/requests/session_key_spec.rb +42 -0
- data/spec/spec_helper.rb +46 -4
- data/spec/support/features/feature_helpers.rb +5 -1
- data/spec/support/mailer.rb +6 -0
- metadata +50 -17
- data/gemfiles/rails42.gemfile +0 -17
- data/spec/controllers/passwords_controller_spec.rb +0 -117
- data/spec/controllers/sessions_controller_spec.rb +0 -86
- data/spec/controllers/users_controller_spec.rb +0 -82
@@ -1,82 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'support/controllers/controller_helpers'
|
3
|
-
|
4
|
-
describe Authenticate::UsersController, type: :controller do
|
5
|
-
it { is_expected.to be_a Authenticate::Controller }
|
6
|
-
|
7
|
-
describe 'get to #new' do
|
8
|
-
context 'not signed in' do
|
9
|
-
it 'renders form' do
|
10
|
-
get :new
|
11
|
-
expect(response).to be_success
|
12
|
-
expect(response).to render_template(:new)
|
13
|
-
end
|
14
|
-
it 'defaults email field to the value provided in the query string' do
|
15
|
-
get :new, user: { email: 'dude@example.com' }
|
16
|
-
expect(assigns(:user).email).to eq 'dude@example.com'
|
17
|
-
expect(response).to be_success
|
18
|
-
expect(response).to render_template(:new)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
context 'signed in' do
|
22
|
-
it 'redirects user to the redirect_url' do
|
23
|
-
sign_in
|
24
|
-
get :new
|
25
|
-
expect(response).to redirect_to Authenticate.configuration.redirect_url
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe 'post to #create' do
|
31
|
-
context 'not signed in' do
|
32
|
-
context 'with valid attributes' do
|
33
|
-
let(:user_attributes) { attributes_for(:user) }
|
34
|
-
subject { post :create, user: user_attributes }
|
35
|
-
|
36
|
-
it 'creates user' do
|
37
|
-
expect { subject }.to change { User.count }.by(1)
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'assigned user' do
|
41
|
-
subject
|
42
|
-
expect(assigns(:user)).to be_present
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'redirects to the redirect_url' do
|
46
|
-
subject
|
47
|
-
expect(response).to redirect_to Authenticate.configuration.redirect_url
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
context 'with valid attributes and a session return cookie' do
|
52
|
-
before do
|
53
|
-
@request.cookies[:authenticate_return_to] = '/url_in_the_session'
|
54
|
-
end
|
55
|
-
let(:user_attributes) { attributes_for(:user) }
|
56
|
-
subject { post :create, user: user_attributes }
|
57
|
-
|
58
|
-
it 'creates user' do
|
59
|
-
expect { subject }.to change { User.count }.by(1)
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'assigned user' do
|
63
|
-
subject
|
64
|
-
expect(assigns(:user)).to be_present
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'redirects to the redirect_url' do
|
68
|
-
subject
|
69
|
-
expect(response).to redirect_to '/url_in_the_session'
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
context 'signed in' do
|
75
|
-
it 'redirects to redirect_url' do
|
76
|
-
sign_in
|
77
|
-
post :create, user: {}
|
78
|
-
expect(response).to redirect_to Authenticate.configuration.redirect_url
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|