Skip to content

Commit c7ec752

Browse files
author
Machiel van der Bijl
committed
Fix RSpec config for Ruby < 3.2
1 parent 17e156b commit c7ec752

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

spec/opcua_client/client_spec.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@
1010
describe 'read_byte'
1111

1212
it 'allows disconnect for unconnected clients' do
13-
result = new_client(connect: false).disconnect
13+
client = described_class.new
14+
result = client.disconnect
15+
# result = new_client(connect: false).disconnect
1416
expect(result).to eq(0)
1517
end
1618

1719
it 'returns 0 state' do
18-
state = new_client(connect: false).state
20+
client = described_class.new
21+
state = client.state
22+
# state = new_client(connect: false).state
1923
expect(state).to eq(0)
2024
end
2125
end

spec/spec_helper.rb

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,16 @@
77
if GC.respond_to?(:verify_compaction_references)
88
# This method was added in Ruby 3.0.0. Calling it this way asks the GC to
99
# move objects around, helping to find object movement bugs.
10-
GC.verify_compaction_references(expand_heap: true, toward: :empty)
10+
# The expand_heap parameter was added in Ruby 3.2.0
11+
if RUBY_VERSION >= '3.2.0'
12+
GC.verify_compaction_references(expand_heap: true, toward: :empty)
13+
else
14+
GC.verify_compaction_references(toward: :empty)
15+
end
1116
end
1217

1318
def new_client(connect: true)
14-
client = OPCUAClient::Client.new
15-
16-
if connect
17-
# TODO
18-
end
19-
20-
client
19+
OPCUAClient::Client.new
2120
end
2221

2322
RSpec.configure do |config|

0 commit comments

Comments
 (0)