refinerycms-authentication-devise 2.0.0 → 2.0.1

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.
Files changed (54) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/release.yml +41 -0
  3. data/.github/workflows/ruby.yml +60 -0
  4. data/CHANGELOG.md +9 -0
  5. data/Gemfile +14 -8
  6. data/Rakefile +2 -1
  7. data/app/controllers/refinery/authentication/devise/admin/users_controller.rb +30 -20
  8. data/app/controllers/refinery/authentication/devise/passwords_controller.rb +33 -28
  9. data/app/models/refinery/authentication/devise/user.rb +1 -1
  10. data/config/locales/bg.yml +0 -1
  11. data/config/locales/ca.yml +0 -1
  12. data/config/locales/cs.yml +0 -1
  13. data/config/locales/da.yml +0 -1
  14. data/config/locales/de.yml +0 -1
  15. data/config/locales/el.yml +0 -1
  16. data/config/locales/en.yml +0 -1
  17. data/config/locales/es.yml +0 -1
  18. data/config/locales/fi.yml +0 -1
  19. data/config/locales/fr.yml +0 -1
  20. data/config/locales/hu.yml +0 -1
  21. data/config/locales/it.yml +0 -1
  22. data/config/locales/ja.yml +0 -1
  23. data/config/locales/ko.yml +0 -1
  24. data/config/locales/lt.yml +0 -1
  25. data/config/locales/lv.yml +0 -1
  26. data/config/locales/nb.yml +0 -1
  27. data/config/locales/nl.yml +0 -1
  28. data/config/locales/pl.yml +0 -1
  29. data/config/locales/pt-BR.yml +0 -1
  30. data/config/locales/pt.yml +0 -1
  31. data/config/locales/rs.yml +0 -1
  32. data/config/locales/ru.yml +0 -1
  33. data/config/locales/sk.yml +0 -1
  34. data/config/locales/sl.yml +0 -1
  35. data/config/locales/sv.yml +0 -1
  36. data/config/locales/tr.yml +0 -1
  37. data/config/locales/uk.yml +0 -1
  38. data/config/locales/vi.yml +0 -1
  39. data/config/locales/zh-CN.yml +0 -1
  40. data/config/locales/zh-TW.yml +0 -1
  41. data/lib/refinery/authentication/devise.rb +1 -1
  42. data/refinerycms-authentication-devise.gemspec +3 -3
  43. data/spec/controllers/refinery/authentication/devise/admin/users_controller_spec.rb +20 -5
  44. data/spec/factories/user.rb +3 -3
  45. data/spec/features/refinery/authentication/devise/admin/users_spec.rb +2 -2
  46. data/spec/features/refinery/authentication/devise/passwords_spec.rb +35 -34
  47. data/spec/features/refinery/authentication/devise/sessions_spec.rb +3 -3
  48. data/spec/lib/refinery/authentication/devise/path_helpers_spec.rb +24 -0
  49. data/spec/models/refinery/user_spec.rb +13 -13
  50. data/spec/spec_helper.rb +11 -0
  51. data/spec/support/refinery/authentication/devise/controller_macros.rb +3 -6
  52. data/spec/support/refinery/authentication/devise/feature_macros.rb +1 -1
  53. metadata +10 -17
  54. data/.travis.yml +0 -15
@@ -44,7 +44,6 @@ ru:
44
44
  enter_email_address: 'Пожалуйста, введите адрес электронной почты вашего акаунта.'
45
45
  reset_password: Сбросить пароль
46
46
  blank_email: Вы не ввели адрес электронной почты
47
- email_not_associated_with_account_html: "%{email} не принадлежит ни одному акаунту.<br/>Вы уверены, что ввели правильный адрес электронной почты?"
48
47
  email_reset_sent: Вам выслано электронное письмо с ссылкой для сброса пароля.
49
48
  password_encryption: 'В Refinery изменились алгоритмы шифрования пароля для ещё более надёжного хранения, поэтому вам нужно заново его установить.'
50
49
  reset:
@@ -44,7 +44,6 @@ sk:
44
44
  enter_email_address: Prosím zadajte emailovú adresu.
45
45
  reset_password: Resetovať heslo
46
46
  blank_email: Musíte zadať emailovú adresu.
47
- email_not_associated_with_account_html: "Email '%{email}' nie je asociovaný z žiadnym užívateľským kontom.<br />Ste si istí, že ste použili správnu adresu?"
48
47
  email_reset_sent: Bol vám zaslaný email s odkazom na resetovanie hesla.
49
48
  password_encryption: 'Musíte si zmeniť heslo, pretože nastala zmena v šifrovacie metóde uložených hesiel. Refinery sa stáva viac bezpečnejšie ako predtým.'
50
49
  reset:
@@ -37,7 +37,6 @@ sl:
37
37
  enter_email_address: Prosimo vnesite email naslov za vaš račun.
38
38
  reset_password: Ponastavi geslo
39
39
  blank_email: Niste vnesli email naslova.
40
- email_not_associated_with_account_html: "Oprostite, '%{email}' ni povezan z nobenim računom.<br/>Ali ste prepričani, a ste vnesli pravilen naslov?"
41
40
  email_reset_sent: Poslali smo vam email sporočilo s povezavo za ponastavitev gesla.
42
41
  password_encryption: 'Morate ponastaviti geslo, ker je prišlo do sprememb v metodah šifriranja gesla, ki jih uporablja Refinery tako, da so gesla shranjenja še z močnejšo enkripcijo kot prej.'
43
42
  reset:
@@ -38,7 +38,6 @@ sv:
38
38
  enter_email_address: Var god fyll i e-postadress för ditt konto.
39
39
  reset_password: Återställ lösenord
40
40
  blank_email: Du fyllde inte i någon e-postadress.
41
- email_not_associated_with_account_html: "Tyvärr, '%{email}' finns inte med i systemet.<br />Är du säker på att du fyllde i rätt e-postadress?"
42
41
  email_reset_sent: Ett e-post har skickats till dig med instruktioner om hur du återställer ditt lösenord.
43
42
  password_encryption: Du måste sätta ett nytt lösenord. Detta på grund av att krypteringmetoden som Refinery använder sig av har bytts ut mot en bättre och säkrare kryptering.
44
43
  reset:
@@ -44,7 +44,6 @@ tr:
44
44
  enter_email_address: Lutfen hesabiniz icin E-posta Adresinizi girin.
45
45
  reset_password: Parolayi Sifirla
46
46
  blank_email: Herhangi bir e-posta adresi girmediniz
47
- email_not_associated_with_account_html: "Uzgunum, '%{email}' adli postayla iliskili herhangi bir hesap bulunamadi.<br />Dogru bir e-posta adresi girdiginizden emin misin?"
48
47
  email_reset_sent: Sifrenizi sifirlamak icin e-posta gonderilmistir.
49
48
  password_encryption: Sifreni sifirlamak zorundasin cunku Refinery nin sifreleme metodundaki degisikliklerden daha guclu bir sifreleme metodu kayitlandi.
50
49
  reset:
@@ -39,7 +39,6 @@ uk:
39
39
  enter_email_address: 'Введіть, будь ласка, адресу електронної пошти вашого облікового запису.'
40
40
  reset_password: Скинути пароль
41
41
  blank_email: Ви не ввели адресу електронної пошти
42
- email_not_associated_with_account_html: "%{email} не належить жодному обліковому.<br/>Ви впевнені, що ввели правильну адресу електронної пошти?"
43
42
  email_reset_sent: Вам вислано електронного листа з посиланням для скидання пароля.
44
43
  password_encryption: 'У Refinery змінилися алгоритми шифрування пароля для ще більш надійного зберігання, тому вам потрібно заново його встановити.'
45
44
  reset:
@@ -38,7 +38,6 @@ vi:
38
38
  enter_email_address: Xin vui lòng nhận địa chỉ thư điện tử cho tài khoản cuả bạn.
39
39
  reset_password: Khởi tạo lại mật khẩu
40
40
  blank_email: Bạn chưa nhập địa chỉ thư điện tử.
41
- email_not_associated_with_account_html: "Xin lỗi, '%{email}' không có trong hệ thống.<br />Bạn có chắc là đã nhập đúng địa chỉ thư điện tử?"
42
41
  email_reset_sent: Thử điện tử chứa đường dẫn để khởi tạo lại mật khẩu vừa được gửi tới bạn.
43
42
  password_encryption: Bạn cần khởi tạo lại mật khẩu vì có thay đổi trong cách chúng tôi mã khoá mật khẩu.
44
43
  reset:
@@ -38,7 +38,6 @@ zh-CN:
38
38
  enter_email_address: 请为您的帐号输入邮件地址.
39
39
  reset_password: 重置密码
40
40
  blank_email: 您没有输入邮件地址.
41
- email_not_associated_with_account_html: "对不起, '%{email}' 并没有关联到任何的帐号.<br />您确认输入了正确的邮件地址?"
42
41
  email_reset_sent: 一封包含有重置密码链接的邮件已经发送到您的邮箱.
43
42
  password_encryption: '请重置您的密码. (为了更好的安全性,Refinery 改进了加密算法, 您需要重置密码使之生效)'
44
43
  reset:
@@ -38,7 +38,6 @@ zh-TW:
38
38
  enter_email_address: 請為您的帳號輸入電子郵件地址
39
39
  reset_password: 重設密碼
40
40
  blank_email: 您沒有輸入電子郵件地址.
41
- email_not_associated_with_account_html: "抱歉, '%{email}' 不是任何帳號的電子郵件地址.<br />您確定輸入了正確的電子郵件地址嗎?"
42
41
  email_reset_sent: 一封附上可重設您密碼的連結的電子郵件已經寄給您
43
42
  password_encryption: "因為 Refinery 有些密碼加密演算法的改變, 所以您必須重設您的密碼, 如此您的密碼會比以往更安全地儲存著."
44
43
  reset:
@@ -19,7 +19,7 @@ module Refinery
19
19
  end
20
20
 
21
21
  def root
22
- @root ||= Pathname.new(File.expand_path('../../../', __FILE__))
22
+ @root ||= Pathname.new(File.expand_path('../../../../', __FILE__))
23
23
  end
24
24
  end
25
25
  end
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |s|
3
3
  s.platform = Gem::Platform::RUBY
4
4
  s.name = %q{refinerycms-authentication-devise}
5
- s.version = %q{2.0.0}
5
+ s.version = %q{2.0.1}
6
6
  s.summary = %q{Devise based authentication extension for Refinery CMS}
7
7
  s.description = %q{A Devise authentication extension for Refinery CMS}
8
8
  s.homepage = %q{http://refinerycms.com}
@@ -14,9 +14,9 @@ Gem::Specification.new do |s|
14
14
  s.test_files = `git ls-files -- spec/*`.split("\n")
15
15
 
16
16
  s.add_dependency 'refinerycms-core', ['>= 3.0.0', '< 5.0']
17
- s.add_dependency 'actionmailer', ['>= 5.0.0', '< 5.2']
17
+ s.add_dependency 'actionmailer', '>= 5.0.0'
18
18
  s.add_dependency 'devise', ['~> 4.0', '>= 4.3.0']
19
- s.add_dependency 'friendly_id', '~> 5.2.1'
19
+ s.add_dependency 'friendly_id', '~> 5.2'
20
20
 
21
21
  s.required_ruby_version = '>= 2.2.2'
22
22
  end
@@ -22,7 +22,8 @@ describe Refinery::Authentication::Devise::Admin::UsersController, :type => :con
22
22
  describe "#new" do
23
23
  it "renders the new template" do
24
24
  get :new
25
- expect(response).to be_success
25
+
26
+ expect(response).to be_successful
26
27
  expect(response).to render_template("refinery/authentication/devise/admin/users/new")
27
28
  end
28
29
 
@@ -45,7 +46,7 @@ describe Refinery::Authentication::Devise::Admin::UsersController, :type => :con
45
46
  expect(user).to receive(:save).once{ false }
46
47
  expect(Refinery::Authentication::Devise::User).to receive(:new).once.with(instance_of(ActionController::Parameters)){ user }
47
48
  post :create, params: { user: { username: 'bobby' } }
48
- expect(response).to be_success
49
+ expect(response).to be_successful
49
50
  expect(response).to render_template("refinery/authentication/devise/admin/users/new")
50
51
  end
51
52
  end
@@ -55,7 +56,7 @@ describe Refinery::Authentication::Devise::Admin::UsersController, :type => :con
55
56
 
56
57
  it "renders the edit template" do
57
58
  get :edit, params: { id: logged_in_user.id }
58
- expect(response).to be_success
59
+ expect(response).to be_successful
59
60
  expect(response).to render_template("refinery/authentication/devise/admin/users/edit")
60
61
  end
61
62
 
@@ -65,7 +66,7 @@ describe Refinery::Authentication::Devise::Admin::UsersController, :type => :con
65
66
  describe "#update" do
66
67
  refinery_login_with_devise [:refinery, :superuser]
67
68
 
68
- let(:additional_user) { FactoryGirl.create :authentication_devise_refinery_user }
69
+ let(:additional_user) { FactoryBot.create :authentication_devise_refinery_user }
69
70
  it "updates a user" do
70
71
  patch :update, params: { id: additional_user.id.to_s, user: { username: 'bobby' } }
71
72
  expect(response).to be_redirect
@@ -79,12 +80,26 @@ describe Refinery::Authentication::Devise::Admin::UsersController, :type => :con
79
80
  end
80
81
 
81
82
  it "will update to the plugins supplied" do
82
- expect(logged_in_user).to receive(:update_attributes).with({"plugins" => %w(refinery_authentication_devise some_plugin)})
83
+ expect(logged_in_user).to receive(:update).with({"plugins" => %w(refinery_authentication_devise some_plugin)})
83
84
  allow(Refinery::Authentication::Devise::User).to receive_message_chain(:includes, :find) { logged_in_user }
84
85
  patch :update, params: { id: logged_in_user.id.to_s, user: { plugins: %w(refinery_authentication_devise some_plugin) } }
85
86
  end
86
87
  end
87
88
 
89
+ context "when a non-superuser tries to escalate their own plugins (REF-R004)" do
90
+ refinery_login_with_devise [:refinery]
91
+
92
+ it "ignores submitted plugins and preserves existing ones" do
93
+ existing_plugins = logged_in_user.plugins.pluck(:name)
94
+ patch :update, params: { id: logged_in_user.id.to_s, user: {
95
+ username: logged_in_user.username,
96
+ plugins: %w(refinery_authentication_devise refinery_pages refinery_images refinery_files)
97
+ } }
98
+ logged_in_user.reload
99
+ expect(logged_in_user.plugins.pluck(:name)).to eq(existing_plugins)
100
+ end
101
+ end
102
+
88
103
  it_should_behave_like "new, create, update, edit and update actions"
89
104
  end
90
105
  end
@@ -1,9 +1,9 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :authentication_devise_user, :class => Refinery::Authentication::Devise::User do
3
3
  sequence(:username) { |n| "refinery#{n}" }
4
4
  sequence(:email) { |n| "refinery#{n}@example.com" }
5
- password "refinerycms"
6
- password_confirmation "refinerycms"
5
+ password { 'refinerycms' }
6
+ password_confirmation { 'refinerycms' }
7
7
  end
8
8
 
9
9
  factory :authentication_devise_refinery_user, :parent => :authentication_devise_user do
@@ -55,7 +55,7 @@ describe "User admin page", :type => :feature do
55
55
  expect(page).to have_content("cmsrefinery (cms@example.com)")
56
56
  end
57
57
 
58
- let(:dotty_user) { FactoryGirl.create(:authentication_devise_refinery_user, :username => 'user.name.with.lots.of.dots') }
58
+ let(:dotty_user) { FactoryBot.create(:authentication_devise_refinery_user, :username => 'user.name.with.lots.of.dots') }
59
59
  it "accepts a username with a '.' in it" do
60
60
  dotty_user # create the user
61
61
  visit refinery.authentication_devise_admin_users_path
@@ -72,7 +72,7 @@ describe "User admin page", :type => :feature do
72
72
 
73
73
  describe "destroy" do
74
74
  let!(:user) {
75
- FactoryGirl.create(:authentication_devise_refinery_user, username: "ugisozols")
75
+ FactoryBot.create(:authentication_devise_refinery_user, username: "ugisozols")
76
76
  }
77
77
 
78
78
  it "can only destroy regular users" do
@@ -1,74 +1,75 @@
1
- require "spec_helper"
1
+ # frozen_string_literal: true
2
2
 
3
- describe "password recovery", :type => :feature do
4
- let!(:user) { FactoryGirl.create(:authentication_devise_refinery_user, :email => "refinery@example.com") }
3
+ require 'spec_helper'
5
4
 
6
- it "asks user to specify email address" do
5
+ describe 'password recovery', type: :feature do
6
+ let!(:user) { FactoryBot.create(:authentication_devise_refinery_user, email: 'refinery@example.com') }
7
+
8
+ it 'asks user to specify email address' do
7
9
  visit refinery.login_path
8
- click_link "I forgot my password"
9
- expect(page).to have_content("Please enter the email address for your account.")
10
+ click_link 'I forgot my password'
11
+ expect(page).to have_content('Please enter the email address for your account.')
10
12
  end
11
13
 
12
- context "when existing email specified" do
13
- it "shows success message" do
14
+ context 'when existing email specified' do
15
+ it 'shows success message' do
14
16
  visit refinery.new_authentication_devise_user_password_path
15
- fill_in "authentication_devise_user_email", :with => user.email
17
+ fill_in 'authentication_devise_user_email', with: user.email
16
18
  expect(Refinery::Authentication::Devise::UserMailer)
17
19
  .to receive(:reset_notification)
18
20
  .and_return(double(deliver_now: true, deliver_later: true))
19
- click_button "Reset password"
20
- expect(page).to have_content("An email has been sent to you with a link to reset your password.")
21
+ click_button 'Reset password'
22
+ expect(page).to have_content('An email has been sent to you with a link to reset your password.')
21
23
  end
22
24
  end
23
25
 
24
- context "when non-existing email specified" do
25
- it "shows failure message" do
26
+ context 'when non-existing email specified' do
27
+ it 'hides failure message' do
26
28
  visit refinery.new_authentication_devise_user_password_path
27
- fill_in "authentication_devise_user_email", :with => "none@example.com"
28
- click_button "Reset password"
29
- expect(page).to have_content("Sorry, 'none@example.com' isn't associated with any accounts.")
30
- expect(page).to have_content("Are you sure you typed the correct email address?")
29
+ fill_in 'authentication_devise_user_email', with: 'none@example.com'
30
+ click_button 'Reset password'
31
+ expect(page).to have_content('An email has been sent to you with a link to reset your password.')
31
32
  end
32
33
  end
33
34
 
34
- context "when good reset code" do
35
+ context 'when good reset code' do
35
36
  let!(:token) { user.generate_reset_password_token! }
36
37
 
37
- it "allows to change password" do
38
- visit refinery.edit_authentication_devise_user_password_path(:reset_password_token => token)
38
+ it 'allows to change password' do
39
+ visit refinery.edit_authentication_devise_user_password_path(reset_password_token: token)
39
40
  expect(page).to have_content("Pick a new password for #{user.email}")
40
41
 
41
- fill_in "authentication_devise_user_password", :with => "123456"
42
- fill_in "authentication_devise_user_password_confirmation", :with => "123456"
43
- click_button "Reset password"
42
+ fill_in 'authentication_devise_user_password', with: '123456'
43
+ fill_in 'authentication_devise_user_password_confirmation', with: '123456'
44
+ click_button 'Reset password'
44
45
 
45
46
  expect(page).to have_content("Password reset successfully for '#{user.email}'")
46
47
  end
47
48
  end
48
49
 
49
- context "when invalid reset code" do
50
+ context 'when invalid reset code' do
50
51
  let!(:token) { user.generate_reset_password_token! }
51
52
 
52
- it "shows error message" do
53
- visit refinery.edit_authentication_devise_user_password_path(:reset_password_token => "hmmm")
54
- expect(page).to have_content("Reset password token is invalid")
53
+ it 'shows error message' do
54
+ visit refinery.edit_authentication_devise_user_password_path(reset_password_token: 'hmmm')
55
+ expect(page).to have_content('Reset password token is invalid')
55
56
  end
56
57
  end
57
58
 
58
- context "when expired reset code" do
59
+ context 'when expired reset code' do
59
60
  let!(:token) { user.generate_reset_password_token! }
60
61
  before do
61
62
  user.update_attribute(:reset_password_sent_at, 1.day.ago)
62
63
  end
63
64
 
64
- it "shows error message" do
65
- visit refinery.edit_authentication_devise_user_password_path(:reset_password_token => token)
65
+ it 'shows error message' do
66
+ visit refinery.edit_authentication_devise_user_password_path(reset_password_token: token)
66
67
 
67
- fill_in "authentication_devise_user_password", :with => "123456"
68
- fill_in "authentication_devise_user_password_confirmation", :with => "123456"
69
- click_button "Reset password"
68
+ fill_in 'authentication_devise_user_password', with: '123456'
69
+ fill_in 'authentication_devise_user_password_confirmation', with: '123456'
70
+ click_button 'Reset password'
70
71
 
71
- expect(page).to have_content("Reset password token has expired, please request a new one")
72
+ expect(page).to have_content('Reset password token has expired, please request a new one')
72
73
  end
73
74
  end
74
75
  end
@@ -5,7 +5,7 @@ describe "sign in", :type => :feature do
5
5
  let(:login_retry_path) { refinery.authentication_devise_user_session_path }
6
6
  let(:admin_path) { "/#{Refinery::Core.backend_route}" }
7
7
  let!(:user) {
8
- FactoryGirl.create(:authentication_devise_refinery_user, :username => "ugisozols",
8
+ FactoryBot.create(:authentication_devise_refinery_user, :username => "ugisozols",
9
9
  :password => "123456",
10
10
  :password_confirmation => "123456")
11
11
  }
@@ -72,7 +72,7 @@ describe 'redirects', :type => :feature do
72
72
  let(:login_path) { refinery.login_path }
73
73
 
74
74
  before do
75
- FactoryGirl.create(:authentication_devise_refinery_user,
75
+ FactoryBot.create(:authentication_devise_refinery_user,
76
76
  :username => "ugisozols",
77
77
  :password => "123456",
78
78
  :password_confirmation => "123456"
@@ -104,7 +104,7 @@ end
104
104
 
105
105
  describe "sign out", :type => :feature do
106
106
  before do
107
- FactoryGirl.create(:authentication_devise_refinery_user,
107
+ FactoryBot.create(:authentication_devise_refinery_user,
108
108
  :username => "ugisozols",
109
109
  :password => "123456",
110
110
  :password_confirmation => "123456"
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ module Refinery
4
+ module Authentication
5
+ module Devise
6
+ describe 'path helpers' do
7
+ describe '.root' do
8
+ it 'contains the gemspec' do
9
+ root_path = Refinery::Authentication::Devise.root
10
+ gemspec_path = File.join(root_path, 'refinerycms-authentication-devise.gemspec')
11
+ expect(File.exist?(gemspec_path)).to eq true
12
+ end
13
+ end
14
+
15
+ describe '.factory_paths' do
16
+ it 'has directories that exist' do
17
+ factories_dir = Refinery::Authentication::Devise.factory_paths
18
+ expect(factories_dir.all? { |factory_path| Dir.exist?(factory_path) })
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -5,9 +5,9 @@ module Refinery
5
5
  module Devise
6
6
  describe User, :type => :model do
7
7
 
8
- let(:user) { FactoryGirl.create(:authentication_devise_user) }
8
+ let(:user) { FactoryBot.create(:authentication_devise_user) }
9
9
  let(:refinery_user) {
10
- FactoryGirl.create(:authentication_devise_refinery_user)
10
+ FactoryBot.create(:authentication_devise_refinery_user)
11
11
  }
12
12
 
13
13
  context "Roles" do
@@ -17,16 +17,16 @@ module Refinery
17
17
  end
18
18
 
19
19
  it "adds a Role to the User when role not yet assigned to User" do
20
- expect(proc {
20
+ expect {
21
21
  user.add_role(:new_role)
22
- }).to change(user.roles, :count).by(1)
22
+ }.to change(user.roles, :count).by(1)
23
23
  expect(user.roles.collect(&:title)).to include("NewRole")
24
24
  end
25
25
 
26
26
  it "does not add a Role to the User when this Role is already assigned to User" do
27
- expect(proc {
27
+ expect {
28
28
  refinery_user.add_role(:refinery)
29
- }).not_to change(refinery_user.roles, :count)
29
+ }.not_to change(refinery_user.roles, :count)
30
30
  expect(refinery_user.roles.collect(&:title)).to include("Refinery")
31
31
  end
32
32
  end
@@ -98,9 +98,9 @@ module Refinery
98
98
  end
99
99
 
100
100
  describe "#can_delete?" do
101
- let(:user_not_persisted) { FactoryGirl.build(:authentication_devise_refinery_user) }
101
+ let(:user_not_persisted) { FactoryBot.build(:authentication_devise_refinery_user) }
102
102
  let(:super_user) do
103
- FactoryGirl.create(:authentication_devise_refinery_user).tap do |user|
103
+ FactoryBot.create(:authentication_devise_refinery_user).tap do |user|
104
104
  user.add_role(:superuser)
105
105
  end
106
106
  end
@@ -137,13 +137,13 @@ module Refinery
137
137
  end
138
138
 
139
139
  describe "#can_edit?" do
140
- let(:user_not_persisted) { FactoryGirl.build(:authentication_devise_refinery_user) }
140
+ let(:user_not_persisted) { FactoryBot.build(:authentication_devise_refinery_user) }
141
141
  let(:super_user) do
142
- FactoryGirl.create(:authentication_devise_refinery_user).tap do |user|
142
+ FactoryBot.create(:authentication_devise_refinery_user).tap do |user|
143
143
  user.add_role(:superuser)
144
144
  end
145
145
  end
146
- let(:user_persisted) { FactoryGirl.create(:authentication_devise_refinery_user)}
146
+ let(:user_persisted) { FactoryBot.create(:authentication_devise_refinery_user)}
147
147
 
148
148
  context "won't allow to edit" do
149
149
  it "non-persisted user record" do
@@ -169,7 +169,7 @@ module Refinery
169
169
  describe "#plugins=" do
170
170
  context "when user is not persisted" do
171
171
  it "does not add plugins for this user" do
172
- new_user = FactoryGirl.build(:authentication_devise_user)
172
+ new_user = FactoryBot.build(:authentication_devise_user)
173
173
  new_user.plugins = ["test"]
174
174
  expect(new_user.plugins).to be_empty
175
175
  end
@@ -265,7 +265,7 @@ module Refinery
265
265
 
266
266
  describe "#create_first" do
267
267
  let(:first_user) do
268
- FactoryGirl.build(:authentication_devise_user).tap do |user|
268
+ FactoryBot.build(:authentication_devise_user).tap do |user|
269
269
  user.create_first
270
270
  end
271
271
  end
data/spec/spec_helper.rb CHANGED
@@ -16,6 +16,17 @@ RSpec.configure do |config|
16
16
  rails actionpack railties capybara activesupport rack warden rspec actionview
17
17
  activerecord dragonfly benchmark
18
18
  ).map { |noisy| /#{noisy}/ }
19
+
20
+ config.before(:suite) do
21
+ DatabaseCleaner.strategy = :transaction
22
+ DatabaseCleaner.clean_with(:truncation)
23
+ end
24
+
25
+ config.around(:each) do |example|
26
+ DatabaseCleaner.cleaning do
27
+ example.run
28
+ end
29
+ end
19
30
  end
20
31
 
21
32
  # Requires supporting files with custom matchers and macros, etc,
@@ -2,14 +2,10 @@ module Refinery
2
2
  module Authentication
3
3
  module Devise
4
4
  module ControllerMacros
5
- def self.extended(base)
6
- base.send :include, ::Devise::Test::ControllerHelpers
7
- end
8
-
9
5
  def refinery_login_with_devise(*roles)
10
6
  roles = handle_deprecated_roles!(roles).flatten
11
7
  let(:logged_in_user) do
12
- FactoryGirl.create(:authentication_devise_user).tap do |user|
8
+ FactoryBot.create(:authentication_devise_user).tap do |user|
13
9
  roles.each do |role|
14
10
  user.add_role(role)
15
11
  end
@@ -22,7 +18,7 @@ module Refinery
22
18
  end
23
19
 
24
20
  def factory_user(factory)
25
- let(:logged_in_user) { FactoryGirl.create(factory) }
21
+ let(:logged_in_user) { FactoryBot.create(factory) }
26
22
  before do
27
23
  @request.env["devise.mapping"] = ::Devise.mappings[:authentication_devise_user]
28
24
  sign_in logged_in_user
@@ -44,5 +40,6 @@ module Refinery
44
40
  end
45
41
 
46
42
  RSpec.configure do |config|
43
+ config.include ::Devise::Test::ControllerHelpers, type: :controller
47
44
  config.extend Refinery::Authentication::Devise::ControllerMacros, type: :controller
48
45
  end
@@ -4,7 +4,7 @@ module Refinery
4
4
  module FeatureMacros
5
5
 
6
6
  def refinery_login_with_devise(factory)
7
- let!(:logged_in_user) { FactoryGirl.create(factory) }
7
+ let!(:logged_in_user) { FactoryBot.create(factory) }
8
8
 
9
9
  before do
10
10
  visit refinery.login_path
metadata CHANGED
@@ -1,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms-authentication-devise
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Arndt
8
8
  - Brice Sanchez
9
9
  - Rob Yurkowski
10
- autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2017-09-14 00:00:00.000000000 Z
12
+ date: 1980-01-02 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: refinerycms-core
@@ -39,9 +38,6 @@ dependencies:
39
38
  - - ">="
40
39
  - !ruby/object:Gem::Version
41
40
  version: 5.0.0
42
- - - "<"
43
- - !ruby/object:Gem::Version
44
- version: '5.2'
45
41
  type: :runtime
46
42
  prerelease: false
47
43
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,9 +45,6 @@ dependencies:
49
45
  - - ">="
50
46
  - !ruby/object:Gem::Version
51
47
  version: 5.0.0
52
- - - "<"
53
- - !ruby/object:Gem::Version
54
- version: '5.2'
55
48
  - !ruby/object:Gem::Dependency
56
49
  name: devise
57
50
  requirement: !ruby/object:Gem::Requirement
@@ -78,22 +71,23 @@ dependencies:
78
71
  requirements:
79
72
  - - "~>"
80
73
  - !ruby/object:Gem::Version
81
- version: 5.2.1
74
+ version: '5.2'
82
75
  type: :runtime
83
76
  prerelease: false
84
77
  version_requirements: !ruby/object:Gem::Requirement
85
78
  requirements:
86
79
  - - "~>"
87
80
  - !ruby/object:Gem::Version
88
- version: 5.2.1
81
+ version: '5.2'
89
82
  description: A Devise authentication extension for Refinery CMS
90
- email:
91
83
  executables: []
92
84
  extensions: []
93
85
  extra_rdoc_files: []
94
86
  files:
87
+ - ".github/workflows/release.yml"
88
+ - ".github/workflows/ruby.yml"
95
89
  - ".gitignore"
96
- - ".travis.yml"
90
+ - CHANGELOG.md
97
91
  - Gemfile
98
92
  - Rakefile
99
93
  - app/controllers/refinery/authentication/devise/admin/users_controller.rb
@@ -185,6 +179,7 @@ files:
185
179
  - spec/features/refinery/authentication/devise/passwords_spec.rb
186
180
  - spec/features/refinery/authentication/devise/sessions_spec.rb
187
181
  - spec/lib/refinery/authentication/devise/configuration_spec.rb
182
+ - spec/lib/refinery/authentication/devise/path_helpers_spec.rb
188
183
  - spec/models/refinery/user_spec.rb
189
184
  - spec/spec_helper.rb
190
185
  - spec/support/refinery/authentication/devise/controller_macros.rb
@@ -194,7 +189,6 @@ homepage: http://refinerycms.com
194
189
  licenses:
195
190
  - MIT
196
191
  metadata: {}
197
- post_install_message:
198
192
  rdoc_options: []
199
193
  require_paths:
200
194
  - lib
@@ -209,9 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
203
  - !ruby/object:Gem::Version
210
204
  version: '0'
211
205
  requirements: []
212
- rubyforge_project:
213
- rubygems_version: 2.6.13
214
- signing_key:
206
+ rubygems_version: 4.0.20
215
207
  specification_version: 4
216
208
  summary: Devise based authentication extension for Refinery CMS
217
209
  test_files:
@@ -221,6 +213,7 @@ test_files:
221
213
  - spec/features/refinery/authentication/devise/passwords_spec.rb
222
214
  - spec/features/refinery/authentication/devise/sessions_spec.rb
223
215
  - spec/lib/refinery/authentication/devise/configuration_spec.rb
216
+ - spec/lib/refinery/authentication/devise/path_helpers_spec.rb
224
217
  - spec/models/refinery/user_spec.rb
225
218
  - spec/spec_helper.rb
226
219
  - spec/support/refinery/authentication/devise/controller_macros.rb
data/.travis.yml DELETED
@@ -1,15 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- bundler_args: --without development
4
- before_script: "bin/rake refinery:testing:dummy_app"
5
- env:
6
- - DB=postgresql
7
- - DB=mysql
8
- notifications:
9
- webhooks:
10
- - https://webhooks.gitter.im/e/b5d48907cdc89864b874
11
- rvm:
12
- - 2.4.1
13
- - 2.3.3
14
- - 2.2.6
15
- sudo: false