Skip to content

Commit

Permalink
WIP (#93)
Browse files Browse the repository at this point in the history
Co-authored-by: Andreas Robecke <[email protected]>
Co-authored-by: Shalvah Adebayo <[email protected]>
  • Loading branch information
3 people committed May 30, 2022
1 parent d2e28b7 commit 4bc3ae7
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ GEM
PLATFORMS
ruby
x86_64-darwin-19
x86_64-darwin-20
x86_64-linux

DEPENDENCIES
Expand Down
28 changes: 28 additions & 0 deletions spec/file_upload_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
RSpec.describe 'upload' do
let(:destination) { 'https://ptsv2.com/t/nxt_http_client/post' }

let(:client) do
Class.new(NxtHttpClient::Client) do
response_handler do |handler|
handler.on(200) { |response| response }
end
end
end

let(:file_path) { File.expand_path('support/test_file.txt', File.dirname(__FILE__)) }
let(:file_1) { File.open(file_path, "r") }
let(:file_2) { File.open(file_path, "r") }

subject do
client.new
end

it 'uploads the files', :vcr_cassette do
result = subject.post(
destination,
body: { file_1: file_1, file_2: file_2 }
)

expect(result).to be_success
end
end

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions spec/support/test_file.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is just some text that should be uploaded somewhere

0 comments on commit 4bc3ae7

Please sign in to comment.