Sha256: 59c7522c2803c12a280c2da2c0b7ed3c74cd00c990ddb390278ecdb9b01725f9
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
require 'spec_helper' module CodeClimate::TestReporter describe Git do describe '.info' do it 'returns a hash with git information.' do expected_git_hash = { head: `git log -1 --pretty=format:'%H'`, committed_at: `git log -1 --pretty=format:'%ct'`.to_i, branch: Git.send(:branch_from_git) } expect(Git.info).to include expected_git_hash end end describe 'branch_from_git_or_ci' do it 'returns the branch from ci' do allow(Ci).to receive(:service_data).and_return({branch: 'ci-branch'}) expect(Git.branch_from_git_or_ci).to eq 'ci-branch' end it 'returns the branch from git if there is no ci branch' do allow(Ci).to receive(:service_data).and_return({}) expect(Git.branch_from_git_or_ci).to eq Git.clean_git_branch end it 'returns master otherwise' do allow(Ci).to receive(:service_data).and_return({}) allow(Git).to receive(:branch_from_git).and_return(nil) expect(Git.branch_from_git_or_ci).to eq 'master' end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
codeclimate-test-reporter-0.4.3 | spec/lib/git_spec.rb |
codeclimate-test-reporter-0.4.2 | spec/lib/git_spec.rb |
codeclimate-test-reporter-0.4.1 | spec/lib/git_spec.rb |