Sha256: 9573c99b5225fc6c8afd81daed84cbbac8f2be51b80d929b733897b090766137

Contents?: true

Size: 1.22 KB

Versions: 15

Compression:

Stored size: 1.22 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe LocalPac::File do
  context 'initialize' do
    it 'requires a path' do
      expect {
        LocalPac::File.new('dir/path.pac')
      }.not_to raise_error
    end

    it 'accepts content' do
      expect {
        LocalPac::File.new('dir/path.pac', 'content')
      }.not_to raise_error
    end
  end

  context '#name' do
    it 'has a name' do
      file = LocalPac::File.new('file.txt')
      expect(file.name).to eq(:file)
    end
  end

  context '#extension?' do
    it 'checks if extension is the same' do
      file = LocalPac::File.new('path.pac')
      expect(file).to be_extension('.pac')
    end
  end

  context '#content' do
    it 'returns the content of file' do
      file = LocalPac::File.new('file.pac', 'content')
      expect(file.content).to eq('content')
    end
  end

  context '#nil?' do
    it 'is always false' do
      file = LocalPac::File.new('file.pac')
      expect(file.nil?).to be_false
    end
  end

  context '#compressed_content' do
    it 'uses an external handler to compress content' do
      handler = double('handler')
      expect(handler).to receive(:prepare)

      file = LocalPac::File.new('file.pac')
      file.prepare(handler)
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
local_pac-0.10.2 spec/file_spec.rb
local_pac-0.10.1 spec/file_spec.rb
local_pac-0.10.0 spec/file_spec.rb
local_pac-0.9.0 spec/file_spec.rb
local_pac-0.7.0 spec/file_spec.rb
local_pac-0.6.3 spec/file_spec.rb
local_pac-0.6.2 spec/file_spec.rb
local_pac-0.6.1 spec/file_spec.rb
local_pac-0.5.0 spec/file_spec.rb
local_pac-0.4.0 spec/file_spec.rb
local_pac-0.3.0 spec/file_spec.rb
local_pac-0.2.3 spec/file_spec.rb
local_pac-0.2.2 spec/file_spec.rb
local_pac-0.2.1 spec/file_spec.rb
local_pac-0.2.0 spec/file_spec.rb