Skip to content

Commit 1a164bc

Browse files
authoredOct 2, 2020
Test more recent versions of Ruby on Travis (#480)
* 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.
1 parent 66a253a commit 1a164bc

File tree

6 files changed

+8
-4
lines changed

6 files changed

+8
-4
lines changed
 

‎.travis.yml

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ rvm:
33
- 2.1.8
44
- 2.2.4
55
- 2.3.0
6+
- 2.4.9
7+
- 2.5.8
8+
- 2.6.6
69
gemfile:
710
- Gemfile
811
script:

‎features/oauth2_mac_client.feature

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Feature: Use OAuth2 MAC client as a test client
22
Background:
33
Given a file named "app_spec.rb" with:
44
"""
5+
require "webmock/rspec"
56
require "rspec_api_documentation"
67
require "rspec_api_documentation/dsl"
78
require "rack/builder"

‎lib/rspec_api_documentation/dsl/resource.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def self.define_action(method)
3030

3131
def callback(*args, &block)
3232
begin
33-
require 'webmock'
33+
require 'webmock/rspec'
3434
rescue LoadError
3535
raise "Callbacks require webmock to be installed"
3636
end

‎lib/rspec_api_documentation/oauth2_mac_client.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# ActiveSupport::SecureRandom not provided in activesupport >= 3.2
55
end
66
begin
7-
require "webmock"
7+
require "webmock/rspec"
88
rescue LoadError
99
raise "Webmock needs to be installed before using the OAuth2MACClient"
1010
end

‎rspec_api_documentation.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
2626
s.add_development_dependency "rake", "~> 10.5.0"
2727
s.add_development_dependency "rack-test", "~> 0.6.3"
2828
s.add_development_dependency "rack-oauth2", "~> 1.2.2"
29-
s.add_development_dependency "webmock", "~> 1.22.6"
29+
s.add_development_dependency "webmock", "~> 3.8.3"
3030
s.add_development_dependency "rspec-its", "~> 1.2.0"
3131
s.add_development_dependency "faraday", "~> 0.9.2"
3232
s.add_development_dependency "nokogiri", "~> 1.8.4"

‎spec/http_test_client_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require 'capybara'
44
require 'capybara/server'
55
require 'sinatra/base'
6-
require 'webmock'
6+
require 'webmock/rspec'
77
require 'support/stub_app'
88

99
describe RspecApiDocumentation::HttpTestClient do

0 commit comments

Comments
 (0)