Sha256: 3c876eaefca3722799bd4beaab9c548938904eac42e72b878630132d0362cf90

Contents?: true

Size: 1.01 KB

Versions: 41

Compression:

Stored size: 1.01 KB

Contents

require_relative '../lib/inline_svg/finds_asset_paths'
require_relative '../lib/inline_svg/asset_file'

describe InlineSvg::AssetFile do
  it "reads data from a file, after qualifying a full path" do
    example_svg_path = File.expand_path(__FILE__, 'files/example.svg')
    expect(InlineSvg::FindsAssetPaths).to receive(:by_filename).with('some filename').and_return example_svg_path

    expect(InlineSvg::AssetFile.named('some filename')).to include('This is a test')
  end

  it "complains when the file cannot be read" do
    allow(InlineSvg::FindsAssetPaths).to receive(:by_filename).and_return('/this/path/does/not/exist')

    expect do
      InlineSvg::AssetFile.named('some missing file')
    end.to raise_error InlineSvg::AssetFile::FileNotFound
  end

  it "complains when the file path was not found" do
    allow(InlineSvg::FindsAssetPaths).to receive(:by_filename).and_return(nil)

    expect do
      InlineSvg::AssetFile.named('some missing file')
    end.to raise_error InlineSvg::AssetFile::FileNotFound
  end
end

Version data entries

41 entries across 41 versions & 2 rubygems

Version Path
inline_svg-1.10.0 spec/asset_file_spec.rb
inline_svg-1.9.0 spec/asset_file_spec.rb
inline_svg-1.8.0 spec/asset_file_spec.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/inline_svg-1.7.2/spec/asset_file_spec.rb
inline_svg-1.7.2 spec/asset_file_spec.rb
inline_svg-1.7.1 spec/asset_file_spec.rb
inline_svg-1.7.0 spec/asset_file_spec.rb
inline_svg-1.6.0 spec/asset_file_spec.rb
inline_svg-1.5.2 spec/asset_file_spec.rb
inline_svg-1.5.1 spec/asset_file_spec.rb
inline_svg-1.5.0 spec/asset_file_spec.rb
inline_svg-1.4.0 spec/asset_file_spec.rb
inline_svg-1.3.1 spec/asset_file_spec.rb
inline_svg-1.3.0 spec/asset_file_spec.rb
inline_svg-1.2.3 spec/asset_file_spec.rb
inline_svg-1.2.2 spec/asset_file_spec.rb
inline_svg-1.2.1 spec/asset_file_spec.rb
inline_svg-1.2.0 spec/asset_file_spec.rb
inline_svg-1.1.0 spec/asset_file_spec.rb
inline_svg-1.0.1 spec/asset_file_spec.rb