g5_authenticatable 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +4 -4
  4. data/g5_authenticatable.gemspec +1 -1
  5. data/lib/g5_authenticatable/engine.rb +0 -1
  6. data/lib/g5_authenticatable/test/controller_helpers.rb +3 -3
  7. data/lib/g5_authenticatable/test/factories/client_users.rb +1 -1
  8. data/lib/g5_authenticatable/test/factories/global_users.rb +5 -5
  9. data/lib/g5_authenticatable/test/factories/location_users.rb +1 -1
  10. data/lib/g5_authenticatable/test/factories/roles.rb +1 -1
  11. data/lib/g5_authenticatable/test/factory.rb +14 -1
  12. data/lib/g5_authenticatable/test/feature_helpers.rb +1 -1
  13. data/lib/g5_authenticatable/test/request_helpers.rb +1 -1
  14. data/lib/g5_authenticatable/version.rb +1 -1
  15. data/spec/factories/post.rb +1 -1
  16. data/spec/features/default_role_authorization_spec.rb +18 -18
  17. data/spec/features/sign_in_spec.rb +4 -4
  18. data/spec/features/token_validation_spec.rb +3 -3
  19. data/spec/models/g5_authenticatable/role_spec.rb +13 -13
  20. data/spec/models/g5_authenticatable/user_spec.rb +9 -9
  21. data/spec/models/post_spec.rb +1 -1
  22. data/spec/policies/application_policy_spec.rb +15 -15
  23. data/spec/policies/client_policy_spec.rb +5 -5
  24. data/spec/policies/location_policy_spec.rb +8 -8
  25. data/spec/policies/selectable_client_policy_spec.rb +9 -9
  26. data/spec/requests/default_role_authorization_spec.rb +12 -12
  27. data/spec/requests/token_validation_spec.rb +3 -3
  28. data/spec/services/g5_authenticatable/impersonate_sessionable_spec.rb +9 -9
  29. data/spec/support/shared_examples/super_admin_authorizer.rb +4 -4
  30. data/spec/tasks/purge_users_spec.rb +3 -3
  31. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae757957f1f5fa394c3e50c00878dbef38ead011
4
- data.tar.gz: db45e799105de584c46598aa6b3697e1ef0832d5
3
+ metadata.gz: fafd0add7d0b2d50524234cedb46b4db03da7526
4
+ data.tar.gz: 501fce66ab149473948e5a87a1c29a013880299e
5
5
  SHA512:
6
- metadata.gz: 48302016e4b40177451d5180d538e945fbe74f019dcf8806bf1fe5235228ab7d5a4ee258c775ef56453a487d66da6ae3f7d109dffdebca0254f4903b70229dbb
7
- data.tar.gz: a512cd732bbb37844436529b752c2bcc43cb8c6c18f9ba16129a9a107ebdbf3e41901e9e9d0e36a7768ed2eb3a98356302a3439868cb85a0ee8696c463915e85
6
+ metadata.gz: 9fd11e97ca4e4551abc0036e994b76e43c533fa65564277e5977f37bbc078aa7a132e23e5f580ae0a73456f827202401761dfdba80371a218d9cb497aafe94b8
7
+ data.tar.gz: 7e42afc27a541a8bf1ad88154fa3bf84b1a14caee4c1e1512f688eedf6db868428daa88b71e6f605782ca9f7a8550aca67d614d366cca713f872eeeaf9d2bc57
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## v1.1.0 (2017-12-08)
2
+
3
+ * Added support for [factory_bot_rails](https://github.com/thoughtbot/factory_bot_rails)
4
+ while deprecating support for factory_girl_rails. Existing projects that use
5
+ FactoryGirl will continue to work with the auth test helpers, but we recommend
6
+ [upgrading to factory_bot](https://github.com/thoughtbot/factory_bot/blob/4-9-0-stable/UPGRADE_FROM_FACTORY_GIRL.md)
7
+ at your earliest convenience.
8
+
1
9
  ## v1.0.0 (2017-10-19)
2
10
 
3
11
  * **Backwards incompatible changes**
data/README.md CHANGED
@@ -18,7 +18,7 @@ library in isolation.
18
18
 
19
19
  ## Current Version
20
20
 
21
- 1.0.0
21
+ 1.1.0
22
22
 
23
23
  ## Requirements
24
24
 
@@ -465,7 +465,7 @@ Because the test helpers are optional, bundler will not automatically install
465
465
  these dependencies. You will have to add the following gems to your own Gemfile:
466
466
 
467
467
  * [rspec-rails](https://github.com/rspec/rspec-rails)
468
- * [factory_girl_rails](https://github.com/thoughtbot/factory_girl_rails)
468
+ * [factory_bot_rails](https://github.com/thoughtbot/factory_bot_rails)
469
469
  * [webmock](https://github.com/bblimke/webmock)
470
470
 
471
471
  #### Incompatibilities ####
@@ -654,7 +654,7 @@ method like so:
654
654
 
655
655
  ```ruby
656
656
  describe 'my page' do
657
- let(:user) { FactoryGirl.create(:g5_authenticatable_user) }
657
+ let(:user) { FactoryBot.create(:g5_authenticatable_user) }
658
658
 
659
659
  before do
660
660
  stub_g5_omniauth(user)
@@ -670,7 +670,7 @@ token using the `stub_invalid_access_token` helper:
670
670
 
671
671
  ```ruby
672
672
  describe 'my API call' do
673
- let(:user) { FactoryGirl.create(:g5_authenticatable_user) }
673
+ let(:user) { FactoryBot.create(:g5_authenticatable_user) }
674
674
 
675
675
  before { login_user }
676
676
 
@@ -28,6 +28,6 @@ Gem::Specification.new do |spec|
28
28
  spec.add_dependency 'pundit', '~> 1.0'
29
29
  spec.add_dependency 'g5_updatable', '> 0.6.0'
30
30
 
31
- spec.add_development_dependency 'factory_girl_rails', '~> 4.8'
31
+ spec.add_development_dependency 'factory_bot_rails', '~> 4.8'
32
32
  spec.add_development_dependency 'webmock'
33
33
  end
@@ -11,7 +11,6 @@ module G5Authenticatable
11
11
  config.generators do |g|
12
12
  g.orm :active_record
13
13
  g.test_framework :rspec
14
- g.fixture_replacement :factory_girl, dir: 'spec/factories'
15
14
  end
16
15
 
17
16
  initializer 'g5_authenticatable.filter_access_token' do |app|
@@ -17,13 +17,13 @@ module G5Authenticatable
17
17
  end
18
18
 
19
19
  RSpec.shared_context 'auth controller' do
20
- let(:user) { FactoryGirl.create(:g5_authenticatable_user) }
20
+ let(:user) { FactoryBot.create(:g5_authenticatable_user) }
21
21
  include_context 'authorization controller'
22
22
  end
23
23
 
24
24
  RSpec.shared_context 'super admin auth controller' do
25
25
  let(:user) do
26
- user = FactoryGirl.create(:g5_authenticatable_user)
26
+ user = FactoryBot.create(:g5_authenticatable_user)
27
27
  user.add_role(:super_admin)
28
28
  user
29
29
  end
@@ -32,7 +32,7 @@ end
32
32
 
33
33
  RSpec.shared_context 'admin auth controller' do
34
34
  let(:user) do
35
- user = FactoryGirl.create(:g5_authenticatable_user)
35
+ user = FactoryBot.create(:g5_authenticatable_user)
36
36
  user.add_role(:admin)
37
37
  user
38
38
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :g5_authenticatable_client_user, parent: :g5_authenticatable_user do
5
5
  transient do
6
6
  clients nil
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :g5_authenticatable_user, class: 'G5Authenticatable::User' do
5
5
  sequence(:email) { |n| "test.user#{n}@test.host" }
6
6
  provider 'g5'
@@ -16,28 +16,28 @@ FactoryGirl.define do
16
16
  factory :g5_authenticatable_super_admin, parent: :g5_authenticatable_user do
17
17
  after(:build) do |user|
18
18
  user.roles.clear
19
- user.roles << FactoryGirl.build(:g5_authenticatable_super_admin_role)
19
+ user.roles << FactoryBot.build(:g5_authenticatable_super_admin_role)
20
20
  end
21
21
  end
22
22
 
23
23
  factory :g5_authenticatable_admin, parent: :g5_authenticatable_user do
24
24
  after(:build) do |user|
25
25
  user.roles.clear
26
- user.roles << FactoryGirl.build(:g5_authenticatable_admin_role)
26
+ user.roles << FactoryBot.build(:g5_authenticatable_admin_role)
27
27
  end
28
28
  end
29
29
 
30
30
  factory :g5_authenticatable_editor, parent: :g5_authenticatable_user do
31
31
  after(:build) do |user|
32
32
  user.roles.clear
33
- user.roles << FactoryGirl.build(:g5_authenticatable_editor_role)
33
+ user.roles << FactoryBot.build(:g5_authenticatable_editor_role)
34
34
  end
35
35
  end
36
36
 
37
37
  factory :g5_authenticatable_viewer, parent: :g5_authenticatable_user do
38
38
  after(:build) do |user|
39
39
  user.roles.clear
40
- user.roles << FactoryGirl.build(:g5_authenticatable_viewer_role)
40
+ user.roles << FactoryBot.build(:g5_authenticatable_viewer_role)
41
41
  end
42
42
  end
43
43
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :g5_authenticatable_location_user, parent: :g5_authenticatable_user do
5
5
  transient do
6
6
  locations nil
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :g5_authenticatable_role, class: 'G5Authenticatable::Role' do
5
5
  sequence(:name) { |n| "role_#{n}" }
6
6
  end
@@ -1,6 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'factory_girl_rails'
3
+ # TODO: drop factory_girl support and force people to upgrade
4
+ # once g5_updatable factories are using the FactoryBot constant
5
+ begin
6
+ # We need to define the aliased constant before the *_rails gem
7
+ # tries to load any factory definitions
8
+ require 'factory_bot'
9
+ FactoryGirl = FactoryBot
10
+ require 'factory_bot_rails'
11
+ rescue LoadError
12
+ require 'factory_girl'
13
+ FactoryBot = FactoryGirl
14
+ require 'factory_girl_rails'
15
+ end
16
+
4
17
  require 'g5_authenticatable/test/factories/roles'
5
18
  require 'g5_authenticatable/test/factories/global_users'
6
19
  require 'g5_authenticatable/test/factories/client_users'
@@ -52,7 +52,7 @@ end
52
52
  RSpec.shared_context 'auth' do
53
53
  include G5Authenticatable::Test::FeatureHelpers
54
54
 
55
- let(:user) { FactoryGirl.create(:g5_authenticatable_user) }
55
+ let(:user) { FactoryBot.create(:g5_authenticatable_user) }
56
56
 
57
57
  before do
58
58
  stub_g5_omniauth(user)
@@ -20,7 +20,7 @@ end
20
20
  RSpec.shared_context 'auth request' do
21
21
  include G5Authenticatable::Test::RequestHelpers
22
22
 
23
- let(:user) { FactoryGirl.create(:g5_authenticatable_user) }
23
+ let(:user) { FactoryBot.create(:g5_authenticatable_user) }
24
24
 
25
25
  before do
26
26
  login_user(user)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module G5Authenticatable
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :post do
5
5
  sequence(:content) { |n| "This is my post #{n}" }
6
6
  association :author, factory: :g5_authenticatable_user
@@ -6,13 +6,13 @@ RSpec.describe 'Default role-based authorization UI' do
6
6
  describe 'Posts index' do
7
7
  let(:visit_posts_index) { visit_path_and_login_with(posts_path, user) }
8
8
 
9
- let!(:post) { FactoryGirl.create(:post, author: user) }
10
- let!(:other_post) { FactoryGirl.create(:post) }
9
+ let!(:post) { FactoryBot.create(:post, author: user) }
10
+ let!(:other_post) { FactoryBot.create(:post) }
11
11
 
12
12
  before { visit_posts_index }
13
13
 
14
14
  context 'when authenticated user is a super admin' do
15
- let(:user) { FactoryGirl.create(:g5_authenticatable_super_admin) }
15
+ let(:user) { FactoryBot.create(:g5_authenticatable_super_admin) }
16
16
 
17
17
  it 'renders the posts index page' do
18
18
  expect(current_path).to eq(posts_path)
@@ -28,7 +28,7 @@ RSpec.describe 'Default role-based authorization UI' do
28
28
  end
29
29
 
30
30
  context 'when authenticated user is not a super admin' do
31
- let(:user) { FactoryGirl.create(:g5_authenticatable_user) }
31
+ let(:user) { FactoryBot.create(:g5_authenticatable_user) }
32
32
 
33
33
  it 'displays an error message' do
34
34
  expect(page).to have_content(/forbidden/i)
@@ -47,12 +47,12 @@ RSpec.describe 'Default role-based authorization UI' do
47
47
  describe 'Show post' do
48
48
  let(:show_post) { visit_path_and_login_with(post_path(post.id), user) }
49
49
 
50
- let!(:post) { FactoryGirl.create(:post, author: user) }
50
+ let!(:post) { FactoryBot.create(:post, author: user) }
51
51
 
52
52
  before { show_post }
53
53
 
54
54
  context 'when authenticated user is a super_admin' do
55
- let(:user) { FactoryGirl.create(:g5_authenticatable_super_admin) }
55
+ let(:user) { FactoryBot.create(:g5_authenticatable_super_admin) }
56
56
 
57
57
  it 'renders the show post page' do
58
58
  expect(current_path).to eq(post_path(post.id))
@@ -64,7 +64,7 @@ RSpec.describe 'Default role-based authorization UI' do
64
64
  end
65
65
 
66
66
  context 'when authenticated user is not a super_admin' do
67
- let(:user) { FactoryGirl.create(:g5_authenticatable_user) }
67
+ let(:user) { FactoryBot.create(:g5_authenticatable_user) }
68
68
 
69
69
  it 'displays an error message' do
70
70
  expect(page).to have_content(/forbidden/i)
@@ -82,7 +82,7 @@ RSpec.describe 'Default role-based authorization UI' do
82
82
  before { visit_new_post }
83
83
 
84
84
  context 'when authenticated user is a super admin' do
85
- let(:user) { FactoryGirl.create(:g5_authenticatable_super_admin) }
85
+ let(:user) { FactoryBot.create(:g5_authenticatable_super_admin) }
86
86
 
87
87
  it 'renders the new post page' do
88
88
  expect(current_path).to eq(new_post_path)
@@ -94,7 +94,7 @@ RSpec.describe 'Default role-based authorization UI' do
94
94
  end
95
95
 
96
96
  context 'when authenticated user is not a super admin' do
97
- let(:user) { FactoryGirl.create(:g5_authenticatable_user) }
97
+ let(:user) { FactoryBot.create(:g5_authenticatable_user) }
98
98
 
99
99
  it 'displays an error message' do
100
100
  expect(page).to have_content(/forbidden/i)
@@ -114,8 +114,8 @@ RSpec.describe 'Default role-based authorization UI' do
114
114
  fill_in 'Content', with: post.content
115
115
  end
116
116
 
117
- let(:post) { FactoryGirl.build(:post, author: user) }
118
- let(:user) { FactoryGirl.create(:g5_authenticatable_super_admin) }
117
+ let(:post) { FactoryBot.build(:post, author: user) }
118
+ let(:user) { FactoryBot.create(:g5_authenticatable_super_admin) }
119
119
 
120
120
  context 'when authenticated user is a super admin' do
121
121
  it 'renders the flash message' do
@@ -155,10 +155,10 @@ RSpec.describe 'Default role-based authorization UI' do
155
155
  end
156
156
  before { edit_post }
157
157
 
158
- let(:post) { FactoryGirl.create(:post, author: user) }
158
+ let(:post) { FactoryBot.create(:post, author: user) }
159
159
 
160
160
  context 'when authenticated user is a super admin' do
161
- let(:user) { FactoryGirl.create(:g5_authenticatable_super_admin) }
161
+ let(:user) { FactoryBot.create(:g5_authenticatable_super_admin) }
162
162
 
163
163
  it 'renders the edit post page' do
164
164
  expect(current_path).to eq(edit_post_path(post.id))
@@ -170,7 +170,7 @@ RSpec.describe 'Default role-based authorization UI' do
170
170
  end
171
171
 
172
172
  context 'when authenticated user is not a super admin' do
173
- let(:user) { FactoryGirl.create(:g5_authenticatable_user) }
173
+ let(:user) { FactoryBot.create(:g5_authenticatable_user) }
174
174
 
175
175
  it 'displays an error message' do
176
176
  expect(page).to have_content(/forbidden/i)
@@ -190,8 +190,8 @@ RSpec.describe 'Default role-based authorization UI' do
190
190
  fill_in 'Content', with: new_content
191
191
  end
192
192
 
193
- let(:post) { FactoryGirl.create(:post, author: user) }
194
- let(:user) { FactoryGirl.create(:g5_authenticatable_super_admin) }
193
+ let(:post) { FactoryBot.create(:post, author: user) }
194
+ let(:user) { FactoryBot.create(:g5_authenticatable_super_admin) }
195
195
  let(:new_content) { 'My updated post content' }
196
196
 
197
197
  context 'when authenticated user is a super admin' do
@@ -226,8 +226,8 @@ RSpec.describe 'Default role-based authorization UI' do
226
226
  describe 'Delete post' do
227
227
  subject(:delete_post) { click_link 'Destroy' }
228
228
 
229
- let!(:post) { FactoryGirl.create(:post, author: user) }
230
- let(:user) { FactoryGirl.create(:g5_authenticatable_super_admin) }
229
+ let!(:post) { FactoryBot.create(:post, author: user) }
230
+ let(:user) { FactoryBot.create(:g5_authenticatable_super_admin) }
231
231
 
232
232
  before { visit_path_and_login_with(posts_path, user) }
233
233
 
@@ -3,7 +3,7 @@
3
3
  require 'rails_helper'
4
4
 
5
5
  RSpec.describe 'Signing in' do
6
- let(:user) { FactoryGirl.create(:g5_authenticatable_viewer) }
6
+ let(:user) { FactoryBot.create(:g5_authenticatable_viewer) }
7
7
 
8
8
  context 'from a login link' do
9
9
  subject(:login) { click_link 'Login' }
@@ -43,7 +43,7 @@ RSpec.describe 'Signing in' do
43
43
  let(:updated_organization_name) { "Updated #{user.organization_name}" }
44
44
  let(:updated_access_token) { "updated-#{user.g5_access_token}-123" }
45
45
  let(:updated_role) do
46
- FactoryGirl.create(:g5_authenticatable_super_admin_role)
46
+ FactoryBot.create(:g5_authenticatable_super_admin_role)
47
47
  end
48
48
 
49
49
  it 'should sign in the user successfully' do
@@ -136,10 +136,10 @@ RSpec.describe 'Signing in' do
136
136
  end
137
137
 
138
138
  let(:user_attributes) do
139
- FactoryGirl.attributes_for(:g5_authenticatable_user)
139
+ FactoryBot.attributes_for(:g5_authenticatable_user)
140
140
  end
141
141
  let(:role_attributes) do
142
- FactoryGirl.attributes_for(:g5_authenticatable_editor_role)
142
+ FactoryBot.attributes_for(:g5_authenticatable_editor_role)
143
143
  end
144
144
 
145
145
  it 'should sign in the user successfully' do
@@ -7,7 +7,7 @@ RSpec.describe 'UI Token validation' do
7
7
  before { G5Authenticatable.strict_token_validation = true }
8
8
 
9
9
  context 'when user has a valid g5 access token' do
10
- let(:user) { FactoryGirl.create(:g5_authenticatable_user) }
10
+ let(:user) { FactoryBot.create(:g5_authenticatable_user) }
11
11
 
12
12
  before do
13
13
  stub_g5_omniauth(user)
@@ -27,7 +27,7 @@ RSpec.describe 'UI Token validation' do
27
27
  end
28
28
 
29
29
  context 'when user access token becomes invalid' do
30
- let(:user) { FactoryGirl.create(:g5_authenticatable_user) }
30
+ let(:user) { FactoryBot.create(:g5_authenticatable_user) }
31
31
 
32
32
  before do
33
33
  # User access token is valid at sign in
@@ -67,7 +67,7 @@ RSpec.describe 'UI Token validation' do
67
67
  end
68
68
 
69
69
  context 'when user access token has become invalid' do
70
- let(:user) { FactoryGirl.create(:g5_authenticatable_user) }
70
+ let(:user) { FactoryBot.create(:g5_authenticatable_user) }
71
71
 
72
72
  before do
73
73
  stub_g5_omniauth(user)
@@ -5,7 +5,7 @@ require 'rails_helper'
5
5
  RSpec.describe G5Authenticatable::Role do
6
6
  subject { role }
7
7
  let(:role) { G5Authenticatable::Role.new(role_attributes) }
8
- let(:role_attributes) { FactoryGirl.attributes_for(:g5_authenticatable_role) }
8
+ let(:role_attributes) { FactoryBot.attributes_for(:g5_authenticatable_role) }
9
9
 
10
10
  it { is_expected.to have_and_belong_to_many(:users) }
11
11
  it { is_expected.to belong_to(:resource) }
@@ -17,10 +17,10 @@ RSpec.describe G5Authenticatable::Role do
17
17
  describe '.global' do
18
18
  subject(:global) { G5Authenticatable::Role.global }
19
19
  let!(:global_role) { user.roles.first }
20
- let(:user) { FactoryGirl.create(:g5_authenticatable_viewer) }
20
+ let(:user) { FactoryBot.create(:g5_authenticatable_viewer) }
21
21
 
22
22
  let!(:scoped_role) do
23
- FactoryGirl.create(:g5_authenticatable_role,
23
+ FactoryBot.create(:g5_authenticatable_role,
24
24
  resource: user)
25
25
  end
26
26
 
@@ -37,15 +37,15 @@ RSpec.describe G5Authenticatable::Role do
37
37
  subject(:class_scoped) do
38
38
  G5Authenticatable::Role.class_scoped(G5Authenticatable::User)
39
39
  end
40
- let!(:global_role) { FactoryGirl.create(:g5_authenticatable_role) }
40
+ let!(:global_role) { FactoryBot.create(:g5_authenticatable_role) }
41
41
  let!(:class_scoped_role) do
42
- FactoryGirl.create(:g5_authenticatable_role,
42
+ FactoryBot.create(:g5_authenticatable_role,
43
43
  resource_type: 'G5Authenticatable::User')
44
44
  end
45
45
  let!(:instance_scoped_role) do
46
- FactoryGirl.create(:g5_authenticatable_role, resource: user)
46
+ FactoryBot.create(:g5_authenticatable_role, resource: user)
47
47
  end
48
- let(:user) { FactoryGirl.create(:g5_authenticatable_user) }
48
+ let(:user) { FactoryBot.create(:g5_authenticatable_user) }
49
49
 
50
50
  it 'should match one role' do
51
51
  expect(class_scoped.count).to eq(1)
@@ -58,21 +58,21 @@ RSpec.describe G5Authenticatable::Role do
58
58
 
59
59
  describe '.instance_scoped' do
60
60
  subject(:instance_scoped) { G5Authenticatable::Role.instance_scoped(user) }
61
- let!(:global_role) { FactoryGirl.create(:g5_authenticatable_role) }
61
+ let!(:global_role) { FactoryBot.create(:g5_authenticatable_role) }
62
62
  let!(:class_scoped_role) do
63
- FactoryGirl.create(:g5_authenticatable_role,
63
+ FactoryBot.create(:g5_authenticatable_role,
64
64
  resource_type: 'G5Authenticatable::User')
65
65
  end
66
66
 
67
67
  let!(:user_scoped_role) do
68
- FactoryGirl.create(:g5_authenticatable_role, resource: user)
68
+ FactoryBot.create(:g5_authenticatable_role, resource: user)
69
69
  end
70
- let(:user) { FactoryGirl.create(:g5_authenticatable_user) }
70
+ let(:user) { FactoryBot.create(:g5_authenticatable_user) }
71
71
 
72
72
  let!(:other_user_scoped_role) do
73
- FactoryGirl.create(:g5_authenticatable_role, resource: other_user)
73
+ FactoryBot.create(:g5_authenticatable_role, resource: other_user)
74
74
  end
75
- let(:other_user) { FactoryGirl.create(:g5_authenticatable_user) }
75
+ let(:other_user) { FactoryBot.create(:g5_authenticatable_user) }
76
76
 
77
77
  it 'should match one role' do
78
78
  expect(instance_scoped.count).to eq(1)
@@ -5,7 +5,7 @@ require 'rails_helper'
5
5
  RSpec.describe G5Authenticatable::User do
6
6
  subject { user }
7
7
  let(:user) { G5Authenticatable::User.create(user_attributes) }
8
- let(:user_attributes) { FactoryGirl.attributes_for(:g5_authenticatable_user) }
8
+ let(:user_attributes) { FactoryBot.attributes_for(:g5_authenticatable_user) }
9
9
 
10
10
  it { is_expected.to have_and_belong_to_many(:roles) }
11
11
 
@@ -96,10 +96,10 @@ RSpec.describe G5Authenticatable::User do
96
96
  end
97
97
 
98
98
  let(:new_user_attributes) do
99
- FactoryGirl.attributes_for(:g5_authenticatable_user)
99
+ FactoryBot.attributes_for(:g5_authenticatable_user)
100
100
  end
101
101
  let(:new_role_attributes) do
102
- FactoryGirl.attributes_for(:g5_authenticatable_role)
102
+ FactoryBot.attributes_for(:g5_authenticatable_role)
103
103
  end
104
104
 
105
105
  it 'has the correct uid' do
@@ -177,10 +177,10 @@ RSpec.describe G5Authenticatable::User do
177
177
  end
178
178
 
179
179
  let(:new_user_attributes) do
180
- FactoryGirl.attributes_for(:g5_authenticatable_user)
180
+ FactoryBot.attributes_for(:g5_authenticatable_user)
181
181
  end
182
182
  let(:new_role_attributes) do
183
- FactoryGirl.attributes_for(:g5_authenticatable_role)
183
+ FactoryBot.attributes_for(:g5_authenticatable_role)
184
184
  end
185
185
 
186
186
  context 'when there is auth data in the session' do
@@ -280,7 +280,7 @@ RSpec.describe G5Authenticatable::User do
280
280
  end
281
281
 
282
282
  let(:user_attributes) do
283
- FactoryGirl.attributes_for(:g5_authenticatable_user,
283
+ FactoryBot.attributes_for(:g5_authenticatable_user,
284
284
  first_name: nil,
285
285
  last_name: nil,
286
286
  phone_number: nil,
@@ -442,7 +442,7 @@ RSpec.describe G5Authenticatable::User do
442
442
  subject(:add_role) { user.add_role(role_name) }
443
443
 
444
444
  context 'when role already exists' do
445
- let(:role) { FactoryGirl.create(:g5_authenticatable_role) }
445
+ let(:role) { FactoryBot.create(:g5_authenticatable_role) }
446
446
  let(:role_name) { role.name }
447
447
 
448
448
  it 'should assign a role to the user' do
@@ -496,10 +496,10 @@ RSpec.describe G5Authenticatable::User do
496
496
 
497
497
  let(:user2) { G5Authenticatable::User.create(user_attributes) }
498
498
  let(:user_attributes2) do
499
- FactoryGirl.attributes_for(:g5_authenticatable_user)
499
+ FactoryBot.attributes_for(:g5_authenticatable_user)
500
500
  end
501
501
 
502
- let!(:resource) { FactoryGirl.create(:g5_updatable_client) }
502
+ let!(:resource) { FactoryBot.create(:g5_updatable_client) }
503
503
 
504
504
  let(:auth_data) do
505
505
  OmniAuth::AuthHash.new(
@@ -4,7 +4,7 @@ require 'rails_helper'
4
4
 
5
5
  RSpec.describe Post do
6
6
  subject { post }
7
- let(:post) { FactoryGirl.create(:post) }
7
+ let(:post) { FactoryBot.create(:post) }
8
8
 
9
9
  it { is_expected.to belong_to(:author) }
10
10
 
@@ -5,8 +5,8 @@ require 'rails_helper'
5
5
  RSpec.describe ApplicationPolicy do
6
6
  subject(:policy) { described_class }
7
7
 
8
- let(:user) { FactoryGirl.create(:g5_authenticatable_user) }
9
- let(:record) { FactoryGirl.create(:post) }
8
+ let(:user) { FactoryBot.create(:g5_authenticatable_user) }
9
+ let(:record) { FactoryBot.create(:post) }
10
10
 
11
11
  permissions :index? do
12
12
  it_behaves_like 'a super_admin authorizer'
@@ -14,14 +14,14 @@ RSpec.describe ApplicationPolicy do
14
14
 
15
15
  permissions :show? do
16
16
  context 'when user is a super_admin' do
17
- let(:user) { FactoryGirl.create(:g5_authenticatable_super_admin) }
17
+ let(:user) { FactoryBot.create(:g5_authenticatable_super_admin) }
18
18
 
19
19
  context 'when record exists in scope' do
20
20
  it { is_expected.to permit(user, record) }
21
21
  end
22
22
 
23
23
  context 'when record does not exist in scope' do
24
- let(:record) { FactoryGirl.build(:post) }
24
+ let(:record) { FactoryBot.build(:post) }
25
25
 
26
26
  it { is_expected.to_not permit(user, record) }
27
27
  end
@@ -75,7 +75,7 @@ RSpec.describe ApplicationPolicy do
75
75
  end
76
76
 
77
77
  context 'when user has the super_admin role' do
78
- let(:user) { FactoryGirl.create(:g5_authenticatable_super_admin) }
78
+ let(:user) { FactoryBot.create(:g5_authenticatable_super_admin) }
79
79
 
80
80
  it { is_expected.to eq(true) }
81
81
  end
@@ -95,7 +95,7 @@ RSpec.describe ApplicationPolicy do
95
95
  end
96
96
 
97
97
  context 'when user has the admin role' do
98
- let(:user) { FactoryGirl.create(:g5_authenticatable_admin) }
98
+ let(:user) { FactoryBot.create(:g5_authenticatable_admin) }
99
99
 
100
100
  it { is_expected.to eq(true) }
101
101
  end
@@ -115,7 +115,7 @@ RSpec.describe ApplicationPolicy do
115
115
  end
116
116
 
117
117
  context 'when user has the editor role' do
118
- let(:user) { FactoryGirl.create(:g5_authenticatable_editor) }
118
+ let(:user) { FactoryBot.create(:g5_authenticatable_editor) }
119
119
 
120
120
  it { is_expected.to eq(true) }
121
121
  end
@@ -131,13 +131,13 @@ RSpec.describe ApplicationPolicy do
131
131
  end
132
132
 
133
133
  context 'when user does not have viewer role' do
134
- let(:user) { FactoryGirl.create(:g5_authenticatable_editor) }
134
+ let(:user) { FactoryBot.create(:g5_authenticatable_editor) }
135
135
 
136
136
  it { is_expected.to eq(false) }
137
137
  end
138
138
 
139
139
  context 'when user has the viewer role' do
140
- let(:user) { FactoryGirl.create(:g5_authenticatable_viewer) }
140
+ let(:user) { FactoryBot.create(:g5_authenticatable_viewer) }
141
141
 
142
142
  it { is_expected.to eq(true) }
143
143
  end
@@ -147,35 +147,35 @@ RSpec.describe ApplicationPolicy do
147
147
  subject(:global_role?) { policy.new(user, record).global_role? }
148
148
 
149
149
  let(:scoped_role) do
150
- FactoryGirl.create(:g5_authenticatable_role, name: role_name,
150
+ FactoryBot.create(:g5_authenticatable_role, name: role_name,
151
151
  resource: resource)
152
152
  end
153
- let(:resource) { FactoryGirl.create(:g5_updatable_client) }
153
+ let(:resource) { FactoryBot.create(:g5_updatable_client) }
154
154
 
155
155
  context 'when there is no user' do
156
156
  it { is_expected.to eq(false) }
157
157
  end
158
158
 
159
159
  context 'when the user is a global super admin' do
160
- let(:user) { FactoryGirl.create(:g5_authenticatable_super_admin) }
160
+ let(:user) { FactoryBot.create(:g5_authenticatable_super_admin) }
161
161
 
162
162
  it { is_expected.to eq(true) }
163
163
  end
164
164
 
165
165
  context 'when the user is a global admin' do
166
- let(:user) { FactoryGirl.create(:g5_authenticatable_admin) }
166
+ let(:user) { FactoryBot.create(:g5_authenticatable_admin) }
167
167
 
168
168
  it { is_expected.to eq(true) }
169
169
  end
170
170
 
171
171
  context 'when the user is a global editor' do
172
- let(:user) { FactoryGirl.create(:g5_authenticatable_editor) }
172
+ let(:user) { FactoryBot.create(:g5_authenticatable_editor) }
173
173
 
174
174
  it { is_expected.to eq(true) }
175
175
  end
176
176
 
177
177
  context 'when the user is a global viewer' do
178
- let(:user) { FactoryGirl.create(:g5_authenticatable_viewer) }
178
+ let(:user) { FactoryBot.create(:g5_authenticatable_viewer) }
179
179
 
180
180
  it { is_expected.to eq(true) }
181
181
  end
@@ -5,8 +5,8 @@ require 'rails_helper'
5
5
  RSpec.describe G5Updatable::ClientPolicy do
6
6
  subject(:policy) { described_class }
7
7
 
8
- let(:user) { FactoryGirl.create(:g5_authenticatable_user) }
9
- let(:user2) { FactoryGirl.create(:g5_authenticatable_user) }
8
+ let(:user) { FactoryBot.create(:g5_authenticatable_user) }
9
+ let(:user2) { FactoryBot.create(:g5_authenticatable_user) }
10
10
 
11
11
  before do
12
12
  user.roles = []
@@ -14,9 +14,9 @@ RSpec.describe G5Updatable::ClientPolicy do
14
14
  user2.add_role(:viewer, client_1)
15
15
  end
16
16
 
17
- let!(:client_1) { FactoryGirl.create(:g5_updatable_client) }
18
- let!(:client_2) { FactoryGirl.create(:g5_updatable_client) }
19
- let!(:client_3) { FactoryGirl.create(:g5_updatable_client) }
17
+ let!(:client_1) { FactoryBot.create(:g5_updatable_client) }
18
+ let!(:client_2) { FactoryBot.create(:g5_updatable_client) }
19
+ let!(:client_3) { FactoryBot.create(:g5_updatable_client) }
20
20
 
21
21
  describe '.resolve' do
22
22
  subject do
@@ -5,24 +5,24 @@ require 'rails_helper'
5
5
  RSpec.describe G5Updatable::LocationPolicy do
6
6
  subject(:policy) { described_class }
7
7
 
8
- let(:user) { FactoryGirl.create(:g5_authenticatable_user) }
9
- let(:user2) { FactoryGirl.create(:g5_authenticatable_user) }
8
+ let(:user) { FactoryBot.create(:g5_authenticatable_user) }
9
+ let(:user2) { FactoryBot.create(:g5_authenticatable_user) }
10
10
 
11
- let!(:client_1) { FactoryGirl.create(:g5_updatable_client) }
12
- let!(:client_2) { FactoryGirl.create(:g5_updatable_client) }
11
+ let!(:client_1) { FactoryBot.create(:g5_updatable_client) }
12
+ let!(:client_2) { FactoryBot.create(:g5_updatable_client) }
13
13
 
14
14
  let!(:location_1) do
15
- FactoryGirl.create(:g5_updatable_location, client: client_1)
15
+ FactoryBot.create(:g5_updatable_location, client: client_1)
16
16
  end
17
17
  let!(:location_2) do
18
- FactoryGirl.create(:g5_updatable_location, client: client_1)
18
+ FactoryBot.create(:g5_updatable_location, client: client_1)
19
19
  end
20
20
 
21
21
  let!(:location_3) do
22
- FactoryGirl.create(:g5_updatable_location, client: client_2)
22
+ FactoryBot.create(:g5_updatable_location, client: client_2)
23
23
  end
24
24
  let!(:location_4) do
25
- FactoryGirl.create(:g5_updatable_location, client: client_2)
25
+ FactoryBot.create(:g5_updatable_location, client: client_2)
26
26
  end
27
27
 
28
28
  before do
@@ -5,8 +5,8 @@ require 'rails_helper'
5
5
  RSpec.describe G5Updatable::SelectableClientPolicy do
6
6
  subject(:policy) { described_class }
7
7
 
8
- let(:user) { FactoryGirl.create(:g5_authenticatable_user) }
9
- let(:user2) { FactoryGirl.create(:g5_authenticatable_user) }
8
+ let(:user) { FactoryBot.create(:g5_authenticatable_user) }
9
+ let(:user2) { FactoryBot.create(:g5_authenticatable_user) }
10
10
 
11
11
  before do
12
12
  user.roles = []
@@ -14,9 +14,9 @@ RSpec.describe G5Updatable::SelectableClientPolicy do
14
14
  user2.add_role(:viewer, client_1)
15
15
  end
16
16
 
17
- let!(:client_1) { FactoryGirl.create(:g5_updatable_client) }
18
- let!(:client_2) { FactoryGirl.create(:g5_updatable_client) }
19
- let!(:client_3) { FactoryGirl.create(:g5_updatable_client) }
17
+ let!(:client_1) { FactoryBot.create(:g5_updatable_client) }
18
+ let!(:client_2) { FactoryBot.create(:g5_updatable_client) }
19
+ let!(:client_3) { FactoryBot.create(:g5_updatable_client) }
20
20
 
21
21
  describe '.resolve' do
22
22
  subject do
@@ -25,17 +25,17 @@ RSpec.describe G5Updatable::SelectableClientPolicy do
25
25
  end
26
26
 
27
27
  let!(:location_1) do
28
- FactoryGirl.create(:g5_updatable_location, client: client_1)
28
+ FactoryBot.create(:g5_updatable_location, client: client_1)
29
29
  end
30
30
  let!(:location_2) do
31
- FactoryGirl.create(:g5_updatable_location, client: client_1)
31
+ FactoryBot.create(:g5_updatable_location, client: client_1)
32
32
  end
33
33
 
34
34
  let!(:location_3) do
35
- FactoryGirl.create(:g5_updatable_location, client: client_2)
35
+ FactoryBot.create(:g5_updatable_location, client: client_2)
36
36
  end
37
37
  let!(:location_4) do
38
- FactoryGirl.create(:g5_updatable_location, client: client_2)
38
+ FactoryBot.create(:g5_updatable_location, client: client_2)
39
39
  end
40
40
 
41
41
  context 'with global role' do
@@ -8,13 +8,13 @@ RSpec.describe 'Default role-based authorization API' do
8
8
  describe 'GET /posts', :auth_request do
9
9
  subject(:get_posts) { safe_get posts_path, format: :json }
10
10
 
11
- let!(:post) { FactoryGirl.create(:post, author: user) }
12
- let!(:other_post) { FactoryGirl.create(:post) }
11
+ let!(:post) { FactoryBot.create(:post, author: user) }
12
+ let!(:other_post) { FactoryBot.create(:post) }
13
13
 
14
14
  before { get_posts }
15
15
 
16
16
  context 'when user is a super_admin' do
17
- let(:user) { FactoryGirl.create(:g5_authenticatable_super_admin) }
17
+ let(:user) { FactoryBot.create(:g5_authenticatable_super_admin) }
18
18
 
19
19
  it 'returns ok' do
20
20
  expect(response).to be_ok
@@ -42,12 +42,12 @@ RSpec.describe 'Default role-based authorization API' do
42
42
  describe 'GET /posts/:id', :auth_request do
43
43
  subject(:show_post) { safe_get post_path(post.id), format: :json }
44
44
 
45
- let(:post) { FactoryGirl.create(:post, author: user) }
45
+ let(:post) { FactoryBot.create(:post, author: user) }
46
46
 
47
47
  before { show_post }
48
48
 
49
49
  context 'when user is a super_admin' do
50
- let(:user) { FactoryGirl.create(:g5_authenticatable_super_admin) }
50
+ let(:user) { FactoryBot.create(:g5_authenticatable_super_admin) }
51
51
 
52
52
  it 'returns ok' do
53
53
  expect(response).to be_ok
@@ -61,7 +61,7 @@ RSpec.describe 'Default role-based authorization API' do
61
61
  end
62
62
 
63
63
  context 'when user is not a super_admin' do
64
- let(:user) { FactoryGirl.create(:g5_authenticatable_viewer) }
64
+ let(:user) { FactoryBot.create(:g5_authenticatable_viewer) }
65
65
 
66
66
  it 'returns forbidden' do
67
67
  expect(response).to be_forbidden
@@ -77,10 +77,10 @@ RSpec.describe 'Default role-based authorization API' do
77
77
  let(:post_params) do
78
78
  { content: post_obj.content, author_id: post_obj.author.id }
79
79
  end
80
- let(:post_obj) { FactoryGirl.build(:post, author: user) }
80
+ let(:post_obj) { FactoryBot.build(:post, author: user) }
81
81
 
82
82
  context 'when user is a super_admin' do
83
- let(:user) { FactoryGirl.create(:g5_authenticatable_super_admin) }
83
+ let(:user) { FactoryBot.create(:g5_authenticatable_super_admin) }
84
84
 
85
85
  it 'returns ok' do
86
86
  create_post
@@ -112,10 +112,10 @@ RSpec.describe 'Default role-based authorization API' do
112
112
  let(:post_params) do
113
113
  { content: 'some brand new content', author_id: post.author.id }
114
114
  end
115
- let(:post) { FactoryGirl.create(:post, author: user) }
115
+ let(:post) { FactoryBot.create(:post, author: user) }
116
116
 
117
117
  context 'when user is a super_admin' do
118
- let(:user) { FactoryGirl.create(:g5_authenticatable_super_admin) }
118
+ let(:user) { FactoryBot.create(:g5_authenticatable_super_admin) }
119
119
 
120
120
  it 'returns ok' do
121
121
  update_post
@@ -144,10 +144,10 @@ RSpec.describe 'Default role-based authorization API' do
144
144
  safe_delete post_path(post.id), format: :json
145
145
  end
146
146
 
147
- let!(:post) { FactoryGirl.create(:post, author: user) }
147
+ let!(:post) { FactoryBot.create(:post, author: user) }
148
148
 
149
149
  context 'when user is a super_admin' do
150
- let(:user) { FactoryGirl.create(:g5_authenticatable_super_admin) }
150
+ let(:user) { FactoryBot.create(:g5_authenticatable_super_admin) }
151
151
 
152
152
  it 'returns ok' do
153
153
  delete_post
@@ -13,7 +13,7 @@ RSpec.describe 'API Token validation' do
13
13
  before { G5Authenticatable.strict_token_validation = true }
14
14
 
15
15
  context 'when user has a valid g5 access token' do
16
- let(:user) { FactoryGirl.create(:g5_authenticatable_user) }
16
+ let(:user) { FactoryBot.create(:g5_authenticatable_user) }
17
17
 
18
18
  before do
19
19
  login_user(user)
@@ -29,7 +29,7 @@ RSpec.describe 'API Token validation' do
29
29
  end
30
30
 
31
31
  context 'when user has an invalid g5 access token' do
32
- let(:user) { FactoryGirl.create(:g5_authenticatable_user) }
32
+ let(:user) { FactoryBot.create(:g5_authenticatable_user) }
33
33
 
34
34
  before do
35
35
  login_user(user)
@@ -56,7 +56,7 @@ RSpec.describe 'API Token validation' do
56
56
  before { G5Authenticatable.strict_token_validation = false }
57
57
 
58
58
  context 'when the user has an invalid g5 access token' do
59
- let(:user) { FactoryGirl.create(:g5_authenticatable_user) }
59
+ let(:user) { FactoryBot.create(:g5_authenticatable_user) }
60
60
 
61
61
  before do
62
62
  login_user(user)
@@ -3,7 +3,7 @@
3
3
  require 'rails_helper'
4
4
 
5
5
  RSpec.describe G5Authenticatable::ImpersonateSessionable do
6
- let!(:user) { FactoryGirl.create(:g5_authenticatable_user) }
6
+ let!(:user) { FactoryBot.create(:g5_authenticatable_user) }
7
7
 
8
8
  class MyImpersponateSessionableTest
9
9
  include G5Authenticatable::ImpersonateSessionable
@@ -52,25 +52,25 @@ RSpec.describe G5Authenticatable::ImpersonateSessionable do
52
52
 
53
53
  context 'having a super admin and any other user' do
54
54
  let!(:user) do
55
- user = FactoryGirl.create(:g5_authenticatable_user)
55
+ user = FactoryBot.create(:g5_authenticatable_user)
56
56
  user.add_role(:super_admin)
57
57
  user
58
58
  end
59
- let!(:user2) { FactoryGirl.create(:g5_authenticatable_user) }
59
+ let!(:user2) { FactoryBot.create(:g5_authenticatable_user) }
60
60
 
61
61
  it { is_expected.to eq(true) }
62
62
  end
63
63
 
64
64
  context 'having an admin' do
65
65
  let!(:user) do
66
- user = FactoryGirl.create(:g5_authenticatable_user)
66
+ user = FactoryBot.create(:g5_authenticatable_user)
67
67
  user.add_role(:admin)
68
68
  user
69
69
  end
70
70
 
71
71
  context 'assuming a super admin' do
72
72
  let!(:user2) do
73
- user = FactoryGirl.create(:g5_authenticatable_user)
73
+ user = FactoryBot.create(:g5_authenticatable_user)
74
74
  user.add_role(:super_admin)
75
75
  user
76
76
  end
@@ -80,7 +80,7 @@ RSpec.describe G5Authenticatable::ImpersonateSessionable do
80
80
 
81
81
  context 'assuming another admin' do
82
82
  let!(:user2) do
83
- user = FactoryGirl.create(:g5_authenticatable_user)
83
+ user = FactoryBot.create(:g5_authenticatable_user)
84
84
  user.add_role(:admin)
85
85
  user
86
86
  end
@@ -89,7 +89,7 @@ RSpec.describe G5Authenticatable::ImpersonateSessionable do
89
89
  end
90
90
 
91
91
  context 'assuming a regular user' do
92
- let!(:user2) { FactoryGirl.create(:g5_authenticatable_user) }
92
+ let!(:user2) { FactoryBot.create(:g5_authenticatable_user) }
93
93
 
94
94
  it { is_expected.to eq(true) }
95
95
  end
@@ -97,7 +97,7 @@ RSpec.describe G5Authenticatable::ImpersonateSessionable do
97
97
 
98
98
  context 'providing no user' do
99
99
  context 'when user to impersonate is nil' do
100
- let(:user) { FactoryGirl.create(:g5_authenticatable_super_admin) }
100
+ let(:user) { FactoryBot.create(:g5_authenticatable_super_admin) }
101
101
  let(:user2) {}
102
102
 
103
103
  it { is_expected.to eq(false) }
@@ -105,7 +105,7 @@ RSpec.describe G5Authenticatable::ImpersonateSessionable do
105
105
 
106
106
  context 'when signed-in user is nil' do
107
107
  let(:user) {}
108
- let(:user2) { FactoryGirl.create(:g5_authenticatable_user) }
108
+ let(:user2) { FactoryBot.create(:g5_authenticatable_user) }
109
109
 
110
110
  it { is_expected.to eq(false) }
111
111
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  RSpec.shared_examples_for 'a super_admin authorizer' do
4
4
  context 'when user is an admin' do
5
- let(:user) { FactoryGirl.create(:g5_authenticatable_admin) }
5
+ let(:user) { FactoryBot.create(:g5_authenticatable_admin) }
6
6
 
7
7
  it 'denies access' do
8
8
  expect(policy).to_not permit(user, record)
@@ -10,7 +10,7 @@ RSpec.shared_examples_for 'a super_admin authorizer' do
10
10
  end
11
11
 
12
12
  context 'when user is an editor' do
13
- let(:user) { FactoryGirl.create(:g5_authenticatable_editor) }
13
+ let(:user) { FactoryBot.create(:g5_authenticatable_editor) }
14
14
 
15
15
  it 'denies access' do
16
16
  expect(policy).to_not permit(user, record)
@@ -18,7 +18,7 @@ RSpec.shared_examples_for 'a super_admin authorizer' do
18
18
  end
19
19
 
20
20
  context 'when user is a viewer' do
21
- let(:user) { FactoryGirl.create(:g5_authenticatable_user) }
21
+ let(:user) { FactoryBot.create(:g5_authenticatable_user) }
22
22
 
23
23
  it 'denies access' do
24
24
  expect(policy).to_not permit(user, record)
@@ -26,7 +26,7 @@ RSpec.shared_examples_for 'a super_admin authorizer' do
26
26
  end
27
27
 
28
28
  context 'when user has super_admin role' do
29
- let(:user) { FactoryGirl.create(:g5_authenticatable_super_admin) }
29
+ let(:user) { FactoryBot.create(:g5_authenticatable_super_admin) }
30
30
 
31
31
  it 'permits access' do
32
32
  expect(policy).to permit(user, record)
@@ -17,7 +17,7 @@ RSpec.describe 'g5_authenticatable:purge_users' do
17
17
  end
18
18
 
19
19
  context 'when there is one local user' do
20
- let!(:user) { FactoryGirl.create(:g5_authenticatable_user) }
20
+ let!(:user) { FactoryBot.create(:g5_authenticatable_user) }
21
21
 
22
22
  it 'should delete the user data from the db' do
23
23
  expect { task.invoke }.to change { G5Authenticatable::User.count }.from(1).to(0)
@@ -25,8 +25,8 @@ RSpec.describe 'g5_authenticatable:purge_users' do
25
25
  end
26
26
 
27
27
  context 'when there are multiple local users' do
28
- let!(:user1) { FactoryGirl.create(:g5_authenticatable_user) }
29
- let!(:user2) { FactoryGirl.create(:g5_authenticatable_user) }
28
+ let!(:user1) { FactoryBot.create(:g5_authenticatable_user) }
29
+ let!(:user2) { FactoryBot.create(:g5_authenticatable_user) }
30
30
 
31
31
  it 'should delete the user data from the db' do
32
32
  expect { task.invoke }.to change { G5Authenticatable::User.count }.from(2).to(0)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: g5_authenticatable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - maeve
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-19 00:00:00.000000000 Z
11
+ date: 2017-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: devise_g5_authenticatable
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.6.0
83
83
  - !ruby/object:Gem::Dependency
84
- name: factory_girl_rails
84
+ name: factory_bot_rails
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"