renalware-core 2.0.132 → 2.0.133
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/renalware/core.js.erb +1 -1
- data/app/assets/stylesheets/renalware/core.scss +1 -1
- data/app/assets/stylesheets/renalware/modules/_clinics.scss +1 -2
- data/app/assets/stylesheets/renalware/modules/_patients.scss +1 -1
- data/app/assets/stylesheets/renalware/partials/_dashboards.scss +15 -0
- data/app/components/renalware/application_component.rb +22 -0
- data/app/components/renalware/events/biopsies_component.html.slim +14 -0
- data/app/components/renalware/events/biopsies_component.rb +20 -0
- data/app/components/renalware/letters/letters_in_progress_component.html.slim +8 -0
- data/app/components/renalware/letters/letters_in_progress_component.rb +32 -0
- data/app/components/renalware/letters/unread_electronic_ccs_component.html.slim +7 -0
- data/app/components/renalware/letters/unread_electronic_ccs_component.rb +24 -0
- data/app/components/renalware/messaging/unread_messages_component.html.slim +11 -0
- data/app/components/renalware/messaging/unread_messages_component.rb +24 -0
- data/app/components/renalware/patients/bookmarks_component.html.slim +11 -0
- data/app/components/renalware/patients/bookmarks_component.rb +22 -0
- data/app/controllers/renalware/clinical/body_compositions_controller.rb +1 -1
- data/app/controllers/renalware/pathology/code_groups_controller.rb +44 -0
- data/app/controllers/renalware/transplants/wait_lists_controller.rb +17 -8
- data/app/models/renalware/clinical/body_composition.rb +7 -0
- data/app/models/renalware/hd/mdm_patients_query.rb +10 -1
- data/app/models/renalware/pathology/code_group.rb +10 -3
- data/app/models/renalware/pathology/code_group_membership.rb +2 -0
- data/app/models/renalware/pathology/current_observation_set.rb +16 -3
- data/app/models/renalware/pathology/observations_jsonb_serializer.rb +1 -1
- data/app/models/renalware/pathology/version.rb +11 -0
- data/app/models/renalware/system/component.rb +25 -0
- data/app/models/renalware/system/dashboard.rb +20 -0
- data/app/models/renalware/system/dashboard_component.rb +17 -0
- data/app/models/renalware/transplants.rb +8 -1
- data/app/models/renalware/transplants/registrations/wait_list_form.rb +16 -0
- data/app/models/renalware/transplants/registrations/wait_list_query.rb +17 -3
- data/app/models/renalware/ukrdc/incoming/file_list.rb +1 -1
- data/app/models/renalware/ukrdc/incoming/import_surveys.rb +16 -0
- data/app/models/renalware/ukrdc/outgoing/rendering/base.rb +22 -0
- data/app/models/renalware/ukrdc/outgoing/rendering/dialysis_session.rb +2 -2
- data/app/models/renalware/ukrdc/outgoing/rendering/hd_session_observations.rb +1 -1
- data/app/models/renalware/user.rb +9 -0
- data/app/policies/renalware/hd/closed_session_policy.rb +1 -1
- data/app/policies/renalware/pathology/code_group_policy.rb +23 -0
- data/app/presenters/renalware/hd/protocol_presenter.rb +8 -2
- data/app/views/renalware/clinical/body_compositions/_form.html.slim +6 -0
- data/app/views/renalware/clinical/body_compositions/_table.html.slim +4 -0
- data/app/views/renalware/dashboard/bookmarks/_bookmark.html.slim +5 -5
- data/app/views/renalware/dashboard/bookmarks/_table.html.slim +5 -5
- data/app/views/renalware/dashboard/dashboards/_content.html.slim +4 -41
- data/app/views/renalware/dashboard/letters/_letter.html.slim +2 -2
- data/app/views/renalware/hd/mdm_patients/_patient.html.slim +5 -1
- data/app/views/renalware/hd/mdm_patients/_table.html.slim +2 -1
- data/app/views/renalware/hd/protocols/_recent_pathology.html.slim +5 -12
- data/app/views/renalware/mdm/{_biopsies.html.slim → _biopsies.html.slim.dead} +0 -0
- data/app/views/renalware/mdm_patients/_patient.html.slim +5 -1
- data/app/views/renalware/mdm_patients/_table.html.slim +1 -1
- data/app/views/renalware/medications/prescriptions/_tables.html.slim +27 -23
- data/app/views/renalware/messaging/internal/receipts/_receipt.html.slim +1 -1
- data/app/views/renalware/modalities/modalities/index.html.slim +17 -16
- data/app/views/renalware/navigation/_super_admin.html.slim +1 -0
- data/app/views/renalware/pathology/code_groups/edit.html.slim +8 -0
- data/app/views/renalware/pathology/code_groups/index.html.slim +16 -0
- data/app/views/renalware/pathology/code_groups/show.html.slim +34 -0
- data/app/views/renalware/problems/problems/index.html.slim +9 -5
- data/app/views/renalware/surveys/_eq5d_summary_part.html.slim +17 -17
- data/app/views/renalware/surveys/_pos_s_summary_part.html.slim +61 -60
- data/app/views/renalware/transplants/mdm/_bottom.html.slim +1 -1
- data/app/views/renalware/transplants/mdm_patients/_patient.html.slim +5 -1
- data/app/views/renalware/transplants/mdm_patients/_table.html.slim +1 -1
- data/app/views/renalware/transplants/wait_lists/_registration.html.slim +1 -0
- data/app/views/renalware/transplants/wait_lists/show.html.slim +24 -1
- data/config/locales/renalware/clinical/body_composition.yml +4 -0
- data/config/routes/pathology.rb +1 -0
- data/db/migrate/20200114151225_add_clinical_body_composition_cols.rb +11 -0
- data/db/migrate/20200127165951_create_pathology_versions.rb +16 -0
- data/db/migrate/20200127170711_add_created_by_to_pathology_code_groups.rb +15 -0
- data/db/migrate/20200129093835_create_system_dashboards.rb +73 -0
- data/db/seeds/default/pathology/code_groups.rb +15 -0
- data/db/seeds/default/pathology/seeds.rb +2 -1
- data/lib/core_extensions/active_record/migration_helpers.rb +3 -2
- data/lib/renalware/engine.rb +1 -1
- data/lib/renalware/version.rb +1 -1
- data/lib/tasks/spec.rake +23 -21
- data/spec/factories/clinical/body_compositions.rb +3 -1
- data/spec/factories/pathology/code_group_memberships.rb +7 -0
- data/spec/factories/pathology/code_groups.rb +13 -0
- data/spec/factories/transplants/registration_status_descriptions.rb +5 -0
- data/spec/support/devise_spec_helper.rb +24 -8
- data/spec/support/ukrdc_helpers.rb +2 -1
- metadata +53 -24
@@ -1,5 +1,10 @@
|
|
1
1
|
- observation_set = patient.current_observation_set
|
2
2
|
tr
|
3
|
+
td.actions
|
4
|
+
= link_to view_proc.call(patient), target: "_blank" do
|
5
|
+
i.fa.fa-external-link-square-alt
|
6
|
+
|
|
7
|
+
= t(".view")
|
3
8
|
td.full-name= link_to patient.to_s(:default), view_proc.call(patient)
|
4
9
|
td.nowrap= patient.nhs_number
|
5
10
|
td.nowrap= patient.hospital_identifier
|
@@ -15,4 +20,3 @@ tr
|
|
15
20
|
td= l(observation_set.cre_observed_at)
|
16
21
|
td= observation_set.egfr_result
|
17
22
|
td= l(patient.esrf_date)
|
18
|
-
td.actions= link_to t(".view"), view_proc.call(patient)
|
@@ -2,6 +2,7 @@
|
|
2
2
|
table#patients.mdm-patients.columns
|
3
3
|
thead
|
4
4
|
tr
|
5
|
+
th.col-width-tiny
|
5
6
|
th.col-width-large= sort_link(path, :family_name, t(".name"))
|
6
7
|
th.col-width-nhs-no= sort_link(path, :nhs_number, t(".nhs_no"))
|
7
8
|
th.col-width-reference-no= t(".hosp_no")
|
@@ -14,7 +15,6 @@ table#patients.mdm-patients.columns
|
|
14
15
|
th.col-width-date= sort_link(path, :"#{code}_date", t(".#{code}_date"))
|
15
16
|
th.col-width-tiny= sort_link(path, :egfr, t(".egfr"))
|
16
17
|
th.col-width-date= t(".esrf")
|
17
|
-
th.col-width-small
|
18
18
|
|
19
19
|
tbody
|
20
20
|
= render partial: "patient",
|
@@ -12,6 +12,7 @@ tr
|
|
12
12
|
td= registration.hd_hospital_unit_code
|
13
13
|
td= registration.current_status
|
14
14
|
td= registration.uk_transplant_centre_status
|
15
|
+
td= registration.document&.codes&.uk_transplant_patient_recipient_number
|
15
16
|
td= l(registration.esrf_date)
|
16
17
|
td= l(registration.entered_on)
|
17
18
|
td= registration.dol
|
@@ -1,6 +1,28 @@
|
|
1
|
+
= content_for(:filters) do
|
2
|
+
- options = path_params.to_h.symbolize_keys
|
3
|
+
= simple_form_for form,
|
4
|
+
as: :form,
|
5
|
+
url: Renalware::Engine.routes.url_for(options.merge!(only_path: true)),
|
6
|
+
method: :get do |f|
|
7
|
+
|
8
|
+
.row.collapse
|
9
|
+
.columns.small-6
|
10
|
+
.row.collapse
|
11
|
+
.small-10.columns
|
12
|
+
= f.input :ukt_recipient_number,
|
13
|
+
class: "radius",
|
14
|
+
wrapper: :hz_large,
|
15
|
+
label: "UKT recipient number"
|
16
|
+
.small-2.columns
|
17
|
+
= button_tag(type: "submit",
|
18
|
+
class: "search-registrations button tiny postfix radius radius-right secondary",
|
19
|
+
style: "width: 3rem") do
|
20
|
+
i.fas.fa-search
|
21
|
+
|
1
22
|
= content_for(:tabs) do
|
2
23
|
ruby:
|
3
24
|
filters = {
|
25
|
+
all: "All",
|
4
26
|
active: "Active",
|
5
27
|
suspended: "Suspended",
|
6
28
|
active_and_suspended: "Active & Suspended",
|
@@ -17,7 +39,7 @@
|
|
17
39
|
= sub_nav_item(label, path)
|
18
40
|
|
19
41
|
= within_admin_layout(title: "Transplant Wait List Registrations") do
|
20
|
-
table.report
|
42
|
+
table.report.wait-list-registrations-table
|
21
43
|
thead
|
22
44
|
tr
|
23
45
|
th.noprint
|
@@ -29,6 +51,7 @@
|
|
29
51
|
th= sort_link([:renalware, q], :hd_site, "HD Site")
|
30
52
|
th= sort_link([:renalware, q], :patient_current_status_description_name, "Status")
|
31
53
|
th= sort_link([:renalware, q], :ukt_status, "UKT Status")
|
54
|
+
th.col-width-tiny UKT No
|
32
55
|
th.col-width-date= sort_link([:renalware, q], :esrf_on, "ESRF Date")
|
33
56
|
th.col-width-date= sort_link([:renalware, q], :entered_on, "Entry Date")
|
34
57
|
th DOL
|
@@ -16,6 +16,8 @@ en:
|
|
16
16
|
body_cell_mass: Body Cell Mass (BCM)
|
17
17
|
quality_of_reading: Quality of Reading (Q)
|
18
18
|
notes: Notes
|
19
|
+
weight: Weight
|
20
|
+
pre_post_hd: Pre or Post HD
|
19
21
|
renalware:
|
20
22
|
clinical:
|
21
23
|
body_compositions:
|
@@ -46,3 +48,5 @@ en:
|
|
46
48
|
body_cell_mass: BCM
|
47
49
|
quality_of_reading: Q
|
48
50
|
assessor: Assessor
|
51
|
+
weight: Weight
|
52
|
+
pre_post_hd: PrePost
|
data/config/routes/pathology.rb
CHANGED
@@ -21,6 +21,7 @@ resources :patients, only: [] do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
namespace :pathology do
|
24
|
+
resources :code_groups
|
24
25
|
namespace :requests do
|
25
26
|
# NOTE: This needs to be POST since the params may exceed url char limit in GET
|
26
27
|
post "requests/new", to: "requests#new", as: "new_request"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class AddClinicalBodyCompositionCols < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
within_renalware_schema do
|
4
|
+
create_enum :clinical_body_composition_pre_post_hd, %w(pre post)
|
5
|
+
change_table :clinical_body_compositions do |t|
|
6
|
+
t.enum :pre_post_hd, enum_name: :clinical_body_composition_pre_post_hd
|
7
|
+
t.float :weight
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreatePathologyVersions < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
within_renalware_schema do
|
4
|
+
create_table :pathology_versions do |t|
|
5
|
+
t.string :item_type, null: false
|
6
|
+
t.integer :item_id, null: false
|
7
|
+
t.string :event, null: false
|
8
|
+
t.string :whodunnit
|
9
|
+
t.jsonb :object
|
10
|
+
t.jsonb :object_changes
|
11
|
+
t.datetime :created_at
|
12
|
+
end
|
13
|
+
add_index :pathology_versions, [:item_type, :item_id]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class AddCreatedByToPathologyCodeGroups < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
within_renalware_schema do
|
4
|
+
change_table :pathology_code_groups do |t|
|
5
|
+
t.references :created_by, foreign_key: { to_table: :users }, index: true, null: false
|
6
|
+
t.references :updated_by, foreign_key: { to_table: :users }, index: true, null: false
|
7
|
+
end
|
8
|
+
|
9
|
+
change_table :pathology_code_group_memberships do |t|
|
10
|
+
t.references :created_by, foreign_key: { to_table: :users }, index: true, null: false
|
11
|
+
t.references :updated_by, foreign_key: { to_table: :users }, index: true, null: false
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
class CreateSystemDashboards < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
within_renalware_schema do
|
4
|
+
create_table :system_dashboards do |t|
|
5
|
+
t.string(
|
6
|
+
:name,
|
7
|
+
index: { unique: true },
|
8
|
+
comment: "A named dashboard e.g. default, hd_nurse"
|
9
|
+
)
|
10
|
+
t.text :description
|
11
|
+
t.references(
|
12
|
+
:user,
|
13
|
+
index: false,
|
14
|
+
null: true,
|
15
|
+
comment: "If present, this dashboard belongs to a user e.g. they have customised a "\
|
16
|
+
"named dashboard to make it their own"
|
17
|
+
)
|
18
|
+
t.references(
|
19
|
+
:cloned_from_dashboard,
|
20
|
+
null: true,
|
21
|
+
foreign_key: { to_table: :system_dashboards },
|
22
|
+
comment: "Is the user customised their dashboard we store the original here"
|
23
|
+
)
|
24
|
+
t.timestamps null: false
|
25
|
+
end
|
26
|
+
add_index :system_dashboards, :user_id, unique: true
|
27
|
+
|
28
|
+
create_table(
|
29
|
+
:system_components,
|
30
|
+
comment: "Available ruby display widgets for use e.g. in dashboards") do |t|
|
31
|
+
t.string :class_name, null: false, index: true, comment: "Component class eg Renalware::.."
|
32
|
+
t.string(
|
33
|
+
:name,
|
34
|
+
null: false,
|
35
|
+
index: { unique: true },
|
36
|
+
comment: "Friendly component name e.g. 'Letters in Progress'"
|
37
|
+
)
|
38
|
+
t.boolean :dashboard, default: true, null: false, comment: "If true, can use on dashboards"
|
39
|
+
t.string :roles, index: true, comment: "Who can use or be assigned this component"
|
40
|
+
t.timestamps null: true
|
41
|
+
end
|
42
|
+
|
43
|
+
create_table :system_dashboard_components, comment: "Defines dashboard content" do |t|
|
44
|
+
t.references(
|
45
|
+
:dashboard,
|
46
|
+
foreign_key: { to_table: :system_dashboards }
|
47
|
+
)
|
48
|
+
t.references(
|
49
|
+
:component,
|
50
|
+
foreign_key: { to_table: :system_components }
|
51
|
+
)
|
52
|
+
t.integer :position, null: false, default: 1
|
53
|
+
t.timestamps null: false
|
54
|
+
end
|
55
|
+
|
56
|
+
add_index(
|
57
|
+
:system_dashboard_components,
|
58
|
+
[:dashboard_id, :component_id],
|
59
|
+
unique: true,
|
60
|
+
name: "idx_dashboard_component_useage_unique",
|
61
|
+
comment: "Allow only one instance of a component on any dashboard"
|
62
|
+
)
|
63
|
+
|
64
|
+
add_index(
|
65
|
+
:system_dashboard_components,
|
66
|
+
[:dashboard_id, :position],
|
67
|
+
unique: true,
|
68
|
+
name: "idx_dashboard_component_position",
|
69
|
+
comment: "Position must be unique within a dashboard"
|
70
|
+
)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Renalware
|
4
|
+
log "Adding Pathology Code Groups" do
|
5
|
+
user = User.first
|
6
|
+
Pathology::CodeGroup.find_or_create_by!(name: "hd_session_form_recent") do |group|
|
7
|
+
group.description = "Recent pathology shown on the HD Sessions printable form"
|
8
|
+
group.created_by = user
|
9
|
+
group.updated_by = user
|
10
|
+
|
11
|
+
# We could add observation_descriptions to the group here but none are seeded in the
|
12
|
+
# default seeds.
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -3,6 +3,7 @@
|
|
3
3
|
module CoreExtensions
|
4
4
|
module ActiveRecord
|
5
5
|
module MigrationHelpers
|
6
|
+
require "activerecord/postgres_enum"
|
6
7
|
# Used in migrations to ensure the objects created/updated/found are in the correct schema.
|
7
8
|
# We ensure that the original schema_search_path defined in the database.yml in the host app
|
8
9
|
# is restored - this particularyl important for migations in an engine.
|
@@ -89,14 +90,14 @@ module CoreExtensions
|
|
89
90
|
class << self
|
90
91
|
def triggers
|
91
92
|
[
|
92
|
-
Rails.root.join("db
|
93
|
+
Rails.root.join("db/triggers"),
|
93
94
|
Renalware::Engine.root.join("db", "triggers")
|
94
95
|
]
|
95
96
|
end
|
96
97
|
|
97
98
|
def functions
|
98
99
|
[
|
99
|
-
Rails.root.join("db
|
100
|
+
Rails.root.join("db/functions"),
|
100
101
|
Renalware::Engine.root.join("db", "functions")
|
101
102
|
]
|
102
103
|
end
|
data/lib/renalware/engine.rb
CHANGED
@@ -57,7 +57,6 @@ require "virtus"
|
|
57
57
|
require "wicked_pdf"
|
58
58
|
require "wisper"
|
59
59
|
require "wisper/activejob"
|
60
|
-
require "rails-assets-foundation-datepicker"
|
61
60
|
require "byebug" if ENV["RAILS_ENV"] == "development"
|
62
61
|
|
63
62
|
module Renalware
|
@@ -79,6 +78,7 @@ module Renalware
|
|
79
78
|
end
|
80
79
|
end
|
81
80
|
|
81
|
+
config.action_view_component.test_controller = "Renalware::BaseController"
|
82
82
|
config.autoload_paths += Dir["#{config.root}/lib/**/"]
|
83
83
|
config.autoload_paths += %W(#{config.root}/app/validators/concerns)
|
84
84
|
|
data/lib/renalware/version.rb
CHANGED
data/lib/tasks/spec.rake
CHANGED
@@ -5,29 +5,31 @@
|
|
5
5
|
#
|
6
6
|
namespace :spec do
|
7
7
|
namespace :acceptance do
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
if defined?(RSpec)
|
9
|
+
ENV["RACK_ENV"] = ENV["RAILS_ENV"] = "test"
|
10
|
+
require "rspec/core/rake_task"
|
11
|
+
pattern = "./spec/acceptance/renalware/features/**/*.feature"
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
# domain features are those that do not exercise the UI
|
14
|
+
# Usage:
|
15
|
+
# bundle exec rake spec:acceptance:domain
|
16
|
+
RSpec::Core::RakeTask.new(:domain) do |t|
|
17
|
+
t.pattern = pattern
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
# web features exerciswe the UI and may use a webdriver is tagged with @javascript
|
21
|
+
# Usage:
|
22
|
+
# bundle exec rake spec:acceptance:web
|
23
|
+
RSpec::Core::RakeTask.new(:web) do |t|
|
24
|
+
t.pattern = "./spec/acceptance/renalware/features/**/*.feature"
|
25
|
+
t.rspec_opts = "--tag web --require spec_helper" # targets features with the @web tag only
|
26
|
+
ENV["TURNIP_WEB"] = "1" # triggers inclusion of web_steps
|
27
|
+
end
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
# Run both domain and web acceptance specs.
|
30
|
+
# Usage:
|
31
|
+
# bundle exec rake spec:acceptance:all
|
32
|
+
task all: [:domain, :web]
|
33
|
+
end
|
32
34
|
end
|
33
35
|
end
|
@@ -16,7 +16,9 @@ FactoryBot.define do
|
|
16
16
|
fat_tissue_mass { "42.1" }
|
17
17
|
adipose_tissue_mass { "15.1" }
|
18
18
|
body_cell_mass { "53.1" }
|
19
|
-
quality_of_reading {
|
19
|
+
quality_of_reading { 65.123 }
|
20
|
+
weight { 23.1 }
|
21
|
+
pre_post_hd { "post" }
|
20
22
|
assessor { accountable_actor }
|
21
23
|
end
|
22
24
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :pathology_code_group, class: "Renalware::Pathology::CodeGroup" do
|
5
|
+
accountable
|
6
|
+
name { "Group1" }
|
7
|
+
description { "Group1Description" }
|
8
|
+
|
9
|
+
trait :hd_session_form_recent do
|
10
|
+
name { "hd_session_form_recent" }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -5,16 +5,19 @@ require_relative "./login_macros"
|
|
5
5
|
|
6
6
|
RSpec.configure do |config|
|
7
7
|
config.include Devise::Test::ControllerHelpers, type: :controller
|
8
|
-
config.include
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
config.include Devise::Test::ControllerHelpers, type: :component
|
9
|
+
|
10
|
+
%i(feature system request component).each do |type|
|
11
|
+
config.include Warden::Test::Helpers, type: type
|
12
|
+
end
|
13
|
+
|
14
|
+
config.include Warden::Test::Helpers, type: :component
|
15
|
+
config.include Devise::Test::IntegrationHelpers, type: :component
|
12
16
|
config.include Devise::Test::IntegrationHelpers, type: :system
|
13
|
-
config.include LoginMacros, type: :system
|
14
|
-
config.include LoginMacros, type: :feature
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
+
%i(controller system feature request component).each do |type|
|
19
|
+
config.include LoginMacros, type: type
|
20
|
+
end
|
18
21
|
|
19
22
|
config.before(:each, type: :controller) do
|
20
23
|
login_as_super_admin
|
@@ -32,3 +35,16 @@ RSpec.configure do |config|
|
|
32
35
|
Warden.test_reset!
|
33
36
|
end
|
34
37
|
end
|
38
|
+
|
39
|
+
# This monkey patch is to allow Devise::ControllerHelpers to work with
|
40
|
+
# ActionView::Component::TestHelpers which does not expose @request or @controller.
|
41
|
+
module DeviseHelperAdditionsForActionViewComponent
|
42
|
+
def setup_controller_for_warden
|
43
|
+
if respond_to?(:request)
|
44
|
+
@request ||= request
|
45
|
+
@controller ||= controller
|
46
|
+
end
|
47
|
+
super
|
48
|
+
end
|
49
|
+
end
|
50
|
+
Devise::Test::ControllerHelpers.prepend(DeviseHelperAdditionsForActionViewComponent)
|