gergich 1.2.3 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/{bin → exe}/gergich +0 -0
  3. data/{bin → exe}/master_bouncer +0 -0
  4. data/lib/gergich/capture/androidlint_capture.rb +8 -3
  5. data/lib/gergich/capture/brakeman_capture.rb +3 -2
  6. data/lib/gergich/capture/eslint_capture.rb +2 -1
  7. data/lib/gergich/capture/flake8_capture.rb +1 -1
  8. data/lib/gergich/capture/i18nliner_capture.rb +1 -1
  9. data/lib/gergich/capture/rubocop_capture.rb +19 -3
  10. data/lib/gergich/capture/shellcheck_capture.rb +2 -1
  11. data/lib/gergich/capture/stylelint_capture.rb +2 -5
  12. data/lib/gergich/capture/swiftlint_capture.rb +1 -1
  13. data/lib/gergich/capture/yamllint_capture.rb +8 -2
  14. data/lib/gergich/capture.rb +12 -5
  15. data/lib/gergich/cli/gergich.rb +3 -3
  16. data/lib/gergich/cli/master_bouncer.rb +6 -6
  17. data/lib/gergich/cli.rb +1 -1
  18. data/lib/gergich.rb +21 -25
  19. metadata +38 -29
  20. data/LICENSE +0 -20
  21. data/README.md +0 -178
  22. data/bin/check_coverage +0 -8
  23. data/bin/run_tests.sh +0 -22
  24. data/spec/gergich/capture/androidlint_capture_spec.rb +0 -61
  25. data/spec/gergich/capture/brakeman_capture_spec.rb +0 -91
  26. data/spec/gergich/capture/custom_capture_spec.rb +0 -41
  27. data/spec/gergich/capture/eslint_capture_spec.rb +0 -31
  28. data/spec/gergich/capture/flake8_capture_spec.rb +0 -23
  29. data/spec/gergich/capture/i18nliner_capture_spec.rb +0 -25
  30. data/spec/gergich/capture/rubocop_capture_spec.rb +0 -75
  31. data/spec/gergich/capture/shellcheck_capture_spec.rb +0 -83
  32. data/spec/gergich/capture/stylelint_capture_spec.rb +0 -54
  33. data/spec/gergich/capture/swiftlint_capture_spec.rb +0 -42
  34. data/spec/gergich/capture/yamllint_capture_spec.rb +0 -31
  35. data/spec/gergich/capture_spec.rb +0 -75
  36. data/spec/gergich_spec.rb +0 -396
  37. data/spec/spec_helper.rb +0 -92
  38. data/spec/support/capture_shared_examples.rb +0 -19
@@ -1,54 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../../support/capture_shared_examples"
4
-
5
- RSpec.describe Gergich::Capture::StylelintCapture do
6
- let(:output) do
7
- <<~OUTPUT
8
- app/stylesheets/base/_print.scss
9
- 3:17 ✖ Unexpected invalid hex color "#owiehfi" color-no-invalid-hex
10
- 3:17 ⚠ Expected "#owiehfi" to be "#OWIEHFI" color-hex-case
11
-
12
- app/stylesheets/base/_variables.scss
13
- 2:15 ✖ Unexpected invalid hex color "#2D3B4" color-no-invalid-hex
14
- 30:15 ⚠ Expected "#2d3b4a" to be "#2D3B4A" color-hex-case
15
- 45:12 ℹ Expected "#2d3b4a" to be "#2D3B4A" color-hex-case
16
- OUTPUT
17
- end
18
- let(:comments) do
19
- [
20
- {
21
- path: "app/stylesheets/base/_print.scss",
22
- position: 3,
23
- message: "[stylelint] Unexpected invalid hex color \"#owiehfi\"",
24
- severity: "error"
25
- },
26
- {
27
- path: "app/stylesheets/base/_print.scss",
28
- position: 3,
29
- message: "[stylelint] Expected \"#owiehfi\" to be \"#OWIEHFI\"",
30
- severity: "warn"
31
- },
32
- {
33
- path: "app/stylesheets/base/_variables.scss",
34
- position: 2,
35
- message: "[stylelint] Unexpected invalid hex color \"#2D3B4\"",
36
- severity: "error"
37
- },
38
- {
39
- path: "app/stylesheets/base/_variables.scss",
40
- position: 30,
41
- message: "[stylelint] Expected \"#2d3b4a\" to be \"#2D3B4A\"",
42
- severity: "warn"
43
- },
44
- {
45
- path: "app/stylesheets/base/_variables.scss",
46
- position: 45,
47
- message: "[stylelint] Expected \"#2d3b4a\" to be \"#2D3B4A\"",
48
- severity: "info"
49
- }
50
- ]
51
- end
52
-
53
- it_behaves_like "a captor"
54
- end
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../../support/capture_shared_examples"
4
-
5
- RSpec.describe Gergich::Capture::SwiftlintCapture do
6
- # rubocop:disable Layout/LineLength
7
- let(:colon_violation) { "Colon Violation: Colons should be next to the identifier when specifying a type. (colon)" }
8
- let(:line_length_violation) { "Line Length Violation: Line should be 100 characters or less: currently 129 characters (line_length)" }
9
- let(:force_cast_violation) { "Force Cast Violation: Force casts should be avoided. (force_cast)" }
10
- # rubocop:enable Layout/LineLength
11
- let(:output) do
12
- <<~OUTPUT
13
- /path/to/My.swift:13:22: warning: #{colon_violation}
14
- /path/to/Fail.swift:76: warning: #{line_length_violation}
15
- /path/to/Cast.swift:15:9: error: #{force_cast_violation}
16
- OUTPUT
17
- end
18
- let(:comments) do
19
- [
20
- {
21
- path: "/path/to/My.swift",
22
- position: 13,
23
- message: "[swiftlint] #{colon_violation}",
24
- severity: "warn"
25
- },
26
- {
27
- path: "/path/to/Fail.swift",
28
- position: 76,
29
- message: "[swiftlint] #{line_length_violation}",
30
- severity: "warn"
31
- },
32
- {
33
- path: "/path/to/Cast.swift",
34
- position: 15,
35
- message: "[swiftlint] #{force_cast_violation}",
36
- severity: "error"
37
- }
38
- ]
39
- end
40
-
41
- it_behaves_like "a captor"
42
- end
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../../support/capture_shared_examples"
4
-
5
- RSpec.describe Gergich::Capture::YamllintCapture do
6
- let(:output) do
7
- <<~OUTPUT
8
- ./api/config/lti/development/config.yml
9
- 2:8 error string value is redundantly quoted with double quotes (quoted-strings)
10
- 12:3 warning comment not indented like content (comments-indentation)
11
- OUTPUT
12
- end
13
- let(:comments) do
14
- [
15
- {
16
- path: "api/config/lti/development/config.yml",
17
- position: 2,
18
- message: "[yamllint] string value is redundantly quoted with double quotes",
19
- severity: "error"
20
- },
21
- {
22
- path: "api/config/lti/development/config.yml",
23
- position: 12,
24
- message: "[yamllint] comment not indented like content",
25
- severity: "warn"
26
- }
27
- ]
28
- end
29
-
30
- it_behaves_like "a captor"
31
- end
@@ -1,75 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../../lib/gergich/capture"
4
-
5
- RSpec.describe Gergich::Capture do
6
- let!(:draft) { double }
7
-
8
- let :output do
9
- <<~OUTPUT
10
- #{path}
11
- 4:21 error Missing semicolon semi
12
- OUTPUT
13
- end
14
-
15
- before do
16
- allow(Gergich::Draft).to receive(:new).and_return(draft)
17
- $stdin = StringIO.new(output)
18
- end
19
-
20
- after do
21
- $stdin = STDIN
22
- end
23
-
24
- context "stdin" do
25
- let(:path) { "jsapp/models/user.js" }
26
-
27
- it "should catch errors" do
28
- expect(draft).to receive(:add_comment).with(
29
- "jsapp/models/user.js",
30
- 4,
31
- "[eslint] Missing semicolon",
32
- "error"
33
- )
34
- described_class.run("eslint", "-", suppress_output: true)
35
- end
36
-
37
- it "shouldn't eat stdin" do
38
- allow(draft).to receive(:add_comment)
39
- expect($stdout).to receive(:puts).exactly(output.lines.size).times
40
- described_class.run("eslint", "-")
41
- end
42
- end
43
-
44
- context "absolute paths" do
45
- before do
46
- allow(described_class).to receive(:base_path).and_return("/the/directory/")
47
- end
48
-
49
- context "under us" do
50
- let(:path) { "/the/directory/jsapp/models/user.js" }
51
- it "should be relativized" do
52
- expect(draft).to receive(:add_comment).with(
53
- "jsapp/models/user.js",
54
- 4,
55
- "[eslint] Missing semicolon",
56
- "error"
57
- )
58
- described_class.run("eslint", "-", suppress_output: true)
59
- end
60
- end
61
-
62
- context "elsewhere" do
63
- let(:path) { "/other/directory/jsapp/models/user.js" }
64
- it "should not be relativized" do
65
- expect(draft).to receive(:add_comment).with(
66
- "/other/directory/jsapp/models/user.js",
67
- 4,
68
- "[eslint] Missing semicolon",
69
- "error"
70
- )
71
- described_class.run("eslint", "-", suppress_output: true)
72
- end
73
- end
74
- end
75
- end
data/spec/gergich_spec.rb DELETED
@@ -1,396 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "httparty"
4
-
5
- RSpec.describe Gergich::API do
6
- context "bad change-id" do
7
- let(:result) { double(:result, body: "Not Found: 1234") }
8
-
9
- before :each do
10
- allow(HTTParty).to receive(:send).and_return(result)
11
- allow(described_class).to receive(:prepare_options).and_return({})
12
- end
13
-
14
- it "provides helpful error when Change-Id not found" do
15
- # Get ride of CI_TEST_RUN environment variable so the api preforms normally
16
- ENV["CI_TEST_RUN"] = nil
17
- expect { described_class.get("/a/changes/1234") }
18
- .to raise_error(/Cannot find Change-Id: 1234/)
19
- end
20
- end
21
-
22
- context "GERGICH_DIGEST_AUTH exists" do
23
- it "uses digest auth" do
24
- original_basic_auth = ENV["GERGICH_DIGEST_AUTH"]
25
- ENV["GERGICH_DIGEST_AUTH"] = "1"
26
- original_gergich_key = ENV["GERGICH_KEY"]
27
- ENV["GERGICH_KEY"] = "foo"
28
- allow(described_class).to receive(:base_uri).and_return("https://gerrit.foobar.com")
29
-
30
- expect(described_class.send(:prepare_options, {}))
31
- .to match(
32
- hash_including(
33
- digest_auth: { username: "gergich", password: ENV["GERGICH_KEY"] }
34
- )
35
- )
36
-
37
- ENV["GERGICH_DIGEST_AUTH"] = original_basic_auth
38
- ENV["GERGICH_KEY"] = original_gergich_key
39
- end
40
- end
41
-
42
- context "GERGICH_DIGEST_AUTH does not exist" do
43
- it "uses basic auth" do
44
- original_basic_auth = ENV["GERGICH_DIGEST_AUTH"]
45
- ENV["GERGICH_DIGEST_AUTH"] = nil
46
- original_gergich_key = ENV["GERGICH_KEY"]
47
- ENV["GERGICH_KEY"] = "foo"
48
- allow(described_class).to receive(:base_uri).and_return("https://gerrit.foobar.com")
49
-
50
- expect(described_class.send(:prepare_options, {}))
51
- .to match(hash_including(basic_auth: { username: "gergich", password: ENV["GERGICH_KEY"] }))
52
-
53
- ENV["GERGICH_DIGEST_AUTH"] = original_basic_auth
54
- ENV["GERGICH_KEY"] = original_gergich_key
55
- end
56
- end
57
- end
58
-
59
- RSpec.describe Gergich::Commit do
60
- before :each do
61
- allow(Gergich).to receive(:use_git?).and_return(false)
62
- end
63
-
64
- context "change_id works" do
65
- it "supports branches with slashes" do
66
- allow(ENV).to receive(:[]).with("GERRIT_PATCHSET_REVISION").and_return("commit-ish")
67
- allow(ENV).to receive(:[]).with("GERRIT_PROJECT").and_return("spec-project")
68
- allow(ENV).to receive(:[]).with("GERRIT_BRANCH").and_return("releases/2017.11.17")
69
- allow(ENV).to receive(:[]).with("GERRIT_CHANGE_ID").and_return("dummychangeset")
70
-
71
- expect(described_class.new.change_id) # %2F = / and %7E = ~
72
- .to match("spec-project~releases%2F2017.11.17~dummychangeset")
73
- end
74
- end
75
- end
76
-
77
- RSpec.describe Gergich::Draft do
78
- let!(:draft) do
79
- commit = double(
80
- :commit,
81
- files: [
82
- "foo.rb",
83
- "bar/baz.lol"
84
- ],
85
- revision_id: "test",
86
- change_id: "test"
87
- )
88
- described_class.new commit
89
- end
90
-
91
- after do
92
- draft.reset!
93
- end
94
-
95
- context "#GERGICH_DB_PATH" do
96
- it "uses the custom path" do
97
- original_db_path = ENV["GERGICH_DB_PATH"]
98
- ENV["GERGICH_DB_PATH"] = "/custom"
99
-
100
- expect(draft.db_file).to eq("/custom/gergich-test.sqlite3")
101
-
102
- ENV["GERGICH_DB_PATH"] = original_db_path
103
- end
104
-
105
- it "uses the default path" do
106
- expect(draft.db_file).to eq("/tmp/gergich-test.sqlite3")
107
- end
108
- end
109
-
110
- describe "#info" do
111
- subject { draft.info }
112
-
113
- describe "[:comments]" do
114
- subject { super()[:comments] }
115
-
116
- it "includes file comments" do
117
- draft.add_comment "foo.rb", 1, "fix foo", "info"
118
- expect(subject).to eq("foo.rb" => [{ line: 1, message: "[INFO] fix foo" }])
119
- end
120
-
121
- it "strips whitespace from filename" do
122
- draft.add_comment " foo.rb\n", 1, "fix foo", "info"
123
- expect(subject).to eq("foo.rb" => [{ line: 1, message: "[INFO] fix foo" }])
124
- end
125
-
126
- it "includes COMMIT_MSG comments" do
127
- draft.add_comment "/COMMIT_MSG", 1, "fix commit", "info"
128
- expect(subject).to eq("/COMMIT_MSG" => [{ line: 1, message: "[INFO] fix commit" }])
129
- end
130
-
131
- it "doesn't include orphaned file comments" do
132
- draft.add_comment "invalid.rb", 1, "fix invalid", "info"
133
- expect(subject).to eq({})
134
- end
135
- end
136
-
137
- describe "[:cover_message_parts]" do
138
- subject { super()[:cover_message_parts] }
139
- let(:message_1) { "this is good" }
140
- let(:message_2) { "loljk it's terrible" }
141
-
142
- it "includes explicitly added messages" do
143
- draft.add_message message_1
144
- draft.add_message message_2
145
-
146
- expect(subject).to include(message_1)
147
- expect(subject).to include(message_2)
148
- end
149
-
150
- context "orphaned file comments exist" do
151
- let(:orphaned_comment) { "fix invalid" }
152
-
153
- before :each do
154
- draft.add_comment "invalid.rb", 1, orphaned_comment, "info"
155
- end
156
-
157
- it "includes orphan file message" do
158
- expect(subject.first).to match(/#{orphaned_comment}/)
159
- end
160
- end
161
- end
162
-
163
- describe "[:total_comments]" do
164
- subject { super()[:total_comments] }
165
-
166
- it "includes inline and orphaned comments" do
167
- draft.add_comment "foo.rb", 1, "fix foo", "info"
168
- draft.add_comment "invalid.rb", 1, "fix invalid", "info"
169
- expect(subject).to eq 2
170
- end
171
- end
172
-
173
- describe "[:labels]" do
174
- subject { super()[:labels] }
175
-
176
- it "uses the lowest score for each label" do
177
- draft.add_label "QA-Review", 1
178
- draft.add_label "QA-Review", -1
179
- draft.add_label "Code-Review", -2
180
- draft.add_label "Code-Review", 1
181
-
182
- expect(subject).to eq(
183
- "QA-Review" => -1,
184
- "Code-Review" => -2
185
- )
186
- end
187
-
188
- it "disallows \"Verified\"" do
189
- expect { draft.add_label "Verified", 1 }.to raise_error(/can't set Verified/)
190
- end
191
-
192
- it "disallows scores > 1" do
193
- expect { draft.add_label "Foo", 2 }.to raise_error(/invalid score/)
194
- end
195
-
196
- describe "[\"Code-Review\"]" do
197
- subject { super()["Code-Review"] }
198
-
199
- it "defaults to zero" do
200
- expect(subject).to eq(0)
201
- end
202
-
203
- it "is the lowest comment severity if not set" do
204
- draft.add_comment "foo.rb", 1, "fix foo", "info"
205
- draft.add_comment "foo.rb", 2, "fix foo", "error"
206
- draft.add_comment "foo.rb", 3, "fix foo", "warn"
207
-
208
- expect(subject).to eq(-2)
209
- end
210
-
211
- it "is trumped by a lower comment severity if negative" do
212
- draft.add_label "Code-Review", 1
213
- draft.add_comment "foo.rb", 1, "fix foo", "warn"
214
-
215
- expect(subject).to eq(-1)
216
- end
217
-
218
- it "is not trumped by a lower comment severity if zero" do
219
- draft.add_label "Code-Review", 1
220
- draft.add_comment "foo.rb", 1, "this is ok", "info"
221
-
222
- expect(subject).to eq(1)
223
- end
224
-
225
- it "is not trumped by a higher comment severity" do
226
- draft.add_label "Code-Review", -1
227
- draft.add_comment "foo.rb", 1, "this is ok", "info"
228
-
229
- expect(subject).to eq(-1)
230
- end
231
- end
232
- end
233
- end
234
- end
235
-
236
- RSpec.describe Gergich::Review do
237
- let(:change_id) { "test" }
238
- let!(:commit) do
239
- double(
240
- :commit,
241
- change_id: change_id,
242
- files: [
243
- "foo.rb",
244
- "bar/baz.lol"
245
- ],
246
- info: {},
247
- revision_id: change_id,
248
- revision_number: 1
249
- )
250
- end
251
- let!(:draft) do
252
- Gergich::Draft.new commit
253
- end
254
- let!(:review) { described_class.new(commit, draft) }
255
-
256
- after do
257
- draft.reset!
258
- end
259
-
260
- describe "#status" do
261
- subject { review.status }
262
-
263
- context "nothing to publish" do
264
- before :each do
265
- allow(review).to receive(:anything_to_publish?).and_return(false)
266
- end
267
- it { expect { subject }.to output(include("Nothing to publish")).to_stdout }
268
- end
269
-
270
- context "something to publish" do
271
- before :each do
272
- allow(review).to receive(:anything_to_publish?).and_return(true)
273
- allow(review).to receive(:already_commented?).and_return(false)
274
- allow(review).to receive(:generate_payload).and_return({})
275
- allow(review).to receive(:my_messages).and_return([])
276
- end
277
- it {
278
- expected_outputs = [
279
- "Project:",
280
- "Branch:",
281
- "Revision:",
282
- "ChangeId: #{change_id}",
283
- "Files:"
284
- # There's more... but this is good
285
- ]
286
- expect { subject }.to output(include(*expected_outputs)).to_stdout
287
- }
288
- end
289
- end
290
-
291
- describe "#publish!" do
292
- context "nothing to publish" do
293
- before :each do
294
- allow(review).to receive(:anything_to_publish?).and_return(false)
295
- end
296
-
297
- it "does nothing" do
298
- expect(Gergich::API).not_to receive(:post)
299
-
300
- review.publish!
301
- end
302
- end
303
-
304
- context "something to publish" do
305
- before :each do
306
- allow(review).to receive(:anything_to_publish?).and_return(true)
307
- allow(review).to receive(:already_commented?).and_return(false)
308
- allow(review).to receive(:generate_payload).and_return({})
309
- end
310
-
311
- it "publishes via the api" do
312
- expect(Gergich::API).to receive(:post)
313
- review.publish!
314
- end
315
- end
316
- end
317
-
318
- describe "#anything_to_publish?" do
319
- before :each do
320
- allow(review).to receive(:current_label).and_return("BAHA")
321
- allow(review).to receive(:current_label_revision).and_return("Revision trash stuff")
322
- end
323
-
324
- context "no comments exist" do
325
- it "returns false" do
326
- allow(review).to receive(:new_score?).and_return(false)
327
- expect(review.anything_to_publish?).to eq false
328
- end
329
- end
330
-
331
- context "comments exist" do
332
- it "returns true" do
333
- draft.info[:comments] = "Hello there this is a comment"
334
- expect(review.anything_to_publish?).to eq true
335
- end
336
- end
337
- end
338
-
339
- describe "#new_score?" do
340
- before :each do
341
- allow(review).to receive(:current_label_is_for_current_revision?).and_return(true)
342
- allow(review).to receive(:current_score).and_return(0)
343
- end
344
-
345
- context "score is the same" do
346
- it "returns false" do
347
- draft.info[:score] = 0
348
- expect(review.new_score?).to eq false
349
- end
350
- end
351
-
352
- context "score is different" do
353
- it "returns true" do
354
- draft.info[:score] = -1
355
- expect(review.new_score?).to eq true
356
- end
357
- end
358
- end
359
-
360
- describe "#upcoming_score" do
361
- context "current_label_is_for_current_revision? is true" do
362
- it "Should return the min value of draft.info[:score] and current_score" do
363
- allow(review).to receive(:current_label_is_for_current_revision?).and_return(true)
364
- allow(review).to receive(:current_score).and_return(0)
365
- review.draft.info[:score] = 1
366
- expect(review.upcoming_score).to eq 0
367
- end
368
- end
369
-
370
- context "current_label_is_for_current_revision? is false" do
371
- it "Should return the value of draft.info[:score]" do
372
- allow(review).to receive(:current_label_is_for_current_revision?).and_return(false)
373
- review.draft.info[:score] = 1
374
- expect(review.upcoming_score).to eq 1
375
- end
376
- end
377
- end
378
-
379
- describe "#cover_message" do
380
- context "score is negative" do
381
- it "includes the Code-Review score if negative" do
382
- allow(review).to receive(:upcoming_score).and_return(-1)
383
- review.draft.add_label "Code-Review", -1
384
- expect(review.cover_message).to match(/^-1/)
385
- end
386
- end
387
-
388
- context "score is non-negative" do
389
- it "doesn't include the score if not negative" do
390
- allow(review).to receive(:upcoming_score).and_return(0)
391
- draft.add_label "Code-Review", 0
392
- expect(subject).to_not match(/^0/)
393
- end
394
- end
395
- end
396
- end
data/spec/spec_helper.rb DELETED
@@ -1,92 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "simplecov" if ENV["COVERAGE"]
4
- require_relative "../lib/gergich"
5
-
6
- # This file was generated by the `rspec --init` command. Conventionally, all
7
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
8
- # The generated `.rspec` file contains `--require spec_helper` which will cause
9
- # this file to always be loaded, without a need to explicitly require it in any
10
- # files.
11
- #
12
- # Given that it is always loaded, you are encouraged to keep this file as
13
- # light-weight as possible. Requiring heavyweight dependencies from this file
14
- # will add to the boot time of your test suite on EVERY test run, even for an
15
- # individual file that may not need all of that loaded. Instead, consider making
16
- # a separate helper file that requires the additional dependencies and performs
17
- # the additional setup, and require it from the spec files that actually need
18
- # it.
19
- #
20
- # The `.rspec` file also contains a few flags that are not defaults but that
21
- # users commonly want.
22
- #
23
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
24
- RSpec.configure do |config|
25
- # rspec-expectations config goes here. You can use an alternate
26
- # assertion/expectation library such as wrong or the stdlib/minitest
27
- # assertions if you prefer.
28
- config.expect_with :rspec do |expectations|
29
- # This option will default to `true` in RSpec 4. It makes the `description`
30
- # and `failure_message` of custom matchers include text for helper methods
31
- # defined using `chain`, e.g.:
32
- # be_bigger_than(2).and_smaller_than(4).description
33
- # # => "be bigger than 2 and smaller than 4"
34
- # ...rather than:
35
- # # => "be bigger than 2"
36
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
37
- end
38
-
39
- # rspec-mocks config goes here. You can use an alternate test double
40
- # library (such as bogus or mocha) by changing the `mock_with` option here.
41
- config.mock_with :rspec do |mocks|
42
- # Prevents you from mocking or stubbing a method that does not exist on
43
- # a real object. This is generally recommended, and will default to
44
- # `true` in RSpec 4.
45
- mocks.verify_partial_doubles = true
46
- end
47
-
48
- # These two settings work together to allow you to limit a spec run
49
- # to individual examples or groups you care about by tagging them with
50
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
51
- # get run.
52
- config.filter_run :focus
53
- config.run_all_when_everything_filtered = true
54
-
55
- # Limits the available syntax to the non-monkey patched syntax that is
56
- # recommended. For more details, see:
57
- # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
58
- # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
59
- # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
60
- config.disable_monkey_patching!
61
-
62
- # This setting enables warnings. It's recommended, but in some cases may
63
- # be too noisy due to issues in dependencies.
64
- config.warnings = true
65
-
66
- # Many RSpec users commonly either run the entire suite or an individual
67
- # file, and it's useful to allow more verbose output when running an
68
- # individual spec file.
69
- if config.files_to_run.one?
70
- # Use the documentation formatter for detailed output,
71
- # unless a formatter has already been configured
72
- # (e.g. via a command-line flag).
73
- config.default_formatter = "doc"
74
- end
75
-
76
- # Print the 10 slowest examples and example groups at the
77
- # end of the spec run, to help surface which specs are running
78
- # particularly slow.
79
- config.profile_examples = 10
80
-
81
- # Run specs in random order to surface order dependencies. If you find an
82
- # order dependency and want to debug it, you can fix the order by providing
83
- # the seed, which is printed after each run.
84
- # --seed 1234
85
- config.order = :random
86
-
87
- # Seed global randomization in this process using the `--seed` CLI option.
88
- # Setting this allows you to use `--seed` to deterministically reproduce
89
- # test failures related to randomization by passing the same `--seed` value
90
- # as the one that triggered the failure.
91
- Kernel.srand config.seed
92
- end