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 +4 -4
- data/lib/fit_commit.rb +1 -2
- data/lib/fit_commit/version.rb +1 -1
- data/templates/hooks/commit-msg +1 -7
- data/test/unit/runner_test.rb +7 -0
- data/test/unit/validator_loader_test.rb +22 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a192b55fd47925dbae22610a7fc15811751d0b57
|
4
|
+
data.tar.gz: 58e5247361be7806cbf568b05ef5f10bb8a9a811
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d09f8222037da2a6f794870762e7720e49f86afb45fdd233a16910ba2c14d1b73deae27179ff01cb7ec67a09d41691302d48ab38e3ee060a411982e7378b463
|
7
|
+
data.tar.gz: c4ecf05c835b1d2d4f0896e82c535f05737b386985520dfa4341cf0f98cf8ed455299ef983977b7971a6243a64097b0ebb19cce5d4bde0eb5a318e23c3c6b2fd
|
data/lib/fit_commit.rb
CHANGED
data/lib/fit_commit/version.rb
CHANGED
data/templates/hooks/commit-msg
CHANGED
@@ -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
|
data/test/unit/runner_test.rb
CHANGED
@@ -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.
|
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
|
-
|
35
|
-
|
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 "
|
40
|
+
describe "branch_name matches validator via String" do
|
39
41
|
let(:branch_name) { "bar" }
|
40
42
|
it "loads validator" do
|
41
|
-
assert validators.
|
43
|
+
assert validators.one? { |v| v.is_a? FitCommit::Validators::Frathouse }
|
42
44
|
end
|
43
45
|
end
|
44
46
|
|
45
|
-
describe "
|
47
|
+
describe "branch_name matches validator via regex" do
|
46
48
|
let(:branch_name) { "bazzz" }
|
47
49
|
it "loads validator" do
|
48
|
-
assert validators.
|
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
|