Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes wrapping spec #74

Merged
merged 3 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion lib/phi_attrs/exceptions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class PhiAccessException < StandardError

def initialize(msg)
PhiAttrs::Logger.tagged(TAG) { PhiAttrs::Logger.error(msg) }
super(msg)
super
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/phi_attrs/phi_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions phi_attrs.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/app/models/missing_attribute_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

class MissingAttributeModel < ApplicationRecord
phi_model
phi_include_methods :non_existent_method
include_in_phi :non_existent_method
end
4 changes: 1 addition & 3 deletions spec/dummy/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
4 changes: 2 additions & 2 deletions spec/dummy/db/migrate/20170214100255_create_patient_infos.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 10 additions & 0 deletions spec/dummy/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down