Sha256: c77ef22ec0261d97ed5e2c6d6d527855c9b6d7c39b19e11cfdada61f3fcd49f7
Contents?: true
Size: 1.8 KB
Versions: 4
Compression:
Stored size: 1.8 KB
Contents
# encoding: utf-8 require 'spec_helper' describe GitRepository do context '#initialize' do it 'requires a storage path' do file_creator = double('file_creator') null_file = double('null_file') Rugged::Repository.init_at(File.join(working_directory, 'git_repo')) expect { GitRepository.new(File.join(working_directory, 'git_repo'), file_creator, null_file) }.not_to raise_error end end context '#find_file' do it 'returns a file if exists in repository' do repo_path = File.join(working_directory, 'git_repo') Rugged::Repository.init_at(repo_path) file = double('file') allow(file).to receive(:name).and_return(:file) file_creator = double('file_creator') allow(file_creator).to receive(:new).with('file.txt', 'asdf').and_return(file) null_file = double('null_file') repo = GitRepository.new(repo_path, file_creator, null_file) repo.add_content('file.txt', 'asdf') f = repo.find_file(:file) expect(f).to be(file) end it 'returns a null file if does not exist in repository' do repo_path = File.join(working_directory, 'git_repo') Rugged::Repository.init_at(repo_path) file_creator = double('file_creator') null_file = double('null_file') repo = GitRepository.new(repo_path, file_creator, null_file) f = repo.find_file(:file) expect(f).to be(null_file) end it 'handles uninitialized repositories' do repo_path = File.join(working_directory, 'git_repo') Rugged::Repository.init_at(repo_path) file_creator = double('file_creator') null_file = double('null_file') repo = GitRepository.new(repo_path, file_creator, null_file) f = repo.find_file(:file) expect(f).to be(null_file) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
local_pac-0.3.0 | spec/git_repository_spec.rb |
local_pac-0.2.3 | spec/git_repository_spec.rb |
local_pac-0.2.2 | spec/git_repository_spec.rb |
local_pac-0.2.1 | spec/git_repository_spec.rb |