# 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