Sha256: 06367adeed3739754675224d98cd61792a8f694407bf36a7b9e782e26854aa08

Contents?: true

Size: 1012 Bytes

Versions: 2

Compression:

Stored size: 1012 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

describe "exe/w2a" do
  subject(:convert) do
    ShellUtils.execute!("./exe/w2a -e -o test1 #{input_file_path}")
  end

  # TODO: fix github actions integration with libreoffice, currently it hangs
  # when trying to use soffice binary
  unless Gem.win_platform? ||
      (Gem::Platform.local.os == "darwin" && !ENV["GITHUB_ACTION"].nil?)
    context "when external images present" do
      let(:input_file_path) { "spec/assets/external_images.docx" }
      let(:images_folder) { "images" }

      after do
        FileUtils.rm_rf(images_folder) if File.directory?(images_folder)
      end

      it "Does not raise error" do
        expect { convert }.to_not raise_error
      end

      it "extracts images from source html" do
        expect { convert }
          .to(change do
                !Dir["#{images_folder}/*gif"]
                  .map { |entry| File.basename(entry) }.empty?
              end.from(false).to(true))
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reverse_adoc-1.0.1 spec/bin/w2a_spec.rb
reverse_adoc-1.0.0 spec/bin/w2a_spec.rb