codeclimate-test-reporter 0.4.6 → 0.4.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d6cb4bd493e9044da7771edbc3eb80ac49035b29
4
- data.tar.gz: af1b2bfb800eea09cf7488dedc1f3c61e5615e40
3
+ metadata.gz: 3d80115d91ce3bf26fef3af83ae706d0189e23f4
4
+ data.tar.gz: ba43164b6d9949e4ee9e3906bc4508081f08c15b
5
5
  SHA512:
6
- metadata.gz: ac5031cb96a6ac7deda24bbb6d029e28bf096dec535a911e16cdfd3a846087e28db1f9f652e7f9de7e7299d3f37f0d6d3479e26981073663fca5ef51d47e47dd
7
- data.tar.gz: b932b84c1c80fb03abd9297604caa1c038ecc442904481189af49d0e644b02838c70c736b3d13f22182460b5aa26a7e675d3561c1752eb04940aeae24c3a1ffe
6
+ metadata.gz: 0ec8e55c4755c63dec00a679770f00aa8b9a908aef572dd8a5aa9fce8752dfc74f4b32214c79b0668dc33cc7bec00a1432abb2bfce81b3b3755510182a7ea267
7
+ data.tar.gz: aeccf37e8ba8c7af1ee8edcf65185135bc5333f45e666e2af733b2e9778db70db77ca324440009150ec568cdfb4d639eb5260c21337b5cc1ac0d91ffd30fd63f
@@ -45,7 +45,7 @@ module CodeClimate
45
45
  end
46
46
 
47
47
  def git(command)
48
- `git --git-dir=#{git_dir}/.git #{command}`
48
+ `git --git-dir="#{git_dir}/.git" #{command}`
49
49
  end
50
50
 
51
51
  def git_dir
@@ -58,7 +58,7 @@ module CodeClimate
58
58
  end
59
59
 
60
60
  def rails_git_dir_present?
61
- defined?(Rails) && !Rails.root.nil? &&
61
+ const_defined?(:Rails) && Rails.respond_to?(:root) && !Rails.root.nil? &&
62
62
  File.directory?(File.expand_path('.git', Rails.root))
63
63
  end
64
64
  end
@@ -1,5 +1,5 @@
1
1
  module CodeClimate
2
2
  module TestReporter
3
- VERSION = "0.4.6"
3
+ VERSION = "0.4.7"
4
4
  end
5
5
  end
data/spec/lib/git_spec.rb CHANGED
@@ -14,6 +14,50 @@ module CodeClimate::TestReporter
14
14
  end
15
15
  end
16
16
 
17
+ describe 'git' do
18
+ it 'should quote the git repository directory' do
19
+ path = '/path/to/foo bar'
20
+
21
+ allow(CodeClimate::TestReporter.configuration).to receive(:git_dir).and_return path
22
+ expect(Git).to receive(:`).once.with "git --git-dir=\"#{path}/.git\" help"
23
+
24
+ Git.send :git, 'help'
25
+ end
26
+
27
+ context 'ensure logic that replies on Rails is robust in non-rails environments' do
28
+ before :all do
29
+ module ::Rails; end
30
+ end
31
+
32
+ after :all do
33
+ Object.send(:remove_const, :Rails)
34
+ end
35
+
36
+ after :each do
37
+ Git.send :git, 'help'
38
+ end
39
+
40
+ it 'will check if constant Rails is defined' do
41
+ expect(Git).to receive(:configured_git_dir).once.and_return(nil)
42
+ end
43
+
44
+ it 'will not call method "root" (a 3rd time) if constant Rails is defined but does not respond to root' do
45
+ expect(Git).to receive(:configured_git_dir).once.and_return(nil)
46
+ expect(Rails).to receive(:root).twice.and_return('/path')
47
+ end
48
+
49
+ it 'will call rails root if constant Rails is defined and root method is defined' do
50
+ module ::Rails
51
+ def self.root
52
+ '/path'
53
+ end
54
+ end
55
+ expect(Git).to receive(:configured_git_dir).once.and_return(nil)
56
+ expect(Rails).to receive(:root).twice.and_return('/path')
57
+ end
58
+ end
59
+ end
60
+
17
61
  describe 'branch_from_git_or_ci' do
18
62
  it 'returns the branch from ci' do
19
63
  allow(Ci).to receive(:service_data).and_return({branch: 'ci-branch'})
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codeclimate-test-reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Helmkamp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-22 00:00:00.000000000 Z
11
+ date: 2015-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simplecov