Skip to content

Commit 2fcaacd

Browse files
committed
chore: Add RSpec integration tests
Signed-off-by: Austin Ziegler <austin@zieglers.ca>
1 parent e90c39a commit 2fcaacd

19 files changed

Lines changed: 334 additions & 64 deletions

.github/workflows/ci.yml

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
with:
3838
persist-credentials: false
3939

40-
- uses: ruby/setup-ruby@675dd7ba1b06c8786a1480d89c384f5620a42647 # v1.281.0
40+
- uses: ruby/setup-ruby@708024e6c902387ab41de36e1669e43b5ee7085e # v1.283.0
4141
with:
4242
ruby-version: '3.4'
4343
rubygems: latest
@@ -71,7 +71,7 @@ jobs:
7171
with:
7272
persist-credentials: false
7373

74-
- uses: ruby/setup-ruby@675dd7ba1b06c8786a1480d89c384f5620a42647 # v1.281.0
74+
- uses: ruby/setup-ruby@708024e6c902387ab41de36e1669e43b5ee7085e # v1.283.0
7575
with:
7676
ruby-version: '3.4'
7777
rubygems: latest
@@ -120,7 +120,7 @@ jobs:
120120
with:
121121
persist-credentials: false
122122

123-
- uses: ruby/setup-ruby@675dd7ba1b06c8786a1480d89c384f5620a42647 # v1.281.0
123+
- uses: ruby/setup-ruby@708024e6c902387ab41de36e1669e43b5ee7085e # v1.283.0
124124
with:
125125
ruby-version: ${{ matrix.ruby }}
126126
rubygems: latest
@@ -129,6 +129,11 @@ jobs:
129129

130130
- run: bundle exec ruby -S rake test --trace
131131

132+
- name: Verify RSpec compatibility
133+
run: |
134+
gem install rspec
135+
integration/runner rake integration
136+
132137
required-macos:
133138
name: Ruby ${{ matrix.ruby }} - ${{ matrix.os }}
134139

@@ -167,7 +172,7 @@ jobs:
167172
with:
168173
persist-credentials: false
169174

170-
- uses: ruby/setup-ruby@675dd7ba1b06c8786a1480d89c384f5620a42647 # v1.281.0
175+
- uses: ruby/setup-ruby@708024e6c902387ab41de36e1669e43b5ee7085e # v1.283.0
171176
with:
172177
ruby-version: ${{ matrix.ruby }}
173178
rubygems: latest
@@ -176,6 +181,13 @@ jobs:
176181

177182
- run: bundle exec ruby -S rake test --trace
178183

184+
- name: Verify RSpec compatibility
185+
env:
186+
GEM_PATH: vendor/bundle
187+
run: |
188+
gem install rspec
189+
integration/runner rake integration
190+
179191
optional-windows:
180192
name: Ruby ${{ matrix.ruby }} - ${{ matrix.os }}
181193

@@ -216,7 +228,7 @@ jobs:
216228
with:
217229
persist-credentials: false
218230

219-
- uses: ruby/setup-ruby@675dd7ba1b06c8786a1480d89c384f5620a42647 # v1.281.0
231+
- uses: ruby/setup-ruby@708024e6c902387ab41de36e1669e43b5ee7085e # v1.283.0
220232
with:
221233
ruby-version: ${{ matrix.ruby }}
222234
rubygems: latest
@@ -225,6 +237,13 @@ jobs:
225237

226238
- run: bundle exec ruby -S rake test --trace
227239

240+
- name: Verify RSpec compatibility
241+
env:
242+
GEM_PATH: vendor/bundle
243+
run: |
244+
gem install rspec
245+
integration/runner rake integration
246+
228247
jruby-optional:
229248
name: JRuby ${{ matrix.ruby }} - ${{ matrix.os }}
230249

@@ -262,7 +281,7 @@ jobs:
262281
with:
263282
persist-credentials: false
264283

265-
- uses: ruby/setup-ruby@675dd7ba1b06c8786a1480d89c384f5620a42647 # v1.281.0
284+
- uses: ruby/setup-ruby@708024e6c902387ab41de36e1669e43b5ee7085e # v1.283.0
266285
with:
267286
ruby-version: ${{ matrix.ruby }}
268287
rubygems: latest
@@ -271,6 +290,13 @@ jobs:
271290

272291
- run: bundle exec ruby -S rake test --trace
273292

293+
- name: Verify RSpec compatibility
294+
env:
295+
GEM_PATH: vendor/bundle
296+
run: |
297+
gem install rspec
298+
integration/runner rake integration
299+
274300
ruby-head-optional:
275301
name: Ruby ${{ matrix.ruby }} - ${{ matrix.os }} (optional)
276302

@@ -308,11 +334,18 @@ jobs:
308334
with:
309335
persist-credentials: false
310336

311-
- uses: ruby/setup-ruby@675dd7ba1b06c8786a1480d89c384f5620a42647 # v1.281.0
337+
- uses: ruby/setup-ruby@708024e6c902387ab41de36e1669e43b5ee7085e # v1.283.0
312338
with:
313339
ruby-version: ${{ matrix.ruby }}
314340
rubygems: latest
315341
bundler: 2
316342
bundler-cache: true
317343

318344
- run: bundle exec ruby -S rake test --trace
345+
346+
- name: Verify RSpec compatibility
347+
env:
348+
GEM_PATH: vendor/bundle
349+
run: |
350+
gem install rspec
351+
integration/runner rake integration

.github/workflows/publish-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
'print "version=", Gem::Specification.load(ARGV[0]).rubygems_version, "\n"' \
3939
diff-lcs.gemspec >>"${GITHUB_OUTPUT}"
4040
41-
- uses: ruby/setup-ruby@675dd7ba1b06c8786a1480d89c384f5620a42647 # v1.281.0
41+
- uses: ruby/setup-ruby@708024e6c902387ab41de36e1669e43b5ee7085e # v1.283.0
4242
with:
4343
bundler-cache: false
4444
ruby-version: ruby

.github/workflows/publish-gem.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
'print "version=", Gem::Specification.load(ARGV[0]).rubygems_version, "\n"' \
6666
diff-lcs.gemspec >>"${GITHUB_OUTPUT}"
6767
68-
- uses: ruby/setup-ruby@675dd7ba1b06c8786a1480d89c384f5620a42647 # v1.281.0
68+
- uses: ruby/setup-ruby@708024e6c902387ab41de36e1669e43b5ee7085e # v1.283.0
6969
with:
7070
bundler-cache: false
7171
ruby-version: ruby

CHANGELOG.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
## 2.0.0.beta.1 / 2025-12-31
3+
## 2.0.0.beta.2 / 2025-01-22
44

55
This release has significant **breaking changes**.
66

@@ -43,6 +43,19 @@ This release has significant **breaking changes**.
4343

4444
The order of `VALID_ACTIONS` was changed for the index order to make sense.
4545

46+
- `ldiff` now implements `-` as a filename option for standard input. This is
47+
used for integration testing with RSpec like this:
48+
49+
```console
50+
rspec -Ilib -rdiff/lcs integration/failure/array_diff_spec.rb 2>&1 |
51+
ruby -Ilib bin/ldiff -U integration/golden/array_diff.txt -
52+
```
53+
54+
- diff-lcs no longer uses RSpec as its test suite, but instead uses Minitest.
55+
The conversion to Minitest and the new RSpec integration tests
56+
(`rake integration`) were written with the assistance of [Kiro][kiro] and
57+
verified manually, with portions changed as required.
58+
4659
## 1.6.2 / 2025-05-12
4760

4861
- Handle upcoming changes to the `cgi` gem in Ruby 3.5 ([#147][pull-147])
@@ -68,8 +81,9 @@ This release has significant **breaking changes**.
6881

6982
## 1.6.0 / 2025-02-13
7083

71-
- Baptiste Courtois (@annih) has done significant work on making `bin/ldiff`
72-
work better, contributing a number of issues and pull requests. These include:
84+
- Baptiste Courtois ([@annih][gh-user-annih]) has done significant work on
85+
making `bin/ldiff` work better, contributing a number of issues and pull
86+
requests. These include:
7387

7488
- Separation of command parsing from diff-generation in `Diff::LCS::Ldiff`
7589
code extraction making it easier to use separately from the `bin/ldiff`
@@ -428,8 +442,8 @@ This release has significant **breaking changes**.
428442

429443
## 1.1.1 / 2004-09-25
430444

431-
- Fixed bug #891 (Set returned from patch command does not contain last equal
432-
part).
445+
- Fixed bug [#891][gh-issue-891] (Set returned from patch command does not
446+
contain last equal part).
433447

434448
- Fixed a problem with callback initialisation code (it assumed that all
435449
callbacks passed as classes can be initialised; now, it rescues NoMethodError
@@ -560,3 +574,6 @@ This release has significant **breaking changes**.
560574
[standard ruby]: https://github.com/standardrb/standard
561575
[tidelift]: https://tidelift.com/security
562576
[tp]: https://guides.rubygems.org/trusted-publishing/
577+
[kiro]: https://kiro.dev
578+
[gh-user-annih]: https://github.com/annih
579+
[gh-issue-891]: https://github.com/halostatue/diff-lcs/issues/891

CONTRIBUTING.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ diff-lcs is governed under the [Contributor Covenant Code of Conduct][cccoc].
1313
I have several guidelines to contributing code through pull requests:
1414

1515
- All code changes require tests. In most cases, this will be added or updated
16-
unit tests. I use [RSpec][rspec].
16+
unit tests. I use [Minitest][minitest].
17+
18+
- There are integration tests with RSpec which must not be broken, accessible
19+
through `rake integration`. This requires a non-bundled RSpec,
20+
`gem install rspec`.
1721

1822
- I use code formatters, static analysis tools, and linting to ensure consistent
1923
styles and formatting. There should be no warning output from test run
@@ -115,6 +119,7 @@ required metadata trailers are:
115119
[dco]: licences/dco.txt
116120
[hoe]: https://github.com/seattlerb/hoe
117121
[issues]: https://github.com/halostatue/diff-lcs/issues
122+
[minitest]: https://github.com/seattlerb/minitest
118123
[rspec]: https://rspec.info/documentation/
119124
[standardrb]: https://github.com/standardrb/standard
120125
[tpope-qcm]: https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html

CONTRIBUTORS.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
# Contributors
22

3-
- Austin Ziegler (@halostatue) created diff-lcs.
3+
- Austin Ziegler ([@halostatue][gh-user-halostatue]) created diff-lcs.
44

55
Thanks to everyone else who has contributed to diff-lcs over the years:
66

7-
- @ginriki
8-
- @joshbronson
9-
- @kevinmook
10-
- @mckaz
7+
- [@ginriki][gh-user-ginriki]
8+
- [@joshbronson][gh-user-joshbronson]
9+
- [@kevinmook][gh-user-kevinmook]
10+
- [@mckaz][gh-user-mckaz]
1111
- Akinori Musha
1212
- Artem Ignatyev
1313
- Brandon Fish
14-
- Baptiste Courtois (@annih)
14+
- Baptiste Courtois ([@annih][gh-user-annih])
1515
- Camille Drapier
1616
- Cédric Boutillier
17-
- @earlopain
17+
- [@earlopain][gh-user-earlopain]
1818
- Gregg Kellogg
1919
- Jagdeep Singh
2020
- Jason Gladish
2121
- Jon Rowe
2222
- Josef Strzibny
23-
- Josep (@apuratepp)
23+
- Josep ([@apuratepp][gh-user-apuratepp])
2424
- Josh Bronson
2525
- Jun Aruga
2626
- Justin Steele
@@ -44,6 +44,16 @@ Thanks to everyone else who has contributed to diff-lcs over the years:
4444
- Ryan Lovelett
4545
- Scott Steele
4646
- Simon Courtois
47-
- Tien (@tiendo1011)
47+
- Tien ([@tiendo1011][gh-user-tiendo1011])
4848
- Tomas Jura
4949
- Vít Ondruch
50+
51+
[gh-user-halostatue]: https://github.com/halostatue
52+
[gh-user-ginriki]: https://github.com/ginriki
53+
[gh-user-joshbronson]: https://github.com/joshbronson
54+
[gh-user-kevinmook]: https://github.com/kevinmook
55+
[gh-user-mckaz]: https://github.com/mckaz
56+
[gh-user-annih]: https://github.com/annih
57+
[gh-user-earlopain]: https://github.com/earlopain
58+
[gh-user-apuratepp]: https://github.com/apuratepp
59+
[gh-user-tiendo1011]: https://github.com/tiendo1011

Manifest.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ README.md
88
Rakefile
99
SECURITY.md
1010
bin/ldiff
11+
integration/compare/array_diff_spec.rb
12+
integration/compare/hash_diff_spec.rb
13+
integration/compare/string_diff_spec.rb
14+
integration/rspec_differ_spec.rb
15+
integration/rspec_expectations_spec.rb
16+
integration/runner
1117
lib/diff-lcs.rb
1218
lib/diff/lcs.rb
1319
lib/diff/lcs/array.rb
@@ -103,6 +109,7 @@ test/fixtures/new-chef
103109
test/fixtures/new-chef2
104110
test/fixtures/old-chef
105111
test/fixtures/old-chef2
112+
test/test_block.rb
106113
test/test_change.rb
107114
test/test_diff.rb
108115
test/test_helper.rb

0 commit comments

Comments
 (0)