renalware-forms 0.1.12 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +8 -0
- data/.rspec +1 -0
- data/.rubocop.yml +63 -0
- data/.ruby-version +1 -0
- data/.semaphore/semaphore.yml +51 -0
- data/CHANGELOG.md +37 -0
- data/Gemfile +21 -0
- data/Gemfile.lock +141 -0
- data/bin/rspec +3 -0
- data/default.yml +6 -0
- data/lib/renalware/forms/generic/homecare/v1/footer.rb +0 -2
- data/lib/renalware/forms/generic/homecare/v1.rb +11 -0
- data/lib/renalware/forms/generic/homecare.rb +2 -0
- data/lib/renalware/forms/generic.rb +2 -0
- data/lib/renalware/forms/homecare/args.rb +16 -16
- data/lib/renalware/forms/homecare.rb +3 -4
- data/lib/renalware/forms/version.rb +1 -1
- data/lib/renalware/forms.rb +5 -9
- data/lib/tasks/tasks.rake +3 -9
- data/renalware-forms.gemspec +33 -0
- data/spec/renalware/forms/args_spec.rb +30 -0
- data/spec/renalware/forms/homecare/generic/v1/allergies_spec.rb +38 -0
- data/spec/renalware/forms/homecare/generic/v1/delivery_frequencies_spec.rb +53 -0
- data/spec/renalware/forms/homecare/generic/v1/heading_spec.rb +26 -0
- data/spec/renalware/forms/homecare/generic/v1/mediations_spec.rb +37 -0
- data/spec/renalware/forms/homecare/generic/v1/patient_details_spec.rb +37 -0
- data/spec/renalware/forms/homecare/generic/v1/prescription_durations_spec.rb +52 -0
- data/spec/renalware/forms/homecare/generic/v1/signoff_spec.rb +19 -0
- data/spec/renalware/forms/homecare/pdf_spec.rb +71 -0
- data/spec/spec_helper.rb +78 -0
- metadata +29 -20
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 181086d1ec5a5fc79aeb1f31ee96d41783421214068279e7685c32b0310b08c1
|
|
4
|
+
data.tar.gz: 124fa4c1c4b5f8a7a7c9aa6653b194f2ebd773664dded89be7a9c163681ae677
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6f47a359295804dfd868b3af40a2370a5c40c8a3e0483aa2b73030d890791519eab1e750b59ffe72920562ccce5713ecea1284a9508b7dc26934768ef32ab81d
|
|
7
|
+
data.tar.gz: 138c530b7af35432e90d8a1a8cb4483dc69d0c0c6cfa0eab0901c7713e1d8849fd12c49a3bba31a9d41a4f38f16cc5ec278d124fb8b7f029f6a9907f9cfaca77
|
data/.gitignore
ADDED
data/.rspec
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--require spec_helper
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
require:
|
|
2
|
+
- rubocop-rails
|
|
3
|
+
- rubocop-rspec
|
|
4
|
+
- rubocop-performance
|
|
5
|
+
|
|
6
|
+
# Note that the local default.yml is overwritten on CodeClimate with the contents of
|
|
7
|
+
# the remote rubocop.yml pulled from GitHub in a codeclimate prepare step.
|
|
8
|
+
inherit_from:
|
|
9
|
+
- default.yml
|
|
10
|
+
|
|
11
|
+
AllCops:
|
|
12
|
+
UseCache: true
|
|
13
|
+
TargetRubyVersion: 3.0
|
|
14
|
+
# Just defining the Exclude or Include keys here overwrites the settings in default.yml
|
|
15
|
+
# so we have to redefine the entire set
|
|
16
|
+
Exclude:
|
|
17
|
+
- "*.gemspec"
|
|
18
|
+
- "vendor/**/*"
|
|
19
|
+
- "bin/**/*"
|
|
20
|
+
- "lib/tasks/**/*"
|
|
21
|
+
- "db/**/*"
|
|
22
|
+
- "spec/dummy/bin/**/*"
|
|
23
|
+
- "spec/dummy/lib/tasks/**/*"
|
|
24
|
+
- "spec/dummy/db/**/*"
|
|
25
|
+
- "tmp/**/*"
|
|
26
|
+
- "spec/dummy/tmp/**/*"
|
|
27
|
+
- "vendor/bundle/**/*"
|
|
28
|
+
- "config/initializers/devise.rb"
|
|
29
|
+
|
|
30
|
+
Layout/LineLength:
|
|
31
|
+
Exclude:
|
|
32
|
+
- "spec/acceptance/renalware/steps/**/*"
|
|
33
|
+
|
|
34
|
+
Metrics/AbcSize:
|
|
35
|
+
Max: 50
|
|
36
|
+
RSpec/ExampleLength:
|
|
37
|
+
Max: 40
|
|
38
|
+
RSpec/NestedGroups:
|
|
39
|
+
Max: 4
|
|
40
|
+
RSpec/MultipleExpectations:
|
|
41
|
+
Max: 20
|
|
42
|
+
RSpec/DescribeClass:
|
|
43
|
+
Enabled: false
|
|
44
|
+
RSpec/ImplicitSubject:
|
|
45
|
+
Enabled: false
|
|
46
|
+
RSpec/DescribedClass:
|
|
47
|
+
Enabled: false
|
|
48
|
+
Performance/RedundantBlockCall:
|
|
49
|
+
Enabled: false
|
|
50
|
+
Style/NumericPredicate:
|
|
51
|
+
Enabled: false
|
|
52
|
+
RSpec/InstanceVariable:
|
|
53
|
+
Enabled: false
|
|
54
|
+
Metrics/MethodLength:
|
|
55
|
+
Max: 50
|
|
56
|
+
Rails/Date:
|
|
57
|
+
Enabled: false
|
|
58
|
+
Rails/TimeZone:
|
|
59
|
+
Enabled: false
|
|
60
|
+
Style/AsciiComments:
|
|
61
|
+
Enabled: false
|
|
62
|
+
Style/ZeroLengthPredicate:
|
|
63
|
+
Enabled: false
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.0.2
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Use the latest stable version of Semaphore 2.0 YML syntax:
|
|
2
|
+
version: v1.0
|
|
3
|
+
name: renalware-forms
|
|
4
|
+
|
|
5
|
+
agent:
|
|
6
|
+
machine:
|
|
7
|
+
type: e1-standard-2
|
|
8
|
+
os_image: ubuntu1804
|
|
9
|
+
|
|
10
|
+
blocks:
|
|
11
|
+
- name: Test setup
|
|
12
|
+
task:
|
|
13
|
+
jobs:
|
|
14
|
+
- name: bundle
|
|
15
|
+
commands:
|
|
16
|
+
- checkout
|
|
17
|
+
- cache restore gems-$SEMAPHORE_GIT_BRANCH-$(checksum Gemfile.lock),gems-$SEMAPHORE_GIT_BRANCH-,gems-master-
|
|
18
|
+
- sem-version ruby 3.0.2
|
|
19
|
+
- bundle install --deployment -j 4 --path vendor/bundle
|
|
20
|
+
- cache store gems-$SEMAPHORE_GIT_BRANCH-$(checksum Gemfile.lock) vendor/bundle
|
|
21
|
+
|
|
22
|
+
- name: Tests
|
|
23
|
+
task:
|
|
24
|
+
env_vars:
|
|
25
|
+
- name: RAILS_ENV
|
|
26
|
+
value: test
|
|
27
|
+
|
|
28
|
+
# This secret on semaphore contains the CC_TEST_REPORTER_ID ENV var
|
|
29
|
+
secrets:
|
|
30
|
+
- name: renalware-forms
|
|
31
|
+
|
|
32
|
+
prologue:
|
|
33
|
+
commands:
|
|
34
|
+
- checkout
|
|
35
|
+
- cache restore gems-$SEMAPHORE_GIT_BRANCH-$(checksum Gemfile.lock),gems-$SEMAPHORE_GIT_BRANCH-,gems-master-
|
|
36
|
+
- git submodule sync ; git submodule update --init
|
|
37
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
|
38
|
+
- chmod +x ./cc-test-reporter
|
|
39
|
+
- ./cc-test-reporter before-build
|
|
40
|
+
- sem-version ruby 3.0.2
|
|
41
|
+
- bundle install --deployment --path vendor/bundle
|
|
42
|
+
|
|
43
|
+
jobs:
|
|
44
|
+
- name: RSpec tests
|
|
45
|
+
commands:
|
|
46
|
+
- bundle exec rspec --format progress
|
|
47
|
+
|
|
48
|
+
epilogue:
|
|
49
|
+
on_pass:
|
|
50
|
+
commands:
|
|
51
|
+
- ./cc-test-reporter after-build
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in
|
|
4
|
+
this [changelog](http://keepachangelog.com/en/0.3.0/).
|
|
5
|
+
This project adheres to Semantic Versioning.
|
|
6
|
+
|
|
7
|
+
## Unreleased
|
|
8
|
+
### Added
|
|
9
|
+
### Changed
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
## 0.1.11
|
|
13
|
+
3 April 2020
|
|
14
|
+
### Added
|
|
15
|
+
### Changed
|
|
16
|
+
- Switched from Virtus to dry-types
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
## 0.1.7
|
|
20
|
+
31 Mar 2020
|
|
21
|
+
### Added
|
|
22
|
+
### Changed
|
|
23
|
+
### Fixed
|
|
24
|
+
- Remove unused homecare args
|
|
25
|
+
|
|
26
|
+
## 0.1.6
|
|
27
|
+
31 Mar 2020
|
|
28
|
+
### Added
|
|
29
|
+
### Changed
|
|
30
|
+
### Fixed
|
|
31
|
+
- Support supplying a selected delivery frequency
|
|
32
|
+
|
|
33
|
+
## 0.1.3
|
|
34
|
+
### Added
|
|
35
|
+
### Changed
|
|
36
|
+
### Fixed
|
|
37
|
+
- Bring in allergies
|
data/Gemfile
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
source "https://rubygems.org"
|
|
2
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
|
3
|
+
|
|
4
|
+
# Declare your gem's dependencies in renalware-forms.gemspec.
|
|
5
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
|
6
|
+
# development dependencies will be added by default to the :development group.
|
|
7
|
+
gemspec
|
|
8
|
+
|
|
9
|
+
# Declare any dependencies that are still in development here instead of in
|
|
10
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
|
11
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
|
12
|
+
# your gem to rubygems.org.
|
|
13
|
+
|
|
14
|
+
group :development, :test do
|
|
15
|
+
gem "byebug"
|
|
16
|
+
gem "rubocop"
|
|
17
|
+
gem "rubocop-performance"
|
|
18
|
+
gem "rubocop-rails"
|
|
19
|
+
gem "rubocop-rspec"
|
|
20
|
+
gem "simplecov", "~> 0.17.1"
|
|
21
|
+
end
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
renalware-forms (0.1.13)
|
|
5
|
+
activemodel
|
|
6
|
+
attr_extras (~> 6.2)
|
|
7
|
+
dry-struct
|
|
8
|
+
dry-types
|
|
9
|
+
prawn (~> 2.2)
|
|
10
|
+
prawn-table (~> 0.2)
|
|
11
|
+
rake
|
|
12
|
+
|
|
13
|
+
GEM
|
|
14
|
+
remote: https://rubygems.org/
|
|
15
|
+
specs:
|
|
16
|
+
Ascii85 (1.1.0)
|
|
17
|
+
activemodel (6.1.4.1)
|
|
18
|
+
activesupport (= 6.1.4.1)
|
|
19
|
+
activesupport (6.1.4.1)
|
|
20
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
21
|
+
i18n (>= 1.6, < 2)
|
|
22
|
+
minitest (>= 5.1)
|
|
23
|
+
tzinfo (~> 2.0)
|
|
24
|
+
zeitwerk (~> 2.3)
|
|
25
|
+
afm (0.2.2)
|
|
26
|
+
ast (2.4.2)
|
|
27
|
+
attr_extras (6.2.4)
|
|
28
|
+
byebug (11.1.3)
|
|
29
|
+
concurrent-ruby (1.1.9)
|
|
30
|
+
diff-lcs (1.4.4)
|
|
31
|
+
docile (1.4.0)
|
|
32
|
+
dry-configurable (0.13.0)
|
|
33
|
+
concurrent-ruby (~> 1.0)
|
|
34
|
+
dry-core (~> 0.6)
|
|
35
|
+
dry-container (0.9.0)
|
|
36
|
+
concurrent-ruby (~> 1.0)
|
|
37
|
+
dry-configurable (~> 0.13, >= 0.13.0)
|
|
38
|
+
dry-core (0.7.1)
|
|
39
|
+
concurrent-ruby (~> 1.0)
|
|
40
|
+
dry-inflector (0.2.1)
|
|
41
|
+
dry-logic (1.2.0)
|
|
42
|
+
concurrent-ruby (~> 1.0)
|
|
43
|
+
dry-core (~> 0.5, >= 0.5)
|
|
44
|
+
dry-struct (1.4.0)
|
|
45
|
+
dry-core (~> 0.5, >= 0.5)
|
|
46
|
+
dry-types (~> 1.5)
|
|
47
|
+
ice_nine (~> 0.11)
|
|
48
|
+
dry-types (1.5.1)
|
|
49
|
+
concurrent-ruby (~> 1.0)
|
|
50
|
+
dry-container (~> 0.3)
|
|
51
|
+
dry-core (~> 0.5, >= 0.5)
|
|
52
|
+
dry-inflector (~> 0.1, >= 0.1.2)
|
|
53
|
+
dry-logic (~> 1.0, >= 1.0.2)
|
|
54
|
+
hashery (2.1.2)
|
|
55
|
+
i18n (1.8.10)
|
|
56
|
+
concurrent-ruby (~> 1.0)
|
|
57
|
+
ice_nine (0.11.2)
|
|
58
|
+
json (2.5.1)
|
|
59
|
+
minitest (5.14.4)
|
|
60
|
+
parallel (1.21.0)
|
|
61
|
+
parser (3.0.2.0)
|
|
62
|
+
ast (~> 2.4.1)
|
|
63
|
+
pdf-core (0.9.0)
|
|
64
|
+
pdf-reader (2.5.0)
|
|
65
|
+
Ascii85 (~> 1.0)
|
|
66
|
+
afm (~> 0.2.1)
|
|
67
|
+
hashery (~> 2.0)
|
|
68
|
+
ruby-rc4
|
|
69
|
+
ttfunk
|
|
70
|
+
prawn (2.4.0)
|
|
71
|
+
pdf-core (~> 0.9.0)
|
|
72
|
+
ttfunk (~> 1.7)
|
|
73
|
+
prawn-table (0.2.2)
|
|
74
|
+
prawn (>= 1.3.0, < 3.0.0)
|
|
75
|
+
rack (2.2.3)
|
|
76
|
+
rainbow (3.0.0)
|
|
77
|
+
rake (13.0.6)
|
|
78
|
+
regexp_parser (2.1.1)
|
|
79
|
+
rexml (3.2.5)
|
|
80
|
+
rspec (3.10.0)
|
|
81
|
+
rspec-core (~> 3.10.0)
|
|
82
|
+
rspec-expectations (~> 3.10.0)
|
|
83
|
+
rspec-mocks (~> 3.10.0)
|
|
84
|
+
rspec-core (3.10.1)
|
|
85
|
+
rspec-support (~> 3.10.0)
|
|
86
|
+
rspec-expectations (3.10.1)
|
|
87
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
88
|
+
rspec-support (~> 3.10.0)
|
|
89
|
+
rspec-mocks (3.10.2)
|
|
90
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
91
|
+
rspec-support (~> 3.10.0)
|
|
92
|
+
rspec-support (3.10.2)
|
|
93
|
+
rubocop (1.22.1)
|
|
94
|
+
parallel (~> 1.10)
|
|
95
|
+
parser (>= 3.0.0.0)
|
|
96
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
97
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
98
|
+
rexml
|
|
99
|
+
rubocop-ast (>= 1.12.0, < 2.0)
|
|
100
|
+
ruby-progressbar (~> 1.7)
|
|
101
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
|
102
|
+
rubocop-ast (1.12.0)
|
|
103
|
+
parser (>= 3.0.1.1)
|
|
104
|
+
rubocop-performance (1.11.5)
|
|
105
|
+
rubocop (>= 1.7.0, < 2.0)
|
|
106
|
+
rubocop-ast (>= 0.4.0)
|
|
107
|
+
rubocop-rails (2.12.2)
|
|
108
|
+
activesupport (>= 4.2.0)
|
|
109
|
+
rack (>= 1.1)
|
|
110
|
+
rubocop (>= 1.7.0, < 2.0)
|
|
111
|
+
rubocop-rspec (2.5.0)
|
|
112
|
+
rubocop (~> 1.19)
|
|
113
|
+
ruby-progressbar (1.11.0)
|
|
114
|
+
ruby-rc4 (0.1.5)
|
|
115
|
+
simplecov (0.17.1)
|
|
116
|
+
docile (~> 1.1)
|
|
117
|
+
json (>= 1.8, < 3)
|
|
118
|
+
simplecov-html (~> 0.10.0)
|
|
119
|
+
simplecov-html (0.10.2)
|
|
120
|
+
ttfunk (1.7.0)
|
|
121
|
+
tzinfo (2.0.4)
|
|
122
|
+
concurrent-ruby (~> 1.0)
|
|
123
|
+
unicode-display_width (2.1.0)
|
|
124
|
+
zeitwerk (2.4.2)
|
|
125
|
+
|
|
126
|
+
PLATFORMS
|
|
127
|
+
ruby
|
|
128
|
+
|
|
129
|
+
DEPENDENCIES
|
|
130
|
+
byebug
|
|
131
|
+
pdf-reader
|
|
132
|
+
renalware-forms!
|
|
133
|
+
rspec
|
|
134
|
+
rubocop
|
|
135
|
+
rubocop-performance
|
|
136
|
+
rubocop-rails
|
|
137
|
+
rubocop-rspec
|
|
138
|
+
simplecov (~> 0.17.1)
|
|
139
|
+
|
|
140
|
+
BUNDLED WITH
|
|
141
|
+
2.2.28
|
data/bin/rspec
ADDED
data/default.yml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
inherit_from:
|
|
2
|
+
- https://raw.githubusercontent.com/airslie/styleguide/master/rubocop.yml
|
|
3
|
+
|
|
4
|
+
# Don't add anything to this file other than the inherit_from above
|
|
5
|
+
# as this file is overwritten on CodeClimate with the contents of the above
|
|
6
|
+
# remote url which is downloaded in a CodeClimate prepare step.
|
|
@@ -6,3 +6,14 @@ module Renalware::Forms::Generic
|
|
|
6
6
|
end
|
|
7
7
|
end
|
|
8
8
|
end
|
|
9
|
+
|
|
10
|
+
require_relative "v1/base"
|
|
11
|
+
require_relative "v1/allergies"
|
|
12
|
+
require_relative "v1/delivery_frequencies"
|
|
13
|
+
require_relative "v1/document"
|
|
14
|
+
require_relative "v1/footer"
|
|
15
|
+
require_relative "v1/heading"
|
|
16
|
+
require_relative "v1/medications"
|
|
17
|
+
require_relative "v1/patient_details"
|
|
18
|
+
require_relative "v1/prescription_durations"
|
|
19
|
+
require_relative "v1/signoff"
|
|
@@ -25,32 +25,32 @@ module Renalware::Forms
|
|
|
25
25
|
|
|
26
26
|
# The first 2 attrbutes are used to drive what PDF to build
|
|
27
27
|
attribute :provider, Types::Coercible::String
|
|
28
|
-
attribute :version, Types::Integer
|
|
29
|
-
attribute :title, Types::String.default("")
|
|
28
|
+
attribute :version, Types::Coercible::Integer
|
|
29
|
+
attribute :title, Types::String.default("").optional
|
|
30
30
|
attribute :given_name, Types::String
|
|
31
31
|
attribute :family_name, Types::String
|
|
32
|
-
attribute :nhs_number, Types::String.default("")
|
|
32
|
+
attribute :nhs_number, Types::String.default("").optional
|
|
33
33
|
attribute :born_on, Types::Params::Date
|
|
34
|
-
attribute :modality, Types::String.
|
|
35
|
-
attribute :telephone, Types::String.default("")
|
|
36
|
-
attribute :hospital_number, Types::String.default("")
|
|
34
|
+
attribute :modality , Types::Coercible::String.optional
|
|
35
|
+
attribute :telephone, Types::String.default("").optional
|
|
36
|
+
attribute :hospital_number, Types::String.default("").optional
|
|
37
37
|
attribute :address, Types::Array.of(Types::Coercible::String).default([].dup, shared: true)
|
|
38
|
-
attribute :postcode, Types::String.default("")
|
|
39
|
-
attribute :prescriber_name, Types::String.default("")
|
|
40
|
-
attribute :prescription_date, Types::Params::Date
|
|
38
|
+
attribute :postcode, Types::String.default("").optional
|
|
39
|
+
attribute :prescriber_name, Types::String.default("").optional
|
|
40
|
+
# attribute :prescription_date, Types::Params::Date
|
|
41
41
|
attribute :hospital_name, Types::String.default("")
|
|
42
|
-
attribute :hospital_department, Types::String.default("")
|
|
42
|
+
attribute :hospital_department, Types::String.default("").optional
|
|
43
43
|
attribute :hospital_address, Types::Array.of(Types::Coercible::String).default([], shared: true)
|
|
44
|
-
attribute :hospital_telephone, Types::String.default("")
|
|
45
|
-
attribute :po_number, Types::String.default("")
|
|
44
|
+
attribute :hospital_telephone, Types::String.default("").optional
|
|
45
|
+
attribute :po_number, Types::String.default("").optional
|
|
46
46
|
attribute :generated_at, (Types::Params::DateTime.default { DateTime.now })
|
|
47
|
-
attribute :no_known_allergies, Types::Bool
|
|
47
|
+
attribute :no_known_allergies, Types::Bool.optional
|
|
48
48
|
attribute :allergies, Types::Array.of(Types::Coercible::String)
|
|
49
|
-
attribute :drug_type, Types::Coercible::String
|
|
49
|
+
attribute :drug_type, Types::Coercible::String.optional
|
|
50
50
|
# attribute :prescription_duration, Types::String
|
|
51
|
-
attribute :administration_device, Types::String.default("")
|
|
51
|
+
attribute :administration_device, Types::String.default("").optional
|
|
52
52
|
attribute :medications, Types::Array.of(Medication).default([].dup, shared: true)
|
|
53
|
-
attribute :consultant, Types::String.default("")
|
|
53
|
+
attribute :consultant, Types::String.default("").optional
|
|
54
54
|
attribute(
|
|
55
55
|
:delivery_frequencies,
|
|
56
56
|
Types::Array.of(Types::Coercible::String).default(["3 months", "6 months"].freeze)
|
data/lib/renalware/forms.rb
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "zeitwerk"
|
|
4
3
|
require "prawn"
|
|
5
4
|
require "prawn/table"
|
|
6
5
|
require "attr_extras"
|
|
7
6
|
|
|
8
|
-
# Set up autoloading with zeitwerk
|
|
9
|
-
# As we are nested in lib/renalware/forms, be sure to push an absolute
|
|
10
|
-
# path to the lib folder.
|
|
11
|
-
loader = Zeitwerk::Loader.new
|
|
12
|
-
loader.push_dir File.expand_path("../", __dir__)
|
|
13
|
-
loader.ignore File.expand_path("../renalware/forms/version.rb", __dir__)
|
|
14
|
-
loader.setup
|
|
15
|
-
|
|
16
7
|
module Renalware
|
|
17
8
|
module Forms
|
|
18
9
|
end
|
|
19
10
|
end
|
|
11
|
+
|
|
12
|
+
require_relative "forms/base"
|
|
13
|
+
require_relative "forms/helpers"
|
|
14
|
+
require_relative "forms/generic"
|
|
15
|
+
require_relative "forms/homecare"
|
data/lib/tasks/tasks.rake
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
desc "Starts irb so we can debug the gem"
|
|
2
|
-
task :
|
|
4
|
+
task console: :environment do
|
|
3
5
|
exec "irb -r ./lib/renalware/forms"
|
|
4
6
|
end
|
|
5
|
-
|
|
6
|
-
namespace :zeitwerk do
|
|
7
|
-
desc "Checks project structure for Zeitwerk compatibility"
|
|
8
|
-
task :check do
|
|
9
|
-
require "renalware/forms"
|
|
10
|
-
Zeitwerk::Loader.eager_load_all
|
|
11
|
-
end
|
|
12
|
-
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
$:.push File.expand_path("lib", __dir__)
|
|
2
|
+
|
|
3
|
+
# Maintain your gem's version:
|
|
4
|
+
require "renalware/forms/version"
|
|
5
|
+
|
|
6
|
+
# Describe your gem and declare its dependencies:
|
|
7
|
+
Gem::Specification.new do |spec|
|
|
8
|
+
spec.name = "renalware-forms"
|
|
9
|
+
spec.version = Renalware::Forms::VERSION
|
|
10
|
+
spec.authors = ["Airslie Ltd"]
|
|
11
|
+
spec.email = ["dev@aisrlie.com"]
|
|
12
|
+
spec.homepage = "http://airslie.com"
|
|
13
|
+
spec.summary = "PDF library for Renalware forms"
|
|
14
|
+
spec.description = "The home for various forms for external providers e.g. home care prescriptions"
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
spec.required_ruby_version = ">= 3.0.0"
|
|
17
|
+
|
|
18
|
+
spec.files = `git ls-files`.split("\n")
|
|
19
|
+
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
|
20
|
+
spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
21
|
+
spec.require_paths = ["lib"]
|
|
22
|
+
spec.extra_rdoc_files = ["README.md"]
|
|
23
|
+
|
|
24
|
+
spec.add_dependency "activemodel"
|
|
25
|
+
spec.add_dependency "attr_extras", "~> 6.2"
|
|
26
|
+
spec.add_dependency "prawn", "~> 2.2"
|
|
27
|
+
spec.add_dependency "prawn-table", "~> 0.2"
|
|
28
|
+
spec.add_dependency "rake"
|
|
29
|
+
spec.add_dependency "dry-types"
|
|
30
|
+
spec.add_dependency "dry-struct"
|
|
31
|
+
spec.add_development_dependency "rspec"
|
|
32
|
+
spec.add_development_dependency "pdf-reader"
|
|
33
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
module Renalware::Forms::Homecare
|
|
6
|
+
RSpec.describe Args do
|
|
7
|
+
describe "#patient_name" do
|
|
8
|
+
subject {
|
|
9
|
+
hash = default_test_arg_values.update(
|
|
10
|
+
given_name: "John",
|
|
11
|
+
family_name: "SMITH",
|
|
12
|
+
title: title
|
|
13
|
+
)
|
|
14
|
+
described_class.new(hash).patient_name
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
context "when title present" do
|
|
18
|
+
let(:title) { "Mr" }
|
|
19
|
+
|
|
20
|
+
it { is_expected.to eq("SMITH, John (Mr)") }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
context "when title missing" do
|
|
24
|
+
let(:title) { "" }
|
|
25
|
+
|
|
26
|
+
it { is_expected.to eq("SMITH, John") }
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
module Renalware::Forms::Generic
|
|
6
|
+
RSpec.describe Homecare::V1::Allergies do
|
|
7
|
+
context "when the patient has iit recoreded that they have no known allergies" do
|
|
8
|
+
it do
|
|
9
|
+
hash = default_test_arg_values.update(no_known_allergies: true)
|
|
10
|
+
args = Renalware::Forms::Homecare::Args.new(hash)
|
|
11
|
+
doc = test_prawn_doc
|
|
12
|
+
|
|
13
|
+
described_class.new(doc, args).build
|
|
14
|
+
|
|
15
|
+
text = extract_text_from_prawn_doc(doc)
|
|
16
|
+
expect(text).to include("No Known Allergies")
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it do
|
|
21
|
+
hash = default_test_arg_values.update(
|
|
22
|
+
no_known_allergies: false,
|
|
23
|
+
allergies: %w(nuts penicillin)
|
|
24
|
+
)
|
|
25
|
+
args = Renalware::Forms::Homecare::Args.new(hash)
|
|
26
|
+
doc = test_prawn_doc
|
|
27
|
+
|
|
28
|
+
described_class.new(doc, args).build
|
|
29
|
+
|
|
30
|
+
text = extract_text_from_prawn_doc(doc)
|
|
31
|
+
|
|
32
|
+
expect(text).not_to include("No Known Allergies")
|
|
33
|
+
expect(text).to include("Known Allergies")
|
|
34
|
+
expect(text).to include("nuts")
|
|
35
|
+
expect(text).to include("penicillin")
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
module Renalware::Forms::Generic
|
|
6
|
+
RSpec.describe Homecare::V1::DeliveryFrequencies do
|
|
7
|
+
def extract_pdf_text(args)
|
|
8
|
+
doc = test_prawn_doc
|
|
9
|
+
described_class.new(doc, args).build
|
|
10
|
+
extract_text_from_prawn_doc(doc)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it do
|
|
14
|
+
hash = default_test_arg_values.update(delivery_frequencies: ["Once", "3 weeks", "6 weeks"])
|
|
15
|
+
args = Renalware::Forms::Homecare::Args.new(hash)
|
|
16
|
+
|
|
17
|
+
text = extract_pdf_text(args)
|
|
18
|
+
|
|
19
|
+
expect(text).to include("Frequency of deliveries")
|
|
20
|
+
expect(text).to match(/❏ +Once/)
|
|
21
|
+
expect(text).to match(/❏ +3 weeks/)
|
|
22
|
+
expect(text).to match(/❏ +6 weeks/)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
context "when there are no frequencies supplied" do
|
|
26
|
+
it "displays the defaults" do
|
|
27
|
+
args = Renalware::Forms::Homecare::Args.new(**default_test_arg_values)
|
|
28
|
+
|
|
29
|
+
text = extract_pdf_text(args)
|
|
30
|
+
|
|
31
|
+
expect(text).to match(/Frequency of deliveries/)
|
|
32
|
+
expect(text).to match(/❏ +3 months/)
|
|
33
|
+
expect(text).to match(/❏ +6 months/)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
context "when there is a selected delivery_frequency" do
|
|
38
|
+
it "indicates that frequency has been selected by checking a box" do
|
|
39
|
+
hash = default_test_arg_values.update(
|
|
40
|
+
delivery_frequencies: ["3 months", "6 months", "12 months"],
|
|
41
|
+
selected_delivery_frequency: "6 months"
|
|
42
|
+
)
|
|
43
|
+
args = Renalware::Forms::Homecare::Args.new(hash)
|
|
44
|
+
|
|
45
|
+
text = extract_pdf_text(args)
|
|
46
|
+
|
|
47
|
+
expect(text).to match(/❏ +3 months/)
|
|
48
|
+
expect(text).to match(/■ +6 months/)
|
|
49
|
+
expect(text).to match(/❏ +12 months/)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
module Renalware::Forms::Generic
|
|
6
|
+
RSpec.describe Homecare::V1::Heading do
|
|
7
|
+
it do
|
|
8
|
+
hash = default_test_arg_values.update(
|
|
9
|
+
po_number: "P123",
|
|
10
|
+
hospital_number: "H123",
|
|
11
|
+
drug_type: "ESA"
|
|
12
|
+
)
|
|
13
|
+
args = Renalware::Forms::Homecare::Args.new(hash)
|
|
14
|
+
doc = test_prawn_doc
|
|
15
|
+
|
|
16
|
+
described_class.new(doc, args).build
|
|
17
|
+
|
|
18
|
+
text = extract_text_from_prawn_doc(doc)
|
|
19
|
+
|
|
20
|
+
expect(text).to include(args.po_number)
|
|
21
|
+
expect(text).to include(args.hospital_number)
|
|
22
|
+
expect(text).to include(args.drug_type)
|
|
23
|
+
expect(text).to include("Home Delivery Medication List")
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
module Renalware::Forms::Generic
|
|
6
|
+
RSpec.describe Homecare::V1::Medications do
|
|
7
|
+
it do
|
|
8
|
+
args = Renalware::Forms::Homecare::Args.new(**default_test_arg_values)
|
|
9
|
+
args.medications << Renalware::Forms::Homecare::Args::Medication.new(
|
|
10
|
+
date: "2020-01-01",
|
|
11
|
+
drug: "Drug1",
|
|
12
|
+
dose: "Dose1",
|
|
13
|
+
route: "Route1",
|
|
14
|
+
frequency: "Freq1"
|
|
15
|
+
)
|
|
16
|
+
args.medications << Renalware::Forms::Homecare::Args::Medication.new(
|
|
17
|
+
date: "2020-02-02",
|
|
18
|
+
drug: "Drug2",
|
|
19
|
+
dose: "Dose2",
|
|
20
|
+
route: "Route2",
|
|
21
|
+
frequency: "Freq2"
|
|
22
|
+
)
|
|
23
|
+
doc = test_prawn_doc
|
|
24
|
+
|
|
25
|
+
described_class.new(doc, args).build
|
|
26
|
+
|
|
27
|
+
text = extract_text_from_prawn_doc(doc)
|
|
28
|
+
|
|
29
|
+
expect(text).to include("2020-01-01")
|
|
30
|
+
expect(text).to include("Drug1")
|
|
31
|
+
expect(text).to include("Dose1")
|
|
32
|
+
expect(text).to include("Route1")
|
|
33
|
+
expect(text).to include("Freq1")
|
|
34
|
+
expect(text).to include("Drug2")
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
module Renalware::Forms::Generic
|
|
6
|
+
RSpec.describe Homecare::V1::PatientDetails do
|
|
7
|
+
it do
|
|
8
|
+
hash = default_test_arg_values.update(
|
|
9
|
+
given_name: "John",
|
|
10
|
+
family_name: "SMITH",
|
|
11
|
+
title: "Mr",
|
|
12
|
+
modality: "HD",
|
|
13
|
+
born_on: "2001-01-01",
|
|
14
|
+
nhs_number: "0123456789",
|
|
15
|
+
hospital_number: "X123",
|
|
16
|
+
address: %w(aa bb cc),
|
|
17
|
+
postcode: "POSTCODE"
|
|
18
|
+
)
|
|
19
|
+
args = Renalware::Forms::Homecare::Args.new(hash)
|
|
20
|
+
doc = test_prawn_doc
|
|
21
|
+
|
|
22
|
+
described_class.new(doc, args).build
|
|
23
|
+
|
|
24
|
+
text = extract_text_from_prawn_doc(doc)
|
|
25
|
+
|
|
26
|
+
expect(text).to include("SMITH, John (Mr)")
|
|
27
|
+
expect(text).to include("HD")
|
|
28
|
+
expect(text).to include("2001-01-01")
|
|
29
|
+
expect(text).to include("0123456789")
|
|
30
|
+
expect(text).to include("X123")
|
|
31
|
+
expect(text).to include("aa")
|
|
32
|
+
expect(text).to include("bb")
|
|
33
|
+
expect(text).to include("cc")
|
|
34
|
+
expect(text).to include("POSTCODE")
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
module Renalware::Forms::Generic
|
|
6
|
+
RSpec.describe Homecare::V1::PrescriptionDurations do
|
|
7
|
+
def extract_pdf_text(args)
|
|
8
|
+
doc = test_prawn_doc
|
|
9
|
+
described_class.new(doc, args).build
|
|
10
|
+
extract_text_from_prawn_doc(doc)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it do
|
|
14
|
+
hash = default_test_arg_values.update(
|
|
15
|
+
prescription_durations: ["3 months", "6 months", "12 months"]
|
|
16
|
+
)
|
|
17
|
+
args = Renalware::Forms::Homecare::Args.new(hash)
|
|
18
|
+
|
|
19
|
+
text = extract_pdf_text(args)
|
|
20
|
+
|
|
21
|
+
expect(text).to include("Repeat prescription for")
|
|
22
|
+
expect(text).to match(/❏ +3 months/)
|
|
23
|
+
expect(text).to match(/❏ +6 months/)
|
|
24
|
+
expect(text).to match(/❏ +12 months/)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it "works where there are no prescription_durations supplied" do
|
|
28
|
+
args = Renalware::Forms::Homecare::Args.new(default_test_arg_values)
|
|
29
|
+
|
|
30
|
+
text = extract_pdf_text(args)
|
|
31
|
+
|
|
32
|
+
expect(text).to include("Repeat prescription for")
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
context "when there is a selected prescription_duration" do
|
|
36
|
+
it "indicates that duration has been selected eg for checking a box" do
|
|
37
|
+
args = Renalware::Forms::Homecare::Args.new(
|
|
38
|
+
default_test_arg_values.update(
|
|
39
|
+
prescription_durations: ["3 months", "6 months", "12 months"],
|
|
40
|
+
selected_prescription_duration: "6 months"
|
|
41
|
+
)
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
text = extract_pdf_text(args)
|
|
45
|
+
|
|
46
|
+
expect(text).to match(/❏ +3 months/)
|
|
47
|
+
expect(text).to match(/■ +6 months/)
|
|
48
|
+
expect(text).to match(/❏ +12 months/)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
module Renalware::Forms::Generic
|
|
6
|
+
RSpec.describe Homecare::V1::Signoff do
|
|
7
|
+
it do
|
|
8
|
+
args = Renalware::Forms::Homecare::Args.new(
|
|
9
|
+
**default_test_arg_values.update(consultant: "Dr Pepper")
|
|
10
|
+
)
|
|
11
|
+
doc = test_prawn_doc
|
|
12
|
+
|
|
13
|
+
described_class.new(doc, args).build
|
|
14
|
+
|
|
15
|
+
text = extract_text_from_prawn_doc(doc)
|
|
16
|
+
expect(text).to include("Dr Pepper")
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
RSpec.describe Renalware::Forms::Homecare::Pdf do
|
|
6
|
+
describe "#generate" do
|
|
7
|
+
# describe "argument validation" do
|
|
8
|
+
# it "throws an error if args is nil" do
|
|
9
|
+
# expect { described_class.generate(nil) }.to raise_error(ArgumentError)
|
|
10
|
+
# end
|
|
11
|
+
|
|
12
|
+
# it "throws an error if arg.provider is nil" do
|
|
13
|
+
# args = Renalware::Forms::Homecare::Args.new(provider: nil)
|
|
14
|
+
|
|
15
|
+
# expect {
|
|
16
|
+
# described_class.generate(args)
|
|
17
|
+
# }.to raise_error(ArgumentError, "Missing provider")
|
|
18
|
+
# end
|
|
19
|
+
|
|
20
|
+
# it "throws an error if arg.provider is an empty string" do
|
|
21
|
+
# args = Renalware::Forms::Homecare::Args.new(provider: "")
|
|
22
|
+
|
|
23
|
+
# expect {
|
|
24
|
+
# described_class.generate(args)
|
|
25
|
+
# }.to raise_error(ArgumentError, "Missing provider")
|
|
26
|
+
# end
|
|
27
|
+
|
|
28
|
+
# it "throws an error if arg.version is not a number" do
|
|
29
|
+
# args = Renalware::Forms::Homecare::Args.new(provider: :a, version: nil)
|
|
30
|
+
|
|
31
|
+
# expect {
|
|
32
|
+
# described_class.generate(args)
|
|
33
|
+
# }.to raise_error(ArgumentError, "Version must be >0")
|
|
34
|
+
# end
|
|
35
|
+
|
|
36
|
+
# it "throws an error no matching provider found" do
|
|
37
|
+
# args = Renalware::Forms::Homecare::Args.new(provider: :generico, version: 1)
|
|
38
|
+
|
|
39
|
+
# expect {
|
|
40
|
+
# described_class.generate(args)
|
|
41
|
+
# }.to raise_error(
|
|
42
|
+
# ArgumentError,
|
|
43
|
+
# "No PDF forms found for provider=generico version=1 "\
|
|
44
|
+
# "trying to resolve Renalware::Forms::Generico::Homecare::V1::Document"
|
|
45
|
+
# )
|
|
46
|
+
# end
|
|
47
|
+
|
|
48
|
+
# it "throws an error no matching version found" do
|
|
49
|
+
# args = Renalware::Forms::Homecare::Args.new(provider: :generic, version: 1000)
|
|
50
|
+
|
|
51
|
+
# expect {
|
|
52
|
+
# described_class.generate(args)
|
|
53
|
+
# }.to raise_error(
|
|
54
|
+
# ArgumentError,
|
|
55
|
+
# "No PDF forms found for provider=generic version=1000 "\
|
|
56
|
+
# "trying to resolve Renalware::Forms::Generic::Homecare::V1000::Document"
|
|
57
|
+
# )
|
|
58
|
+
# end
|
|
59
|
+
# end
|
|
60
|
+
|
|
61
|
+
context "when arguments are valid" do
|
|
62
|
+
it "create render a PDF for a Generic::Homecare::V1::Document" do
|
|
63
|
+
args = Renalware::Forms::Homecare::Args.new(**default_test_arg_values)
|
|
64
|
+
|
|
65
|
+
pdf_data = described_class.generate(args).render
|
|
66
|
+
|
|
67
|
+
expect(pdf_data).to start_with("%PDF-")
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
|
4
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
|
5
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
|
6
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
|
7
|
+
# files.
|
|
8
|
+
#
|
|
9
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
|
10
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
|
11
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
|
12
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
|
13
|
+
# a separate helper file that requires the additional dependencies and performs
|
|
14
|
+
# the additional setup, and require it from the spec files that actually need
|
|
15
|
+
# it.
|
|
16
|
+
|
|
17
|
+
require "simplecov"
|
|
18
|
+
SimpleCov.start
|
|
19
|
+
|
|
20
|
+
require "tempfile"
|
|
21
|
+
require "pdf-reader"
|
|
22
|
+
require "./lib/renalware/forms"
|
|
23
|
+
|
|
24
|
+
def pdf_reader_from(prawn_doc)
|
|
25
|
+
file = Tempfile.new("pdf")
|
|
26
|
+
prawn_doc.render_file file
|
|
27
|
+
PDF::Reader.new(file)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def test_prawn_doc
|
|
31
|
+
Prawn::Document.new(
|
|
32
|
+
page_size: "A4",
|
|
33
|
+
page_layout: :portrait,
|
|
34
|
+
margin: 15
|
|
35
|
+
)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def default_test_arg_values
|
|
39
|
+
{
|
|
40
|
+
provider: :generic,
|
|
41
|
+
version: 1,
|
|
42
|
+
modality: "HD",
|
|
43
|
+
telephone: "",
|
|
44
|
+
hospital_number: nil,
|
|
45
|
+
nhs_number: nil,
|
|
46
|
+
consultant: nil,
|
|
47
|
+
postcode: nil,
|
|
48
|
+
hospital_department: nil,
|
|
49
|
+
hospital_telephone: nil,
|
|
50
|
+
prescriber_name: nil,
|
|
51
|
+
po_number: "134",
|
|
52
|
+
administration_device: nil,
|
|
53
|
+
given_name: "John",
|
|
54
|
+
family_name: "SMITH",
|
|
55
|
+
title: "Mr",
|
|
56
|
+
no_known_allergies: true,
|
|
57
|
+
allergies: [],
|
|
58
|
+
drug_type: :esa,
|
|
59
|
+
born_on: "2019-01-01",
|
|
60
|
+
prescription_date: "2019-01-01"
|
|
61
|
+
}.dup
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def extract_text_from_prawn_doc(doc)
|
|
65
|
+
pdf_reader_from(doc).pages.map(&:text).join
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
|
69
|
+
RSpec.configure do |config|
|
|
70
|
+
config.expect_with :rspec do |expectations|
|
|
71
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
config.mock_with :rspec do |mocks|
|
|
75
|
+
mocks.verify_partial_doubles = true
|
|
76
|
+
end
|
|
77
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
|
78
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: renalware-forms
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.13
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Airslie Ltd
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-10-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activemodel
|
|
@@ -108,20 +108,6 @@ dependencies:
|
|
|
108
108
|
- - ">="
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
110
|
version: '0'
|
|
111
|
-
- !ruby/object:Gem::Dependency
|
|
112
|
-
name: zeitwerk
|
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
|
114
|
-
requirements:
|
|
115
|
-
- - ">="
|
|
116
|
-
- !ruby/object:Gem::Version
|
|
117
|
-
version: '0'
|
|
118
|
-
type: :runtime
|
|
119
|
-
prerelease: false
|
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
-
requirements:
|
|
122
|
-
- - ">="
|
|
123
|
-
- !ruby/object:Gem::Version
|
|
124
|
-
version: '0'
|
|
125
111
|
- !ruby/object:Gem::Dependency
|
|
126
112
|
name: rspec
|
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -153,13 +139,25 @@ dependencies:
|
|
|
153
139
|
description: The home for various forms for external providers e.g. home care prescriptions
|
|
154
140
|
email:
|
|
155
141
|
- dev@aisrlie.com
|
|
156
|
-
executables:
|
|
142
|
+
executables:
|
|
143
|
+
- rspec
|
|
157
144
|
extensions: []
|
|
158
|
-
extra_rdoc_files:
|
|
145
|
+
extra_rdoc_files:
|
|
146
|
+
- README.md
|
|
159
147
|
files:
|
|
148
|
+
- ".gitignore"
|
|
149
|
+
- ".rspec"
|
|
150
|
+
- ".rubocop.yml"
|
|
151
|
+
- ".ruby-version"
|
|
152
|
+
- ".semaphore/semaphore.yml"
|
|
153
|
+
- CHANGELOG.md
|
|
154
|
+
- Gemfile
|
|
155
|
+
- Gemfile.lock
|
|
160
156
|
- MIT-LICENSE
|
|
161
157
|
- README.md
|
|
162
158
|
- Rakefile
|
|
159
|
+
- bin/rspec
|
|
160
|
+
- default.yml
|
|
163
161
|
- lib/renalware/forms.rb
|
|
164
162
|
- lib/renalware/forms/base.rb
|
|
165
163
|
- lib/renalware/forms/generic.rb
|
|
@@ -183,6 +181,17 @@ files:
|
|
|
183
181
|
- lib/renalware/forms/version.rb
|
|
184
182
|
- lib/tasks/homecare.rake
|
|
185
183
|
- lib/tasks/tasks.rake
|
|
184
|
+
- renalware-forms.gemspec
|
|
185
|
+
- spec/renalware/forms/args_spec.rb
|
|
186
|
+
- spec/renalware/forms/homecare/generic/v1/allergies_spec.rb
|
|
187
|
+
- spec/renalware/forms/homecare/generic/v1/delivery_frequencies_spec.rb
|
|
188
|
+
- spec/renalware/forms/homecare/generic/v1/heading_spec.rb
|
|
189
|
+
- spec/renalware/forms/homecare/generic/v1/mediations_spec.rb
|
|
190
|
+
- spec/renalware/forms/homecare/generic/v1/patient_details_spec.rb
|
|
191
|
+
- spec/renalware/forms/homecare/generic/v1/prescription_durations_spec.rb
|
|
192
|
+
- spec/renalware/forms/homecare/generic/v1/signoff_spec.rb
|
|
193
|
+
- spec/renalware/forms/homecare/pdf_spec.rb
|
|
194
|
+
- spec/spec_helper.rb
|
|
186
195
|
homepage: http://airslie.com
|
|
187
196
|
licenses:
|
|
188
197
|
- MIT
|
|
@@ -195,14 +204,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
195
204
|
requirements:
|
|
196
205
|
- - ">="
|
|
197
206
|
- !ruby/object:Gem::Version
|
|
198
|
-
version:
|
|
207
|
+
version: 3.0.0
|
|
199
208
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
200
209
|
requirements:
|
|
201
210
|
- - ">="
|
|
202
211
|
- !ruby/object:Gem::Version
|
|
203
212
|
version: '0'
|
|
204
213
|
requirements: []
|
|
205
|
-
rubygems_version: 3.
|
|
214
|
+
rubygems_version: 3.2.22
|
|
206
215
|
signing_key:
|
|
207
216
|
specification_version: 4
|
|
208
217
|
summary: PDF library for Renalware forms
|