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
8 changes: 0 additions & 8 deletions app/controllers/api/v1/event_procedures_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,6 @@ def serialized_event_procedures(event_procedures)
each_serializer: EventProcedureSerializer
)
end

def total_amount_cents_params
{
user_id: current_user.id,
month: params[:month],
year: params[:year]
}
end
end
end
end
8 changes: 0 additions & 8 deletions app/controllers/api/v1/pdf_reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,6 @@ def permitted_query_params
health_insurance: [:name]
).to_h
end

def total_amount_cents_params
{
user_id: current_user.id,
month: permitted_query_params[:month],
year: permitted_query_params[:year]
}
end
end
end
end
4 changes: 0 additions & 4 deletions app/pdfs/header_pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ def header_spacing
pdf.move_down 50
end

def title_font_size
20
end

def header_current_date
pdf.text "Data: #{Time.zone.now.strftime('%d/%m/%Y')}", align: :right, size: @header_font_size
end
Expand Down
14 changes: 5 additions & 9 deletions db/seeds/02_procedures_default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,13 @@

batch_files = Rails.root.glob("lib/data/procedures/batch_*.json")

if batch_files.empty?
Rails.logger.debug "No JSON files found."
else
batch_files.each do |batch_file|
next unless File.exist?(batch_file)
batch_files.each do |batch_file|
next unless File.exist?(batch_file)

Rails.logger.debug { "Importing #{batch_file}" }
Rails.logger.debug { "Importing #{batch_file}" }

Rake::Task["procedures:persist_in_database"].invoke(batch_file)
Rake::Task["procedures:persist_in_database"].reenable
end
Rake::Task["procedures:persist_in_database"].invoke(batch_file)
Rake::Task["procedures:persist_in_database"].reenable
end

Rails.logger.debug { "Created #{batch_files.count} default Procedures!" }
2 changes: 1 addition & 1 deletion spec/pdfs/medical_shifts_report_pdf_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
it "generates a report with the correct content" do
user = create(:user)
pdf = Prawn::Document.new
medical_shifts = create_list(:medical_shift, 3, user_id: user.id)
medical_shifts = create_list(:medical_shift, 20, user_id: user.id)
amount = MedicalShifts::TotalAmountCents.call(medical_shifts: medical_shifts)

described_class.new(pdf: pdf, amount: amount, items: medical_shifts, title: "Plantões", email: user.email).generate
Expand Down
17 changes: 17 additions & 0 deletions spec/requests/api/v1/patients_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,23 @@
)
end
end

context "when theres an error on destroy" do
it "returns unprocessable_content" do
patient = create(:patient, user: user)

result_object = Struct.new(:success?, :error).new(
false,
{ error: "Error message." }
)

allow(Patients::Destroy).to receive(:result).with(id: patient.id.to_s).and_return(result_object)

delete "/api/v1/patients/#{patient.id}", headers: headers

expect(response).to have_http_status(:unprocessable_content)
end
end
end

include_context "when user is not authenticated"
Expand Down
Loading