Skip to content
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
2 changes: 1 addition & 1 deletion app/queries/event_procedures/by_date_between.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def initialize(start_date:, end_date:)
end

def call
EventProcedure.where("date >= ? AND date <= ?", start_date, end_date)
EventProcedure.where(date: start_date..end_date)
end
end
end
2 changes: 2 additions & 0 deletions config/initializers/administrate.rb
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# frozen_string_literal: true

Administrate::Engine.add_stylesheet("custom.css")
2 changes: 1 addition & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

if Rails.env.development?
Rails.logger.debug "Seeding data..."
Dir[Rails.root.join("db/seeds/*.rb")].each do |seed|
Rails.root.glob("db/seeds/*.rb").each do |seed|
load seed
end
else
Expand Down
2 changes: 1 addition & 1 deletion lib/scripts/persist_procedures.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def fail_message(code, error)
end

def procedures_persisted
@procedures_persisted ||= Procedure.all.pluck(:code)
@procedures_persisted ||= Procedure.pluck(:code)
end

def puts_message(message)
Expand Down
16 changes: 8 additions & 8 deletions spec/models/event_procedure_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,25 +72,25 @@
end
end

context 'when patient belongs to a different user' do
it 'is invalid when patient and event_procedure have different users' do
context "when patient belongs to a different user" do
it "is invalid when patient and event_procedure have different users" do
user = create(:user)
other_user = create(:user)
patient = create(:patient, user: other_user)

event_procedure = build(:event_procedure, user: user, patient: patient)

expect(event_procedure).not_to be_valid
expect(event_procedure.errors[:base]).to include("The patient must be associated with the same procedure user")
end
end
context 'when patient belongs to the same user' do
it 'is valid when patient and event_procedure have the same user' do

context "when patient belongs to the same user" do
it "is valid when patient and event_procedure have the same user" do
user = create(:user)
patient = create(:patient, user: user)
event_procedure = build(:event_procedure, user: user, patient: patient)

expect(event_procedure).to be_valid
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/policies/hospital_policy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
RSpec.describe HospitalPolicy do
let(:user) { create(:user) }
let(:hospital) { create(:hospital) }

describe "permissions" do
context "when has user" do
subject { described_class.new(user, hospital)}
subject { described_class.new(user, hospital) }

it { is_expected.to permit_actions(%i[index create update destroy]) }
end

context "when has no user" do
subject { described_class.new(nil, hospital)}
subject { described_class.new(nil, hospital) }

it { is_expected.to forbid_actions(%i[index create update destroy]) }
end
Expand Down
4 changes: 2 additions & 2 deletions spec/policies/user_policy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

describe "permissions" do
context "when user is admin" do
subject {described_class.new(admin, user)}
subject { described_class.new(admin, user) }

it { is_expected.to permit_actions(%i[index]) }
end

context "when user is not admin" do
subject {described_class.new(user, user)}
subject { described_class.new(user, user) }

it { is_expected.to forbid_actions(%i[index]) }
end
Expand Down
2 changes: 1 addition & 1 deletion spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@
config.filter_rails_from_backtrace!
# arbitrary gems may also be filtered via:
# config.filter_gems_from_backtrace("gem name")
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
Rails.root.glob("spec/support/**/*.rb").each { |f| require f }
end
Loading