Module: LoadTest
- Defined in:
- rakelib/support/vic_load_test.rb
Class Method Summary collapse
- .conn(host, route) ⇒ Object
- .doc_pdf_payload ⇒ Object
- .doc_png_payload ⇒ Object
- .measure_elapsed ⇒ Object
- .photo_payload ⇒ Object
Class Method Details
.conn(host, route) ⇒ Object
18 19 20 21 22 23 24 |
# File 'rakelib/support/vic_load_test.rb', line 18 def conn(host, route) Faraday.new("#{host}/v0/vic/#{route}") do |c| c.request :multipart c.request :url_encoded c.adapter Faraday.default_adapter end end |
.doc_pdf_payload ⇒ Object
48 49 50 51 52 53 54 55 56 57 |
# File 'rakelib/support/vic_load_test.rb', line 48 def doc_pdf_payload { supporting_documentation_attachment: { file_data: Faraday::UploadIO.new( Rails.root.join('rakelib', 'support', 'files', 'example_25mb.pdf').to_s, 'image/png' ) } } end |
.doc_png_payload ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'rakelib/support/vic_load_test.rb', line 37 def doc_png_payload { supporting_documentation_attachment: { file_data: Faraday::UploadIO.new( Rails.root.join('rakelib', 'support', 'files', 'example_10mb.png').to_s, 'image/png' ) } } end |
.measure_elapsed ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'rakelib/support/vic_load_test.rb', line 6 def measure_elapsed t0 = Time.zone.now yield t1 = Time.zone.now elapsed = t1 - t0 puts puts "Start: #{t0}" puts "End: #{t1}" puts "Elapsed: #{elapsed.round(2)} seconds" end |
.photo_payload ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'rakelib/support/vic_load_test.rb', line 26 def photo_payload { profile_photo_attachment: { file_data: Faraday::UploadIO.new( Rails.root.join('rakelib', 'support', 'files', 'example_10mb.png').to_s, 'image/png' ) } } end |