Skip to content

Commit e9a9170

Browse files
authored
update Rspec and examples to support Ruby 3.2 (#36)
* use ruby 3.2-compatible file.exist? * update rspec to support Ruby 3.2
1 parent c35d2c3 commit e9a9170

File tree

9 files changed

+16
-15
lines changed

9 files changed

+16
-15
lines changed

.github/workflows/tests.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ jobs:
1010
test:
1111
runs-on: ubuntu-latest
1212
strategy:
13+
fail-fast: false
1314
matrix:
1415
ruby-version:
1516
- 2.3.8
1617
- 2.4.6
1718
- 2.5.5
1819
- 2.6.3
19-
- 2.7.6
20-
- 3.0.4
21-
- 3.1.2
20+
- 2.7.7
21+
- 3.0.5
22+
- 3.1.3
2223
- 3.2.0
2324

2425
steps:

api_client.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
3131
end
3232

3333
# Declare development dependencies here:
34-
s.add_development_dependency 'rspec', '2.14.1'
34+
s.add_development_dependency 'rspec', '< 4'
3535

3636
if s.respond_to? :specification_version then
3737
s.specification_version = 3

examples/flickr.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require "rubygems"
22
require "bundler/setup"
3-
require "./examples/config" if File.exists?('examples/config.rb')
3+
require "./examples/config" if File.exist?('examples/config.rb')
44
require "api_client"
55

66
module Flickr

examples/github.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require "rubygems"
22
require "bundler/setup"
3-
require "./examples/config" if File.exists?('examples/config.rb')
3+
require "./examples/config" if File.exist?('examples/config.rb')
44
require "api_client"
55
require "time"
66

examples/highrise.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require "rubygems"
22
require "bundler/setup"
3-
require "./examples/config" if File.exists?('examples/config.rb')
3+
require "./examples/config" if File.exist?('examples/config.rb')
44
require "api_client"
55
require "multi_xml"
66

examples/twitter_oauth.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require "rubygems"
22
require "bundler/setup"
3-
require "./examples/config" if File.exists?('examples/config.rb')
3+
require "./examples/config" if File.exist?('examples/config.rb')
44
require "api_client"
55

66
module TwitterOauth

spec/api_client/base/connection_hook_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
class ConnectionHookTest < ApiClient::Base
1010
connection &ConnectionHookTestProc
1111
end
12-
ConnectionHookTest.connection_hooks.size.should == 1
13-
ConnectionHookTest.connection_hooks.should == [ConnectionHookTestProc]
12+
expect(ConnectionHookTest.connection_hooks.size).to eq(1)
13+
expect(ConnectionHookTest.connection_hooks).to eq([ConnectionHookTestProc])
1414
end
1515

1616
end

spec/api_client/base_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class StrictDescendant < StrictApi
8080
it "doesn't fail for predicate methods if key is not set" do
8181
api = StrictApi.new
8282
lambda { api.missing? }.should_not raise_error
83-
api.missing?.should be_false
83+
expect(api.missing?).to be false
8484
end
8585

8686
it "allows to call methods" do

spec/api_client/resource/base_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@
6464
describe "#remote_update" do
6565

6666
it "delegates the update to the class" do
67-
ApiClient::Resource::Base.should_receive(:update).with(42, "name" => "Mike")
67+
ApiClient::Resource::Base.should_receive(:update).with(42, { "name" => "Mike" })
6868
@instance.remote_update
6969
end
7070

7171
it "retains the original scope" do
7272
ApiClient::Resource::Base.stub(:update)
7373
@instance.original_scope = double
74-
@instance.original_scope.should_receive(:update).with(42, "name" => "Mike")
74+
@instance.original_scope.should_receive(:update).with(42, { "name" => "Mike" })
7575
@instance.remote_update
7676
end
7777

@@ -80,13 +80,13 @@
8080
describe "#remote_create" do
8181

8282
it "delegates the create to the class" do
83-
ApiClient::Resource::Base.should_receive(:create).with("name" => "Mike")
83+
ApiClient::Resource::Base.should_receive(:create).with({ "name" => "Mike" })
8484
@instance.remote_create
8585
end
8686

8787
it "retains the original scope" do
8888
@instance.original_scope = double
89-
@instance.original_scope.should_receive(:create).with("name" => "Mike")
89+
@instance.original_scope.should_receive(:create).with({ "name" => "Mike" })
9090
@instance.remote_create
9191
end
9292

0 commit comments

Comments
 (0)