Skip to content

Commit 29e2941

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

19 files changed

Lines changed: 339 additions & 64 deletions

.github/workflows/ci.yml

Lines changed: 45 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,14 @@ jobs:
129129

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

132+
- if: ${{ matrix.ruby == 'truffleruby' }}
133+
run: find vendor/bundle
134+
135+
- name: Verify RSpec compatibility
136+
run: |
137+
gem install rspec
138+
integration/runner rake integration
139+
132140
required-macos:
133141
name: Ruby ${{ matrix.ruby }} - ${{ matrix.os }}
134142

@@ -167,7 +175,7 @@ jobs:
167175
with:
168176
persist-credentials: false
169177

170-
- uses: ruby/setup-ruby@675dd7ba1b06c8786a1480d89c384f5620a42647 # v1.281.0
178+
- uses: ruby/setup-ruby@708024e6c902387ab41de36e1669e43b5ee7085e # v1.283.0
171179
with:
172180
ruby-version: ${{ matrix.ruby }}
173181
rubygems: latest
@@ -176,6 +184,13 @@ jobs:
176184

177185
- run: bundle exec ruby -S rake test --trace
178186

187+
- name: Verify RSpec compatibility
188+
env:
189+
GEM_PATH: vendor/bundle
190+
run: |
191+
gem install rspec
192+
integration/runner rake integration
193+
179194
optional-windows:
180195
name: Ruby ${{ matrix.ruby }} - ${{ matrix.os }}
181196

@@ -216,7 +231,7 @@ jobs:
216231
with:
217232
persist-credentials: false
218233

219-
- uses: ruby/setup-ruby@675dd7ba1b06c8786a1480d89c384f5620a42647 # v1.281.0
234+
- uses: ruby/setup-ruby@708024e6c902387ab41de36e1669e43b5ee7085e # v1.283.0
220235
with:
221236
ruby-version: ${{ matrix.ruby }}
222237
rubygems: latest
@@ -225,6 +240,13 @@ jobs:
225240

226241
- run: bundle exec ruby -S rake test --trace
227242

243+
- name: Verify RSpec compatibility
244+
env:
245+
GEM_PATH: vendor/bundle
246+
run: |
247+
gem install rspec
248+
integration/runner rake integration
249+
228250
jruby-optional:
229251
name: JRuby ${{ matrix.ruby }} - ${{ matrix.os }}
230252

@@ -262,7 +284,7 @@ jobs:
262284
with:
263285
persist-credentials: false
264286

265-
- uses: ruby/setup-ruby@675dd7ba1b06c8786a1480d89c384f5620a42647 # v1.281.0
287+
- uses: ruby/setup-ruby@708024e6c902387ab41de36e1669e43b5ee7085e # v1.283.0
266288
with:
267289
ruby-version: ${{ matrix.ruby }}
268290
rubygems: latest
@@ -271,6 +293,15 @@ jobs:
271293

272294
- run: bundle exec ruby -S rake test --trace
273295

296+
- run: find vendor/bundle
297+
298+
- name: Verify RSpec compatibility
299+
env:
300+
GEM_PATH: vendor/bundle
301+
run: |
302+
gem install rspec
303+
integration/runner rake integration
304+
274305
ruby-head-optional:
275306
name: Ruby ${{ matrix.ruby }} - ${{ matrix.os }} (optional)
276307

@@ -308,11 +339,18 @@ jobs:
308339
with:
309340
persist-credentials: false
310341

311-
- uses: ruby/setup-ruby@675dd7ba1b06c8786a1480d89c384f5620a42647 # v1.281.0
342+
- uses: ruby/setup-ruby@708024e6c902387ab41de36e1669e43b5ee7085e # v1.283.0
312343
with:
313344
ruby-version: ${{ matrix.ruby }}
314345
rubygems: latest
315346
bundler: 2
316347
bundler-cache: true
317348

318349
- run: bundle exec ruby -S rake test --trace
350+
351+
- name: Verify RSpec compatibility
352+
env:
353+
GEM_PATH: vendor/bundle
354+
run: |
355+
gem install rspec
356+
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)