orthodox 0.3.2 → 0.3.6

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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -1
  3. data/.ruby-version +1 -0
  4. data/.yardopts +7 -0
  5. data/README.md +3 -3
  6. data/dummy/.ruby-version +1 -1
  7. data/dummy/Gemfile +2 -2
  8. data/dummy/Gemfile.lock +111 -113
  9. data/lib/generators/authentication/authentication_generator.rb +86 -86
  10. data/lib/generators/authentication/templates/controllers/concerns/authentication.rb.erb +25 -25
  11. data/lib/generators/authentication/templates/controllers/password_resets_controller.rb.erb +1 -1
  12. data/lib/generators/authentication/templates/controllers/sessions_controller.rb.erb +5 -5
  13. data/lib/generators/authentication/templates/controllers/tfa_sessions_controller.rb.erb +3 -3
  14. data/lib/generators/authentication/templates/controllers/tfas_controller.rb.erb +3 -3
  15. data/lib/generators/authentication/templates/helpers/otp_credentials_helper.rb +3 -3
  16. data/lib/generators/authentication/templates/javascript/tfa_forms.js +3 -5
  17. data/lib/generators/authentication/templates/models/concerns/authenticateable.rb +3 -3
  18. data/lib/generators/authentication/templates/models/concerns/otpable.rb +3 -3
  19. data/lib/generators/authentication/templates/models/concerns/password_resetable.rb +3 -3
  20. data/lib/generators/authentication/templates/models/otp_credential.rb.erb +3 -3
  21. data/lib/generators/authentication/templates/models/password_reset_token.rb +3 -3
  22. data/lib/generators/authentication/templates/models/session.rb.erb +3 -3
  23. data/lib/generators/authentication/templates/models/tfa_session.rb +2 -2
  24. data/lib/generators/authentication/templates/spec/models/otp_credential_spec.rb +2 -2
  25. data/lib/generators/authentication/templates/spec/models/password_reset_token_spec.rb +2 -2
  26. data/lib/generators/authentication/templates/spec/models/session_spec.rb.erb +10 -11
  27. data/lib/generators/authentication/templates/spec/models/tfa_session_spec.rb.erb +35 -36
  28. data/lib/generators/authentication/templates/spec/support/authentication_helpers.rb +3 -3
  29. data/lib/generators/authentication/templates/spec/system/authentication_spec.rb.erb +2 -2
  30. data/lib/generators/authentication/templates/spec/system/password_resets_spec.rb.erb +2 -2
  31. data/lib/generators/authentication/templates/spec/system/tfa_authentication_spec.rb.erb +2 -2
  32. data/lib/generators/base_controller/base_controller_generator.rb +1 -1
  33. data/lib/generators/base_controller/templates/base_controller.rb.erb +1 -1
  34. data/lib/generators/controller/templates/controller.rb.erb +1 -1
  35. data/lib/generators/layout_helper/layout_helper_generator.rb +1 -1
  36. data/lib/orthodox/version.rb +1 -1
  37. data/orthodox.gemspec +5 -7
  38. metadata +16 -42
@@ -1,25 +1,24 @@
1
1
  require "rails_helper"
2
2
 
3
- # Automatically generated by the orthodox gem (https://github.com/katanacode/orthodox)
4
- # (c) Copyright 2019 Katana Code Ltd. All Rights Reserved.
3
+ # Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
5
4
  RSpec.describe <%= class_name %>Session, type: :model do
6
5
 
7
6
  context "when credentials valid" do
8
-
7
+
9
8
  let(:<%= singular_name %>) { create(:<%= singular_name %>) }
10
9
 
11
10
  before do
12
11
  subject.email = <%= singular_name %>.email
13
12
  subject.password = <%= singular_name %>.password
14
13
  end
15
-
14
+
16
15
  it { is_expected.to be_valid }
17
-
16
+
18
17
  it "sets the <%= singular_name %> attribute to the matching record" do
19
18
  subject.valid?
20
19
  expect(subject.<%= singular_name %>).to eql(<%= singular_name %>)
21
20
  end
22
-
21
+
23
22
  end
24
23
 
25
24
  context "when credentials are invalid" do
@@ -28,18 +27,18 @@ RSpec.describe <%= class_name %>Session, type: :model do
28
27
  subject.email = Faker::Internet.safe_email
29
28
  subject.password = "wrong-password"
30
29
  end
31
-
30
+
32
31
  it { is_expected.not_to be_valid }
33
-
32
+
34
33
  it "sets the <%= singular_name %> attribute to nil" do
35
34
  expect(subject.<%= singular_name %>).to be_nil
36
35
  end
37
-
36
+
38
37
  it "has errors on base" do
39
38
  subject.valid?
40
39
  expect(subject.errors[:base]).to be_present
41
40
  end
42
-
41
+
43
42
  end
44
-
43
+
45
44
  end
@@ -1,115 +1,114 @@
1
1
  require "rails_helper"
2
2
 
3
- # Automatically generated by the orthodox gem (https://github.com/katanacode/orthodox)
4
- # (c) Copyright 2019 Katana Code Ltd. All Rights Reserved.
3
+ # Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
5
4
  RSpec.describe TfaSession, type: :model do
6
-
5
+
7
6
  let!(:<%= singular_name %>) { create(:<%= singular_name %>) }
8
-
7
+
9
8
  before do
10
9
  <%= singular_name %>.create_otp_credential!
11
10
  end
12
-
11
+
13
12
  describe "#valid?" do
14
-
13
+
15
14
  subject { TfaSession.new(record: <%= singular_name %>) }
16
-
15
+
17
16
  context "when otp correct" do
18
-
17
+
19
18
  before do
20
19
  subject.otp = <%= singular_name %>.otp_credential.send(:current_otp)
21
20
  end
22
-
21
+
23
22
  it { is_expected.to be_valid }
24
-
23
+
25
24
  end
26
25
 
27
26
  context "when otp incorrect" do
28
-
27
+
29
28
  before do
30
29
  subject.otp = "12345"
31
30
  end
32
-
31
+
33
32
  it { is_expected.to be_invalid }
34
-
33
+
35
34
  end
36
-
35
+
37
36
  context "when recovery code correct" do
38
-
37
+
39
38
  before do
40
39
  subject.recovery_code = <%= singular_name %>.otp_credential.recovery_codes.sample
41
40
  end
42
-
41
+
43
42
  it { is_expected.to be_valid }
44
-
43
+
45
44
  end
46
45
 
47
46
  context "when recovery code incorrect" do
48
-
47
+
49
48
  before do
50
49
  subject.recovery_code = "abcd-efgh"
51
50
  end
52
-
51
+
53
52
  it { is_expected.to be_invalid }
54
-
53
+
55
54
  end
56
55
  end
57
-
58
-
56
+
57
+
59
58
  describe "#otp?" do
60
-
59
+
61
60
  context "when present" do
62
61
 
63
62
  before do
64
63
  subject.otp = "12345"
65
64
  end
66
-
65
+
67
66
  it "is expected to be truthy" do
68
67
  expect(subject.otp?).to be_truthy
69
68
  end
70
-
69
+
71
70
  end
72
71
 
73
72
  context "when blank" do
74
-
73
+
75
74
  before do
76
75
  subject.otp = nil
77
76
  end
78
-
77
+
79
78
  it "is expected to be falsey" do
80
79
  expect(subject.otp?).to be_falsey
81
80
  end
82
81
 
83
82
  end
84
-
83
+
85
84
  end
86
-
85
+
87
86
  describe "#recovery_code?" do
88
-
87
+
89
88
  context "when present" do
90
89
 
91
90
  before do
92
91
  subject.recovery_code = "abcd-defg"
93
92
  end
94
-
93
+
95
94
  it "is expected to be truthy" do
96
95
  expect(subject.recovery_code?).to be_truthy
97
96
  end
98
-
97
+
99
98
  end
100
99
 
101
100
  context "when blank" do
102
-
101
+
103
102
  before do
104
103
  subject.recovery_code = nil
105
104
  end
106
-
105
+
107
106
  it "is expected to be falsey" do
108
107
  expect(subject.recovery_code?).to be_falsey
109
108
  end
110
109
 
111
110
  end
112
-
111
+
113
112
  end
114
-
113
+
115
114
  end
@@ -1,8 +1,8 @@
1
- # frozen_string_literal
1
+ # frozen_string_literal: true
2
2
  #
3
3
  # Helpers for automating sign-in and out during tests
4
- # Automatically generated by the orthodox gem (https://github.com/katanacode/orthodox)
5
- # (c) Copyright 2019 Katana Code Ltd. All Rights Reserved.
4
+ # Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
5
+
6
6
  #
7
7
  module AuthenticationHelpers
8
8
  def sign_in(record, **options)
@@ -1,7 +1,7 @@
1
1
  require "rails_helper"
2
2
 
3
- # Automatically generated by the orthodox gem (https://github.com/katanacode/orthodox)
4
- # (c) Copyright 2019 Katana Code Ltd. All Rights Reserved.
3
+ # Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
4
+
5
5
  RSpec.describe "<%= plural_class_name %>::Authentication", type: :system do
6
6
 
7
7
  let!(:<%= singular_name %>) { create(:<%= singular_name %>) }
@@ -1,7 +1,7 @@
1
1
  require "rails_helper"
2
2
 
3
- # Automatically generated by the orthodox gem (https://github.com/katanacode/orthodox)
4
- # (c) Copyright 2019 Katana Code Ltd. All Rights Reserved.
3
+ # Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
4
+
5
5
  RSpec.describe "<%= plural_class_name %>::PasswordResets", type: :system do
6
6
 
7
7
  include ActiveSupport::Testing::TimeHelpers
@@ -1,7 +1,7 @@
1
1
  require "rails_helper"
2
2
 
3
- # Automatically generated by the orthodox gem (https://github.com/katanacode/orthodox)
4
- # (c) Copyright 2019 Katana Code Ltd. All Rights Reserved.
3
+ # Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
4
+
5
5
  RSpec.describe "<%= plural_class_name %>::TfaAuthentication", type: :system do
6
6
 
7
7
  let!(:<%= singular_name %>) { create(:<%= singular_name %>) }
@@ -1,4 +1,4 @@
1
- # frozen_string_literal
1
+ # frozen_string_literal: true
2
2
 
3
3
  class BaseControllerGenerator < Rails::Generators::NamedBase
4
4
  source_root File.expand_path('templates', __dir__)
@@ -1,4 +1,4 @@
1
- # frozen_string_literal
1
+ # frozen_string_literal: true
2
2
  class <%= namespace_module %>::BaseController < ApplicationController
3
3
 
4
4
  # layout "<%= file_name %>"
@@ -1,4 +1,4 @@
1
- # frozen_string_literal
1
+ # frozen_string_literal: true
2
2
  class <%= class_name %>Controller < <%= parent_class_name %>
3
3
 
4
4
  <%- if authenticate_actor? -%>
@@ -1,4 +1,4 @@
1
- # frozen_string_literal
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'rails/generators'
4
4
 
@@ -1,3 +1,3 @@
1
1
  module Orthodox
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.6"
3
3
  end
data/orthodox.gemspec CHANGED
@@ -7,11 +7,11 @@ Gem::Specification.new do |spec|
7
7
  spec.name = "orthodox"
8
8
  spec.version = Orthodox::VERSION
9
9
  spec.authors = ["Bodacious", 'CodeMeister']
10
- spec.email = ["team@katanacode.com"]
10
+ spec.email = ["gavin@gavinmorrice.com"]
11
11
 
12
- spec.summary = %q{Better Rails generators for Katana}
13
- spec.description = %q{Replaces Rails generators with generators specific to Katana's workflow'}
14
- spec.homepage = "https://github.com/KatanaCode/orthodox"
12
+ spec.summary = %q{Better Rails generators}
13
+ spec.description = %q{Replaces Rails generators with generators specific to my preferred workflow'}
14
+ spec.homepage = "https://github.com/Bodacious/orthodox"
15
15
  spec.license = "MIT"
16
16
  spec.metadata["allowed_push_host"] = "https://rubygems.org"
17
17
 
@@ -21,9 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.bindir = "exe"
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ["lib", 'lib/generators']
24
- spec.add_runtime_dependency 'rails', '>= 3.0.0'
25
24
  spec.add_runtime_dependency 'slim-rails'
26
- spec.add_development_dependency "bundler", "~> 1.15"
27
- spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "rake"
28
26
  spec.add_development_dependency "rails", ">= 5.0"
29
27
  end
metadata CHANGED
@@ -1,30 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orthodox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bodacious
8
8
  - CodeMeister
9
- autorequire:
9
+ autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-12-18 00:00:00.000000000 Z
12
+ date: 2021-10-04 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: rails
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: 3.0.0
21
- type: :runtime
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- version: 3.0.0
28
14
  - !ruby/object:Gem::Dependency
29
15
  name: slim-rails
30
16
  requirement: !ruby/object:Gem::Requirement
@@ -39,34 +25,20 @@ dependencies:
39
25
  - - ">="
40
26
  - !ruby/object:Gem::Version
41
27
  version: '0'
42
- - !ruby/object:Gem::Dependency
43
- name: bundler
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - "~>"
47
- - !ruby/object:Gem::Version
48
- version: '1.15'
49
- type: :development
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - "~>"
54
- - !ruby/object:Gem::Version
55
- version: '1.15'
56
28
  - !ruby/object:Gem::Dependency
57
29
  name: rake
58
30
  requirement: !ruby/object:Gem::Requirement
59
31
  requirements:
60
- - - "~>"
32
+ - - ">="
61
33
  - !ruby/object:Gem::Version
62
- version: '10.0'
34
+ version: '0'
63
35
  type: :development
64
36
  prerelease: false
65
37
  version_requirements: !ruby/object:Gem::Requirement
66
38
  requirements:
67
- - - "~>"
39
+ - - ">="
68
40
  - !ruby/object:Gem::Version
69
- version: '10.0'
41
+ version: '0'
70
42
  - !ruby/object:Gem::Dependency
71
43
  name: rails
72
44
  requirement: !ruby/object:Gem::Requirement
@@ -81,14 +53,16 @@ dependencies:
81
53
  - - ">="
82
54
  - !ruby/object:Gem::Version
83
55
  version: '5.0'
84
- description: Replaces Rails generators with generators specific to Katana's workflow'
56
+ description: Replaces Rails generators with generators specific to my preferred workflow'
85
57
  email:
86
- - team@katanacode.com
58
+ - gavin@gavinmorrice.com
87
59
  executables: []
88
60
  extensions: []
89
61
  extra_rdoc_files: []
90
62
  files:
91
63
  - ".gitignore"
64
+ - ".ruby-version"
65
+ - ".yardopts"
92
66
  - Gemfile
93
67
  - LICENSE.txt
94
68
  - README.md
@@ -214,12 +188,12 @@ files:
214
188
  - lib/orthodox/railtie.rb
215
189
  - lib/orthodox/version.rb
216
190
  - orthodox.gemspec
217
- homepage: https://github.com/KatanaCode/orthodox
191
+ homepage: https://github.com/Bodacious/orthodox
218
192
  licenses:
219
193
  - MIT
220
194
  metadata:
221
195
  allowed_push_host: https://rubygems.org
222
- post_install_message:
196
+ post_install_message:
223
197
  rdoc_options: []
224
198
  require_paths:
225
199
  - lib
@@ -235,8 +209,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
235
209
  - !ruby/object:Gem::Version
236
210
  version: '0'
237
211
  requirements: []
238
- rubygems_version: 3.0.3
239
- signing_key:
212
+ rubygems_version: 3.2.22
213
+ signing_key:
240
214
  specification_version: 4
241
- summary: Better Rails generators for Katana
215
+ summary: Better Rails generators
242
216
  test_files: []