From 2fb4602f7b6e34aa1d925f9aefe873c3a6fcbb18 Mon Sep 17 00:00:00 2001 From: "James I. Armes" Date: Sat, 13 May 2023 02:03:51 -0400 Subject: [PATCH] Fix test failures caused by ruby syntax changes. --- .travis.yml | 11 +++-------- features/step_definitions/github_api_steps.rb | 2 +- features/support/settings.rb | 2 +- github_api.gemspec | 4 ++-- spec/github/pagination/iterator/number_spec.rb | 10 +++++----- spec/github/pagination/iterator/sha_spec.rb | 6 +++--- 6 files changed, 15 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3af3dfcc..5600b6cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,14 +3,9 @@ language: ruby before_install: "gem install bundler -v '< 2.0'" script: "bundle exec rake ci" rvm: - - 2.0 - - 2.1 - - 2.2 - - 2.3 - - 2.4 - - 2.5 - - 2.6 - - 2.7 + - 3.0 + - 3.1 + - 3.2 - ruby-head - jruby-9.2.11.1 - jruby-head diff --git a/features/step_definitions/github_api_steps.rb b/features/step_definitions/github_api_steps.rb index 5d8f05fe..93957391 100644 --- a/features/step_definitions/github_api_steps.rb +++ b/features/step_definitions/github_api_steps.rb @@ -95,7 +95,7 @@ end Then /^the response collection of resources is different for "([^"]*)" attribute$/ do |attr| - @next_response.first.send(:"#{attr}").should_not eql @response.first.send(:"#{attr}") + expect(@next_response.first.send(:"#{attr}")).to_not eql @response.first.send(:"#{attr}") end Then /^this collection should include first page$/ do diff --git a/features/support/settings.rb b/features/support/settings.rb index 91756071..b63f1e2d 100644 --- a/features/support/settings.rb +++ b/features/support/settings.rb @@ -8,4 +8,4 @@ def live_credentials? true end -SETTINGS = (live_credentials? && File.exists?(settings_file) && yaml= YAML.load_file(settings_file)) ? yaml : {'basic_auth' => 'login:password', 'oauth_token' => 'as79asfd79ads', 'user'=> 'murek', 'repo' => 'dummy', 'email' => 'email@example.com'} +SETTINGS = (live_credentials? && File.exist?(settings_file) && yaml= YAML.load_file(settings_file)) ? yaml : {'basic_auth' => 'login:password', 'oauth_token' => 'as79asfd79ads', 'user'=> 'murek', 'repo' => 'dummy', 'email' => 'email@example.com'} diff --git a/github_api.gemspec b/github_api.gemspec index ce95504e..aa548b20 100644 --- a/github_api.gemspec +++ b/github_api.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |gem| gem.summary = "Ruby client for the official GitHub API" gem.description = %q{ Ruby client that supports all of the GitHub API methods. It"s build in a modular way, that is, you can either instantiate the whole api wrapper Github.new or use parts of it e.i. Github::Client::Repos.new if working solely with repositories is your main concern. Intuitive query methods allow you easily call API endpoints. } gem.license = "MIT" - gem.required_ruby_version = ">= 2.0.0" + gem.required_ruby_version = "~> 3.0" gem.files = Dir["lib/**/*"] gem.require_paths = %w[ lib ] @@ -28,6 +28,6 @@ Gem::Specification.new do |gem| gem.add_development_dependency "cucumber", "~> 2.1" gem.add_development_dependency "rspec", "~> 3" gem.add_development_dependency "rspec-its","~> 1" - gem.add_development_dependency "vcr", "~> 3.0.3" + gem.add_development_dependency "vcr", "~> 6.0" gem.add_development_dependency "webmock", "~> 3.8" end diff --git a/spec/github/pagination/iterator/number_spec.rb b/spec/github/pagination/iterator/number_spec.rb index 36c3bf3b..f150723d 100644 --- a/spec/github/pagination/iterator/number_spec.rb +++ b/spec/github/pagination/iterator/number_spec.rb @@ -58,7 +58,7 @@ it 'performs request' do expect(iterator).to receive(:page_request). - with("/users/#{user}/repos", 'per_page' => 20, 'page' => 1). + with("/users/#{user}/repos", { 'per_page' => 20, 'page' => 1 }). and_return(response) iterator.first end @@ -72,7 +72,7 @@ it 'performs request' do expect(iterator).to receive(:page_request). - with("/users/#{user}/repos", 'page' => 4,'per_page' => 20). + with("/users/#{user}/repos", { 'page' => 4,'per_page' => 20 }). and_return(response) iterator.next end @@ -86,7 +86,7 @@ it 'performs request' do expect(iterator).to receive(:page_request). - with("/users/#{user}/repos", 'page' => 2,'per_page' => 20). + with("/users/#{user}/repos", { 'page' => 2,'per_page' => 20 }). and_return(response) iterator.prev end @@ -100,7 +100,7 @@ it 'performs request' do expect(iterator).to receive(:page_request). - with("/users/#{user}/repos", 'page' => 6,'per_page' => 20). + with("/users/#{user}/repos", { 'page' => 6,'per_page' => 20 }). and_return(response) iterator.last end @@ -115,7 +115,7 @@ it 'performs request' do expect(iterator).to receive(:page_request). - with("/users/#{user}/repos", 'page' => 2,'per_page' => 20). + with("/users/#{user}/repos", { 'page' => 2,'per_page' => 20 }). and_return(response) iterator.get_page(2) end diff --git a/spec/github/pagination/iterator/sha_spec.rb b/spec/github/pagination/iterator/sha_spec.rb index 8ab4243d..d5f07088 100644 --- a/spec/github/pagination/iterator/sha_spec.rb +++ b/spec/github/pagination/iterator/sha_spec.rb @@ -49,7 +49,7 @@ it 'performs request' do expect(iterator).to receive(:page_request). with("/repos/peter-murach/github/commits", - 'sha' => 'master', 'per_page' => 30).and_return(response) + { 'sha' => 'master', 'per_page' => 30 }).and_return(response) iterator.first end end @@ -57,8 +57,8 @@ context 'next page request' do it 'performs request' do expect(iterator).to receive(:page_request). - with("/repos/peter-murach/github/commits", 'last_sha' => last_sha, - 'sha' => last_sha, 'per_page' => 30, 'top' => top_sha). + with("/repos/peter-murach/github/commits", { 'last_sha' => last_sha, + 'sha' => last_sha, 'per_page' => 30, 'top' => top_sha }). and_return(response) iterator.next end