Skip to content

Test more recent versions of Ruby on Travis #480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 2, 2020

Conversation

davidstosik
Copy link
Contributor

@davidstosik davidstosik commented Oct 2, 2020

Added:

  • 2.4.9 (reached end-of-life but may temporarily help in incremental debugging)
  • 2.5.8
  • 2.6.6

Did not add 2.7.x yet because it introduces a lot of warnings.

Did not remove any past version yet because until decided otherwise, they should be supported by the gem. (I would recommend a major version bump when those versions get dropped.)

The idea is that developments from now on should be future-proof, and changes should be tested on current versions of Ruby.


Note I had to relax WebMock's version because it introduced support for Ruby 2.4 in its version 2.3.1.

This does not work yet. There is one spec that used to pass with the older version of WebMock (in older versions of Ruby), but that does not pas anymore.
My guess is that it relied on some implementation detail of the WebMock gem, so I am working on finding out how to fix this.

(Additional note: I just noticed Cucumber runs only if RSpec succeeds. Running Cucumber locally, I noticed 4 scenarios fail, also potentially due to changes in WebMock.)

Added:
- 2.4.9 (reached end-of-life but may temporarily help in incremental debugging)
- 2.5.8
- 2.6.6

Did not add 2.7.x yet because it introduces *a lot* of warnings.

Did not remove any past version yet because until decided otherwise,
they should be supported by the gem. (I would recommend a major version
bump when those versions get dropped.)

The idea is that developments from now on should be future-proof, and
changes should be tested on current versions of Ruby.
@davidstosik davidstosik changed the title Test more recent versions of Ruby on Travis [WIP] Test more recent versions of Ruby on Travis Oct 2, 2020
Updating to WebMock 2.x means that:

> require 'webmock' does not enable WebMock anymore. gem 'webmock' can
now be safely added to a Gemfile and no http client libs will be
modified when it's loaded. Call WebMock.enable! to enable WebMock.
>
> Please note that require 'webmock/rspec', require 'webmock/test_unit',
require 'webmock/minitest' and require 'webmock/cucumber' still do
enable WebMock.

Source: [WebMock's
CHANGELOG.md](https://github.com/bblimke/webmock/blob/master/CHANGELOG.md#200).

As rspec_api_documentation is very much tied to RSpec, I saw no problem
with replacing all instances of `require 'webmock'` with `require
'webmock/rspec'`.
@davidstosik
Copy link
Contributor Author

davidstosik commented Oct 2, 2020

An additional note on WebMock. I updated it to the latest 2.x because Ruby 2.4 support was introduced in 2.3.1, but 3.x versions of WebMock introduce more changes that will require more adjustments on rspec_api_documentation's side.
Going with small iterations to make every step clear, understandable and safe to merge.

Updating to WebMock 2.x means that:

require 'webmock' does not enable WebMock anymore. gem 'webmock' can now be safely added to a Gemfile and no http client libs will be modified when it's loaded. Call WebMock.enable! to enable WebMock.

Please note that require 'webmock/rspec', require 'webmock/test_unit', require 'webmock/minitest' and require 'webmock/cucumber' still do enable WebMock.

(Source: WebMock's CHANGELOG.md.)

As rspec_api_documentation is very much tied to RSpec, I saw no problem with replacing all instances of require 'webmock' with require 'webmock/rspec'. Let me know if that was wrong. 🙏

@jakehow
Copy link
Member

jakehow commented Oct 2, 2020

Agreed on approach to adding modern ruby support, and needing a major release in order to drop old rubies.

require 'webmock/rspec' also makes sense to me.

@davidstosik
Copy link
Contributor Author

davidstosik commented Oct 2, 2020

Thanks for the feedback! Now have to get in to work with Ruby 2.6... 👀

(Hmm, Ruby 2.6 support was added to WebMock in its version 3.5.0... This is neverending! 😅 )

3.2.0 introduced another breaking change that had to be addressed:

[Automatically disable WebMock after rspec suite](bblimke/webmock#731)

As the example app_spec.rb in features/oauth2_mac_client.feature is supposed to be a stand-alone spec file, it made sense, to me, to `require "webmock/rspec"`.
Does that make any sense?
This introduces Ruby 2.6 support and should get the test suite to run on that version of Ruby.
@davidstosik
Copy link
Contributor Author

davidstosik commented Oct 2, 2020

Notes:

  • WebMock 3.9.0 dropped support for Ruby 2.3 and 2.4 (in a minor version bump 🤔). I won't go further than 3.8.3 (if it can pass all the currently tested versions) in this PR.
  • ruby-build was unable to install Ruby 2.1.8 and 2.2.4 on macOS Catalina. Won't debug or try hard. I'll just rely on Travis. 😬

Let's see how this goes on Travis.
@davidstosik davidstosik changed the title [WIP] Test more recent versions of Ruby on Travis Test more recent versions of Ruby on Travis Oct 2, 2020
@davidstosik davidstosik changed the title Test more recent versions of Ruby on Travis Test more recent versions of Ruby on Travis Oct 2, 2020
@davidstosik
Copy link
Contributor Author

Ready to go. :shipit: 🚀

@jakehow
Copy link
Member

jakehow commented Oct 2, 2020

🙏

@jakehow jakehow merged commit 1a164bc into zipmark:master Oct 2, 2020
@davidstosik davidstosik deleted the recent-ruby-travis branch October 4, 2020 10:15
E1337Kat pushed a commit to E1337Kat/rspec_api_documentation that referenced this pull request Mar 5, 2024
* Test more recent versions of Ruby on Travis

Added:
- 2.4.9 (reached end-of-life but may temporarily help in incremental debugging)
- 2.5.8
- 2.6.6

Did not add 2.7.x yet because it introduces *a lot* of warnings.

Did not remove any past version yet because until decided otherwise,
they should be supported by the gem. (I would recommend a major version
bump when those versions get dropped.)

The idea is that developments from now on should be future-proof, and
changes should be tested on current versions of Ruby.

* Update WebMock to latest 2.x version

Updating to WebMock 2.x means that:

> require 'webmock' does not enable WebMock anymore. gem 'webmock' can
now be safely added to a Gemfile and no http client libs will be
modified when it's loaded. Call WebMock.enable! to enable WebMock.
>
> Please note that require 'webmock/rspec', require 'webmock/test_unit',
require 'webmock/minitest' and require 'webmock/cucumber' still do
enable WebMock.

Source: [WebMock's
CHANGELOG.md](https://github.com/bblimke/webmock/blob/master/CHANGELOG.md#200).

As rspec_api_documentation is very much tied to RSpec, I saw no problem
with replacing all instances of `require 'webmock'` with `require
'webmock/rspec'`.

* Update WebMock dependency to 3.2.0

3.2.0 introduced another breaking change that had to be addressed:

[Automatically disable WebMock after rspec suite](bblimke/webmock#731)

As the example app_spec.rb in features/oauth2_mac_client.feature is supposed to be a stand-alone spec file, it made sense, to me, to `require "webmock/rspec"`.
Does that make any sense?

* Bump WebMock dev dependency to 3.5.0

This introduces Ruby 2.6 support and should get the test suite to run on that version of Ruby.

* Try using WebMock 3.8.3

Let's see how this goes on Travis.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants