add spec
This commit is contained in:
@@ -47,13 +47,22 @@ describe GenerateContractsZipJob do
|
|||||||
csv_file_name = "#{project.name.parameterize}_#{lowercase_plural.gsub('_', '-')}.csv"
|
csv_file_name = "#{project.name.parameterize}_#{lowercase_plural.gsub('_', '-')}.csv"
|
||||||
Zip::InputStream.open(StringIO.new(generated_zip)) do |io|
|
Zip::InputStream.open(StringIO.new(generated_zip)) do |io|
|
||||||
while entry = io.get_next_entry
|
while entry = io.get_next_entry
|
||||||
if entry.name == csv_file_name
|
next unless entry.name == csv_file_name
|
||||||
csv_file = entry.get_input_stream.read
|
|
||||||
release_class = Object.const_get @release_type
|
csv_file = entry.get_input_stream.read
|
||||||
headers = release_class.csv_headers
|
|
||||||
puts headers
|
release_class = Object.const_get type
|
||||||
|
release_headers = release_class.csv_headers
|
||||||
|
|
||||||
|
release_headers.each do |header|
|
||||||
|
expect(csv_file).to match header
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
dummy_zip_file_name = "#{project.name.parameterize}_#{lowercase_plural.gsub('_', '-')}.zip"
|
||||||
|
if File.exist?(file_fixture(dummy_zip_file_name))
|
||||||
|
File.delete(file_fixture(dummy_zip_file_name))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -82,7 +91,9 @@ describe GenerateContractsZipJob do
|
|||||||
# Delete the file created in fixture.
|
# Delete the file created in fixture.
|
||||||
# Or the tests will fail on next run due to already existing files in existing zip.
|
# Or the tests will fail on next run due to already existing files in existing zip.
|
||||||
path = Rails.root.join("spec", "fixtures", "files")
|
path = Rails.root.join("spec", "fixtures", "files")
|
||||||
File.delete("#{path}/my-video-project_appearance-releases.zip") if File.exists? "#{path}/my-video-project_appearance-releases.zip"
|
if File.exists? "#{path}/my-video-project_appearance-releases.zip"
|
||||||
|
File.delete("#{path}/my-video-project_appearance-releases.zip")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
Reference in New Issue
Block a user