devloop 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/devloop/diff_parser.rb +7 -1
- data/lib/devloop/version.rb +1 -1
- data/spec/diff_parser_spec.rb +49 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1aacef492d0bf184908275bc5df40ba6915cf3a1215edc39fb41374fa18574e0
|
4
|
+
data.tar.gz: aa92fd7489fcd1fbefaf1ad01e7fddcf9b39b8ab9ba9d9964794ba15cba15559
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a26d307a8957fba390304bdcacbb6e3b2b23c4f86bb3fcbbc9b3a2fc0e14b69a16836cf7f4cb9e6b68efcc24a775113bdc5b64b639c0da3921ab9f2a835f006e
|
7
|
+
data.tar.gz: 4444e6eede7525a922044f6c2f7c7d1363b5d9490d94dce08499b52d2021338d04acdb1a95eaf3dfc43fed50edfd2a800a006a3b4d8701dcb152c1caa9e958dc
|
data/lib/devloop/diff_parser.rb
CHANGED
@@ -21,7 +21,13 @@ module Devloop
|
|
21
21
|
end.uniq
|
22
22
|
|
23
23
|
# Remove filenames with line number if filename without line number is present
|
24
|
-
results.reject { |result| results.include?(result.split(":").first) && result.include?(":") }
|
24
|
+
res = results.reject { |result| results.include?(result.split(":").first) && result.include?(":") }.map do |el|
|
25
|
+
if el.split(":").last == "0"
|
26
|
+
el.split(":").first
|
27
|
+
else
|
28
|
+
el
|
29
|
+
end
|
30
|
+
end
|
25
31
|
end
|
26
32
|
|
27
33
|
private
|
data/lib/devloop/version.rb
CHANGED
data/spec/diff_parser_spec.rb
CHANGED
@@ -96,4 +96,53 @@ describe Devloop::DiffParser do
|
|
96
96
|
expect(Devloop::DiffParser.call(diff)).to eq(["spec/models/team_spec.rb:19", "spec/models/team_spec.rb:24"])
|
97
97
|
end
|
98
98
|
end
|
99
|
+
|
100
|
+
context "removes 0 line numbers" do
|
101
|
+
let(:diff) do
|
102
|
+
<<~DIFF
|
103
|
+
diff --git a/spec/config_spec.rb b/spec/config_spec.rb
|
104
|
+
index d9716e7..b470ec2 100644
|
105
|
+
--- a/spec/config_spec.rb
|
106
|
+
+++ b/spec/config_spec.rb
|
107
|
+
@@ -5 +5 @@ require "spec_helper"
|
108
|
+
-describe "PgLocksMonitor::Confiuration" do
|
109
|
+
+describe "PgLocksMonitor::Configuration" do
|
110
|
+
@@ -8,2 +8,5 @@ describe "PgLocksMonitor::Confiuration" do
|
111
|
+
- expect(config.notify_locks).to eq true
|
112
|
+
- expect(config.notify_blocking).to eq true
|
113
|
+
+ expect(config.monitor_locks).to eq true
|
114
|
+
+ expect(config.monitor_blocking).to eq true
|
115
|
+
+ expect(config.locks_min_duration_ms).to eq 200
|
116
|
+
+ expect(config.blocking_min_duration_ms).to eq 100
|
117
|
+
+ expect(config.notifier_class).to eq PgLocksMonitor::DefaultNotifier
|
118
|
+
@@ -14 +17 @@ describe "PgLocksMonitor::Confiuration" do
|
119
|
+
- config.notify_locks = false
|
120
|
+
+ config.monitor_locks = false
|
121
|
+
@@ -17 +20 @@ describe "PgLocksMonitor::Confiuration" do
|
122
|
+
- expect(PgLocksMonitor.configuration.notify_locks).to eq false
|
123
|
+
+ expect(PgLocksMonitor.configuration.monitor_locks).to eq false
|
124
|
+
diff --git a/spec/default_notifier_spec.rb b/spec/default_notifier_spec.rb
|
125
|
+
new file mode 100644
|
126
|
+
index 0000000..d99d3a1
|
127
|
+
--- /dev/null
|
128
|
+
+++ b/spec/default_notifier_spec.rb
|
129
|
+
@@ -0,0 +1,11 @@
|
130
|
+
+# frozen_string_literal: true
|
131
|
+
+
|
132
|
+
+require "spec_helper"
|
133
|
+
+
|
134
|
+
+describe PgLocksMonitor::DefaultNotifier do
|
135
|
+
+ it "requires correct config if Slack notifications enabled" do
|
136
|
+
+ expect {
|
137
|
+
+ PgLocksMonitor::DefaultNotifier.call({})
|
138
|
+
+ }.not_to raise_error
|
139
|
+
+ end
|
140
|
+
+end
|
141
|
+
DIFF
|
142
|
+
end
|
143
|
+
|
144
|
+
it "parses the diff correctly" do
|
145
|
+
expect(Devloop::DiffParser.call(diff)).to eq(["spec/config_spec.rb:5", "spec/config_spec.rb:8", "spec/config_spec.rb:14", "spec/config_spec.rb:17", "spec/default_notifier_spec.rb"])
|
146
|
+
end
|
147
|
+
end
|
99
148
|
end
|