Sha256: 42ae2d94c7f5ddfd0c8c3993e6bbfa6428fa528506cdca0d7dfef04c54b45dc8
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
require 'git/duet/pre_commit_command' describe Git::Duet::PreCommitCommand do subject do described_class.new(true) end before :each do subject.stub(:in_repo_root) do |&block| block.call end @old_seconds_ago_stale = ENV.delete('GIT_DUET_SECONDS_AGO_STALE') ENV['GIT_DUET_SECONDS_AGO_STALE'] = '300' end after :each do ENV['GIT_DUET_SECONDS_AGO_STALE'] = @old_seconds_ago_stale end it 'should not require any params to initialize' do expect { described_class.new }.to_not raise_error end it 'should do nothing if the env cache is not stale' do subject.stub(:exec_check).with(/git config duet\.env\.git/) subject.stub(:exec_check).with('git config duet.env.mtime').and_return(Time.now.to_i) subject.should_not_receive(:explode!) subject.execute! end it 'should explode if the env cache does not exist' do subject.stub(:exec_check).with(/git config duet\.env\.git/) subject.stub(:exec_check).with('git config duet.env.mtime').and_raise(StandardError) expect { subject.execute! }.to raise_error(Git::Duet::ScriptDieError) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
git-duet-0.1.3 | spec/lib/git/duet/pre_commit_command_spec.rb |