Sha256: 1be0a25463d0b9261deece216c25c53d7524307947042b775b8709ac91ba7357

Contents?: true

Size: 804 Bytes

Versions: 3

Compression:

Stored size: 804 Bytes

Contents

require 'spec_helper'

describe Rpub::Commands::Package do
  before do
    Dir.chdir File.join(FIXTURES_DIRECTORY, 'package')
  end

  after do
    File.unlink('package.zip') if File.exist?('package.zip')
    File.unlink('untitled-book-0.0.0.epub') if File.exist?('untitled-book-0.0.0.epub')
  end

  it 'should generate an archive' do
    expect(&subject.method(:invoke)).to create_file('package.zip')
  end

  context 'archive file' do
    before { described_class.new.invoke }

    let(:subject) do
      [].tap do |files|
        Zip::ZipInputStream.open('package.zip') do |io|
          while entry = io.get_next_entry
            files << entry.name
          end
        end
      end
    end

    it { should include('README.md') }
    it { should include('untitled-book-0.0.0.epub') }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rpub-0.4.0 spec/rpub/commands/package_spec.rb
rpub-0.3.0 spec/rpub/commands/package_spec.rb
rpub-0.2.1 spec/rpub/commands/package_spec.rb