fit-commit 3.2.1 → 3.2.2

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: 0872555343a9157e7d2b06333eb2965366de6c42
4
- data.tar.gz: 115c0d4cb09484f15f885c02180646dacb94e00c
3
+ metadata.gz: a192b55fd47925dbae22610a7fc15811751d0b57
4
+ data.tar.gz: 58e5247361be7806cbf568b05ef5f10bb8a9a811
5
5
  SHA512:
6
- metadata.gz: c6cc995fa3a43833a0c898ca47fbcca74d44118384458f7669156c96c4f980c1ceca8442a3d873b276cfaab8a99693642c6afdc47043af87e54b03735854d135
7
- data.tar.gz: 4ff7da0c1223e67c080f28913a8f6e35805c473f3a518eca389becc06074defbe78df31c7567015a1c8db7919194518289b8e2e9a9bcaef686fa1561cecd9130
6
+ metadata.gz: 3d09f8222037da2a6f794870762e7720e49f86afb45fdd233a16910ba2c14d1b73deae27179ff01cb7ec67a09d41691302d48ab38e3ee060a411982e7378b463
7
+ data.tar.gz: c4ecf05c835b1d2d4f0896e82c535f05737b386985520dfa4341cf0f98cf8ed455299ef983977b7971a6243a64097b0ebb19cce5d4bde0eb5a318e23c3c6b2fd
@@ -17,7 +17,6 @@ module FitCommit
17
17
  end
18
18
 
19
19
  def self.branch_name
20
- ENV["GIT_BRANCH_NAME"] ||
21
- fail("Git branch not found. You might need to re-run `fit-commit install`")
20
+ ENV.fetch("GIT_BRANCH_NAME")
22
21
  end
23
22
  end
@@ -1,3 +1,3 @@
1
1
  module FitCommit
2
- VERSION = "3.2.1"
2
+ VERSION = "3.2.2"
3
3
  end
@@ -18,13 +18,7 @@ if [ ! -r "$COMMIT_MESSAGE_PATH" ]; then
18
18
  exit 0
19
19
  fi
20
20
 
21
- export GIT_BRANCH_NAME=`git symbolic-ref --short HEAD`
22
- if [ -z "$GIT_BRANCH_NAME" ]; then
23
- >&2 echo "fit-commit: WARNING: Skipping checks because the Git branch cannot be determined."
24
- >&2 echo "fit-commit: Please submit a bug report with the project:"
25
- >&2 echo "fit-commit: https://github.com/m1foley/fit-commit/issues"
26
- exit 0
27
- fi
21
+ export GIT_BRANCH_NAME=`git symbolic-ref --short HEAD 2> /dev/null`
28
22
 
29
23
  # find appropriate Ruby command
30
24
  if which rbenv > /dev/null 2>&1; then
@@ -101,6 +101,13 @@ describe FitCommit::Runner do
101
101
  assert_equal FitCommit::Runner::EXIT_CODE_REJECT_COMMIT, call_runner
102
102
  assert_error_output
103
103
  end
104
+ describe "empty branch name" do
105
+ let(:branch_name) { "" }
106
+ it "prints errors to stderr and rejects commit" do
107
+ assert_equal FitCommit::Runner::EXIT_CODE_REJECT_COMMIT, call_runner
108
+ assert_error_output
109
+ end
110
+ end
104
111
  end
105
112
  describe "user forces commit" do
106
113
  let(:stdin) { fake_tty("y") }
@@ -23,7 +23,7 @@ describe FitCommit::ValidatorLoader do
23
23
  end
24
24
 
25
25
  it "loads enabled validators" do
26
- assert validators.any? { |v| v.is_a? FitCommit::Validators::Wip }
26
+ assert validators.one? { |v| v.is_a? FitCommit::Validators::Wip }
27
27
  end
28
28
 
29
29
  it "doesn't load disabled validators" do
@@ -31,22 +31,37 @@ describe FitCommit::ValidatorLoader do
31
31
  end
32
32
 
33
33
  describe "non-boolean options for Enabled" do
34
- it "doesn't load validators with a non-matching string/regex Enabled values" do
35
- assert validators.none? { |v| v.is_a? FitCommit::Validators::Frathouse }
34
+ describe "branch_name does not match validator" do
35
+ it "doesn't load validator" do
36
+ assert validators.none? { |v| v.is_a? FitCommit::Validators::Frathouse }
37
+ end
36
38
  end
37
39
 
38
- describe "validator has a matching string Enabled value" do
40
+ describe "branch_name matches validator via String" do
39
41
  let(:branch_name) { "bar" }
40
42
  it "loads validator" do
41
- assert validators.any? { |v| v.is_a? FitCommit::Validators::Frathouse }
43
+ assert validators.one? { |v| v.is_a? FitCommit::Validators::Frathouse }
42
44
  end
43
45
  end
44
46
 
45
- describe "validator has a matching regex Enabled value" do
47
+ describe "branch_name matches validator via regex" do
46
48
  let(:branch_name) { "bazzz" }
47
49
  it "loads validator" do
48
- assert validators.any? { |v| v.is_a? FitCommit::Validators::Frathouse }
50
+ assert validators.one? { |v| v.is_a? FitCommit::Validators::Frathouse }
49
51
  end
50
52
  end
51
53
  end
54
+
55
+ describe "branch_name is blank" do
56
+ let(:branch_name) { "" }
57
+ it "loads enabled validators" do
58
+ assert validators.one? { |v| v.is_a? FitCommit::Validators::Wip }
59
+ end
60
+ it "doesn't load disabled validators" do
61
+ assert validators.none? { |v| v.is_a? FitCommit::Validators::LineLength }
62
+ end
63
+ it "doesn't load validators that have non-boolean options for Enabled" do
64
+ assert validators.none? { |v| v.is_a? FitCommit::Validators::Frathouse }
65
+ end
66
+ end
52
67
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fit-commit
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 3.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Foley