Skip to content

Commit

Permalink
Add example for both input_format and format given
Browse files Browse the repository at this point in the history
  • Loading branch information
moozzi committed Apr 27, 2024
1 parent 037b535 commit c674211
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
13 changes: 12 additions & 1 deletion spec/converter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
end

context 'when format is given' do
it 'must ignore file extension and convert it to given format' do
it 'must ignore file extension and convert it to the given format' do
Tempfile.create(tempfile) do |output_file|
subject.convert_file(masscan_path, output_file, format: :csv)
output_file.rewind
Expand All @@ -75,6 +75,17 @@
end
end
end

context 'when input_format and format are given' do
it 'must set input file format explicitly and convert it to the given format' do
Tempfile.create(tempfile) do |output_file|
subject.convert_file(masscan_path, output_file, input_format: :json, format: :csv)
output_file.rewind

expect(output_file.read).to eq(expected_csv)
end
end
end
end

describe '.convert' do
Expand Down
3 changes: 3 additions & 0 deletions spec/fixtures/converter/input.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type,status.status,status.protocol,status.port,status.reason,status.ttl,status.ip,status.timestamp,banner.protocol,banner.port,banner.ip,banner.timestamp,banner.app_protocol,banner.payload
status,open,tcp,80,"syn,ack",54,93.184.216.34,2021-08-26 08:50:21 +0200
banner,,,,,,,,tcp,80,93.184.216.34,2021-08-26 08:50:21 +0200,html_title,404 - Not Found
3 changes: 0 additions & 3 deletions spec/fixtures/converter/masscan.json

This file was deleted.

0 comments on commit c674211

Please sign in to comment.