Skip to content

Commit

Permalink
Bump coverage to 100%
Browse files Browse the repository at this point in the history
Fixes #6
  • Loading branch information
janosrusiczki committed Dec 7, 2017
1 parent 254cb94 commit 8aa0505
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion spec/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

it 'saves assets to staging path' do
$stdout.stub(:puts, nil) do
config['output_path'] = 'foobar_assets'
config['output_path'] = '/foobar_assets'
pipeline, = Pipeline.run(manifest, prefix, source_path, temp_path,
tag_name, extension, config)
pipeline.assets.each do |asset|
Expand Down Expand Up @@ -417,5 +417,35 @@ def convert
Converter.subclasses.delete(BazConverter)
Object::JAPR.send(:remove_const, :BazConverter)
end

it 'outputs error message if failure to collect asset' do
# File.open is first used in the flow in Pipeline.collect
# The exception checking in Pipeline.collect is actually a bit of overkill
# Pipeline.hash (which happens before in the flow) should catch if a
# manifest file can not be opened
File.stub(:open, -> { raise Exception }) do
manifest = '- /_assets/unconverted.baz'
proc do
proc do
Pipeline.run(manifest, prefix, source_path, temp_path, tag_name,
extension, config)
end.must_raise(Exception)
end.must_output(/failed/i)
end
end

it 'outputs error message if failure to write asset file' do
# FileUtils.mkpath is first used in the flow in Pipeline.write_asset_file
FileUtils.stub(:mkpath, nil) do
config['staging_path'] = 'we_probably_cant_write_here'
manifest = '- /_assets/unconverted.baz'
proc do
proc do
Pipeline.run(manifest, prefix, source_path, temp_path, tag_name,
extension, config)
end.must_raise(Exception)
end.must_output(/failed/i)
end
end
end
end

0 comments on commit 8aa0505

Please sign in to comment.