Skip to content

Commit 7f6bd87

Browse files
authored
Fixes wrapping spec (#74)
* fix method wrapping spec and initial setup * rubocop fixes * http to https
1 parent 9f98207 commit 7f6bd87

File tree

10 files changed

+24
-15
lines changed

10 files changed

+24
-15
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ It is recommended to use the provided `docker-compose` environment for developme
430430

431431
### Tests
432432

433-
Tests are written using [RSpec](http://rspec.info/) and are setup to use [Appraisal](https://github.com/thoughtbot/appraisal) to run tests over multiple rails versions.
433+
Tests are written using [RSpec](https://rspec.info/) and are setup to use [Appraisal](https://github.com/thoughtbot/appraisal) to run tests over multiple rails versions.
434434

435435
$ bin/run_tests
436436
or for individual tests:
@@ -439,7 +439,7 @@ Tests are written using [RSpec](http://rspec.info/) and are setup to use [Apprai
439439

440440
To run just a particular rails version:
441441
$ bundle exec appraisal rails_6.1 rspec
442-
$ bundle exec appraisal rails-7.0 rspec
442+
$ bundle exec appraisal rails_7.0 rspec
443443

444444
### Console
445445

bin/setup

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ gem install bundler -v $BUNDLER_VERSION
77

88
bundle check || bundle install
99
bundle exec appraisal install
10+
bundle exec appraisal rake dummy:db:drop dummy:db:create dummy:db:migrate

lib/phi_attrs/exceptions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class PhiAccessException < StandardError
77

88
def initialize(msg)
99
PhiAttrs::Logger.tagged(TAG) { PhiAttrs::Logger.error(msg) }
10-
super(msg)
10+
super
1111
end
1212
end
1313
end

lib/phi_attrs/phi_record.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ def set_all_phi_context_logged
625625
#
626626
def phi_wrap_method(method_name)
627627
unless respond_to?(method_name)
628-
PhiAttrs::Logger.warn("#{self.class.name} tried to wrap non-existant method (#{method_name})")
628+
PhiAttrs::Logger.warn("#{self.class.name} tried to wrap non-existent method (#{method_name})")
629629
return
630630
end
631631
return if self.class.__phi_methods_wrapped.include? method_name

phi_attrs.gemspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ Gem::Specification.new do |spec|
1111
spec.email = ['[email protected]']
1212

1313
spec.summary = 'PHI Access Restriction & Logging for Rails ActiveRecord'
14-
spec.homepage = 'http://www.apsis.io'
14+
spec.homepage = 'https://www.apsis.io'
1515
spec.license = 'MIT'
1616
spec.post_install_message = '
1717
Thank you for installing phi_attrs! By installing this gem,
1818
you acknowledge and agree to the disclaimer as provided in the
1919
DISCLAIMER.txt file.
2020
21-
For full details, see: https://github.com/apsislabs/phi_attrs/blob/master/DISCLAIMER.txt
21+
For full details, see: https://github.com/apsislabs/phi_attrs/blob/main/DISCLAIMER.txt
2222
'
2323

2424
spec.required_ruby_version = '>= 2.7.0'
@@ -29,8 +29,8 @@ Gem::Specification.new do |spec|
2929
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
3030
spec.require_paths = ['lib']
3131

32-
spec.add_runtime_dependency 'rails', '>= 6.0.0'
33-
spec.add_runtime_dependency 'request_store', '~> 1.4'
32+
spec.add_dependency 'rails', '>= 6.0.0'
33+
spec.add_dependency 'request_store', '~> 1.4'
3434

3535
spec.add_development_dependency 'appraisal'
3636
spec.add_development_dependency 'bundler', '>= 2.2.33'

spec/dummy/app/models/missing_attribute_model.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
class MissingAttributeModel < ApplicationRecord
44
phi_model
5-
phi_include_methods :non_existent_method
5+
include_in_phi :non_existent_method
66
end

spec/dummy/application.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ class Application < Rails::Application
2323
config.paths['log'] = 'tmp/log/development.log'
2424
config.paths.add 'config/routes.rb', with: "#{APP_ROOT}/config/routes.rb"
2525

26-
if Rails.version.match?(/^6.0/)
27-
config.active_record.sqlite3.represent_boolean_as_integer = true
28-
end
26+
config.active_record.sqlite3.represent_boolean_as_integer = true if Rails.version.match?(/^6.0/)
2927

3028
def require_environment!
3129
initialize!

spec/dummy/db/migrate/20170214100255_create_patient_infos.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ def change
2525
t.string :data
2626
end
2727

28-
create_table :missing_attribute_model, &:timestamps
28+
create_table :missing_attribute_models, &:timestamps
2929

30-
create_table :missing_extend_model, &:timestamps
30+
create_table :missing_extend_models, &:timestamps
3131
end
3232
end

spec/dummy/db/schema.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@
2323
t.index ["patient_info_id"], name: "index_health_records_on_patient_info_id"
2424
end
2525

26+
create_table "missing_attribute_models", force: :cascade do |t|
27+
t.datetime "created_at", precision: nil, null: false
28+
t.datetime "updated_at", precision: nil, null: false
29+
end
30+
31+
create_table "missing_extend_models", force: :cascade do |t|
32+
t.datetime "created_at", precision: nil, null: false
33+
t.datetime "updated_at", precision: nil, null: false
34+
end
35+
2636
create_table "patient_details", force: :cascade do |t|
2737
t.integer "patient_info_id"
2838
t.string "detail"

spec/phi_attrs/phi_record/phi_wrapping.rb renamed to spec/phi_attrs/phi_record/phi_wrapping_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
let(:missing_attribute_model) { build(:missing_attribute_model) }
77
let(:missing_extend_model) { build(:missing_extend_model) }
88

9-
context 'non existant attributes' do
9+
context 'non existent attributes' do
1010
it 'wrapping a method' do
1111
expect { missing_attribute_model }.not_to raise_error
1212
end

0 commit comments

Comments
 (0)