Sha256: 0b77aabc54f3d58cd167dd2ef431843e74cc76d724208e3166b42b346e91265b
Contents?: true
Size: 1.6 KB
Versions: 18
Compression:
Stored size: 1.6 KB
Contents
# encoding: utf-8 require 'spec_helper' describe LocalStorage do let(:valid_pac_file) do <<-EOS.strip_heredoc function FindProxyForURL(url, host) { return "DIRECT" } EOS end context '#initialize' do it 'initializes storage' do file = double('File') allow(file).to receive(:name).and_return(:file1) repo = double('GitRepository') expect(repo).to receive(:[]).and_return(file) storage = LocalStorage.new(repo) file = storage.find('file1') expect(file.name).to eq(:file1) end context '#find' do it 'returns file if exists' do file = double('GitFile') allow(file).to receive(:name).and_return(:file1) repo = double('GitRepository') expect(repo).to receive(:[]).and_return(file) storage = LocalStorage.new(repo) file = storage.find('file1') expect(file.name).to eq(:file1) end it 'returns file for pac in subdir' do file = double('GitFile') allow(file).to receive(:name).and_return(:'dir::file1') repo = double('GitRepository') expect(repo).to receive(:[]).and_return(file) storage = LocalStorage.new(repo) file = storage.find('dir/file1') expect(file.name).to eq(:'dir::file1') end it 'returns null file if does not exist' do repo = double('GitRepository') expect(repo).to receive(:[]).and_return(nil) storage = LocalStorage.new(repo) expect(storage.find('unexist')).to be_nil end end end end
Version data entries
18 entries across 18 versions & 1 rubygems