Sha256: b73685b6cdc339f61ff8347a6a1d840dc7a6f8350decb34c7831f20bf5ba0252
Contents?: true
Size: 1.51 KB
Versions: 1
Compression:
Stored size: 1.51 KB
Contents
# encoding: UTF-8 require 'spec_helper' include Rosette::Core::Commands describe FetchCommand do let(:source_repo) { TmpRepo.new } let(:dest_repo) { TmpRepo.new } let(:repo_name) { 'my_repo' } let(:configuration) do Rosette.build_config do |config| config.add_repo(repo_name) do |repo_config| repo_config.set_path(dest_repo.working_dir.join('.git').to_s) end end end let(:command) do Rosette::Core::Commands::FetchCommand.new(configuration) end context 'validation' do it 'requires a valid repo name' do expect(command).to_not be_valid end it 'should be valid if repo name is set' do command.set_repo_name(repo_name) expect(command).to be_valid end end context '#execute' do before do command.set_repo_name(repo_name) end it 'fetches new commits from origin' do source_repo.create_file('foo.txt') { |f| f.write('foo') } source_repo.add_all source_repo.commit('Initial commit') source_repo.create_branch('new_branch') source_repo.create_file('bar.txt') { |f| f.write('bar') } source_repo.add_all source_repo.commit('Second commit') source_repo.checkout('master') expect(dest_repo.git('branch -a').strip.split("\n")).to be_empty dest_repo.git("remote add origin #{source_repo.working_dir}") command.execute expect(dest_repo.git('branch -a').split("\n").map(&:strip)).to( eq(['remotes/origin/master', 'remotes/origin/new_branch']) ) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rosette-core-1.0.1 | spec/core/commands/git/fetch_command_spec.rb |