diff --git a/README.md b/README.md index 7db7cce..3c661f5 100644 --- a/README.md +++ b/README.md @@ -430,7 +430,7 @@ It is recommended to use the provided `docker-compose` environment for developme ### Tests -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. +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. $ bin/run_tests or for individual tests: @@ -439,7 +439,7 @@ Tests are written using [RSpec](http://rspec.info/) and are setup to use [Apprai To run just a particular rails version: $ bundle exec appraisal rails_6.1 rspec - $ bundle exec appraisal rails-7.0 rspec + $ bundle exec appraisal rails_7.0 rspec ### Console diff --git a/bin/setup b/bin/setup index c48301b..55e542a 100755 --- a/bin/setup +++ b/bin/setup @@ -7,3 +7,4 @@ gem install bundler -v $BUNDLER_VERSION bundle check || bundle install bundle exec appraisal install +bundle exec appraisal rake dummy:db:drop dummy:db:create dummy:db:migrate diff --git a/lib/phi_attrs/exceptions.rb b/lib/phi_attrs/exceptions.rb index 85ef3b2..aa087d9 100644 --- a/lib/phi_attrs/exceptions.rb +++ b/lib/phi_attrs/exceptions.rb @@ -7,7 +7,7 @@ class PhiAccessException < StandardError def initialize(msg) PhiAttrs::Logger.tagged(TAG) { PhiAttrs::Logger.error(msg) } - super(msg) + super end end end diff --git a/lib/phi_attrs/phi_record.rb b/lib/phi_attrs/phi_record.rb index c73cd53..46d6e1a 100644 --- a/lib/phi_attrs/phi_record.rb +++ b/lib/phi_attrs/phi_record.rb @@ -625,7 +625,7 @@ def set_all_phi_context_logged # def phi_wrap_method(method_name) unless respond_to?(method_name) - PhiAttrs::Logger.warn("#{self.class.name} tried to wrap non-existant method (#{method_name})") + PhiAttrs::Logger.warn("#{self.class.name} tried to wrap non-existent method (#{method_name})") return end return if self.class.__phi_methods_wrapped.include? method_name diff --git a/phi_attrs.gemspec b/phi_attrs.gemspec index f9ed81f..12d4cd2 100644 --- a/phi_attrs.gemspec +++ b/phi_attrs.gemspec @@ -11,14 +11,14 @@ Gem::Specification.new do |spec| spec.email = ['wyatt@apsis.io'] spec.summary = 'PHI Access Restriction & Logging for Rails ActiveRecord' - spec.homepage = 'http://www.apsis.io' + spec.homepage = 'https://www.apsis.io' spec.license = 'MIT' spec.post_install_message = ' Thank you for installing phi_attrs! By installing this gem, you acknowledge and agree to the disclaimer as provided in the DISCLAIMER.txt file. - For full details, see: https://github.com/apsislabs/phi_attrs/blob/master/DISCLAIMER.txt + For full details, see: https://github.com/apsislabs/phi_attrs/blob/main/DISCLAIMER.txt ' spec.required_ruby_version = '>= 2.7.0' @@ -29,8 +29,8 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ['lib'] - spec.add_runtime_dependency 'rails', '>= 6.0.0' - spec.add_runtime_dependency 'request_store', '~> 1.4' + spec.add_dependency 'rails', '>= 6.0.0' + spec.add_dependency 'request_store', '~> 1.4' spec.add_development_dependency 'appraisal' spec.add_development_dependency 'bundler', '>= 2.2.33' diff --git a/spec/dummy/app/models/missing_attribute_model.rb b/spec/dummy/app/models/missing_attribute_model.rb index 452f5b0..41b83f0 100644 --- a/spec/dummy/app/models/missing_attribute_model.rb +++ b/spec/dummy/app/models/missing_attribute_model.rb @@ -2,5 +2,5 @@ class MissingAttributeModel < ApplicationRecord phi_model - phi_include_methods :non_existent_method + include_in_phi :non_existent_method end diff --git a/spec/dummy/application.rb b/spec/dummy/application.rb index 9e971d6..3673445 100644 --- a/spec/dummy/application.rb +++ b/spec/dummy/application.rb @@ -23,9 +23,7 @@ class Application < Rails::Application config.paths['log'] = 'tmp/log/development.log' config.paths.add 'config/routes.rb', with: "#{APP_ROOT}/config/routes.rb" - if Rails.version.match?(/^6.0/) - config.active_record.sqlite3.represent_boolean_as_integer = true - end + config.active_record.sqlite3.represent_boolean_as_integer = true if Rails.version.match?(/^6.0/) def require_environment! initialize! diff --git a/spec/dummy/db/migrate/20170214100255_create_patient_infos.rb b/spec/dummy/db/migrate/20170214100255_create_patient_infos.rb index 5e3315d..d9abdd3 100644 --- a/spec/dummy/db/migrate/20170214100255_create_patient_infos.rb +++ b/spec/dummy/db/migrate/20170214100255_create_patient_infos.rb @@ -25,8 +25,8 @@ def change t.string :data end - create_table :missing_attribute_model, &:timestamps + create_table :missing_attribute_models, &:timestamps - create_table :missing_extend_model, &:timestamps + create_table :missing_extend_models, &:timestamps end end diff --git a/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb index 32bfe61..4f49904 100755 --- a/spec/dummy/db/schema.rb +++ b/spec/dummy/db/schema.rb @@ -23,6 +23,16 @@ t.index ["patient_info_id"], name: "index_health_records_on_patient_info_id" end + create_table "missing_attribute_models", force: :cascade do |t| + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false + end + + create_table "missing_extend_models", force: :cascade do |t| + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false + end + create_table "patient_details", force: :cascade do |t| t.integer "patient_info_id" t.string "detail" diff --git a/spec/phi_attrs/phi_record/phi_wrapping.rb b/spec/phi_attrs/phi_record/phi_wrapping_spec.rb similarity index 91% rename from spec/phi_attrs/phi_record/phi_wrapping.rb rename to spec/phi_attrs/phi_record/phi_wrapping_spec.rb index d503f2e..f2a6dae 100644 --- a/spec/phi_attrs/phi_record/phi_wrapping.rb +++ b/spec/phi_attrs/phi_record/phi_wrapping_spec.rb @@ -6,7 +6,7 @@ let(:missing_attribute_model) { build(:missing_attribute_model) } let(:missing_extend_model) { build(:missing_extend_model) } - context 'non existant attributes' do + context 'non existent attributes' do it 'wrapping a method' do expect { missing_attribute_model }.not_to raise_error end