Skip to content

Commit efd336f

Browse files
committed
test: use current ruby for macos integration
1 parent 0894bb3 commit efd336f

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

test/cookbooks/test/recipes/default.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
ruby_build_install
55

6-
ruby_build_definition '3.0.4' do
6+
ruby_version = platform_family?('mac_os_x') ? '3.3.10' : '3.0.4'
7+
8+
ruby_build_definition ruby_version do
79
version_prefix true
8-
patch 'test.patch'
10+
patch 'test.patch' unless platform_family?('mac_os_x')
911
end

test/integration/default/controls/verify_ruby_build.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
ruby_version = os.darwin? ? '3.3.10' : '3.0.4'
2+
ruby_api_version = ruby_version.sub(/\.\d+$/, '.0')
3+
14
control 'Check definitions' do
25
impact 1.0
36
title 'Verify we can return a list of definitions'
47
desc 'Verify we can get a list of Ruby definitions'
58
describe command('/usr/local/bin/ruby-build --definitions') do
69
its('exit_status') { should eq 0 }
7-
its('stdout') { should match /3.0.4/ }
10+
its('stdout') { should match /#{Regexp.escape(ruby_version)}/ }
811
end
912
end
1013

@@ -19,9 +22,9 @@
1922
end
2023

2124
gem_cmd = if os.darwin?
22-
'sudo /usr/local/ruby/3.0.4/bin/gem install ffi --no-document'
25+
"sudo /usr/local/ruby/#{ruby_version}/bin/gem install ffi --no-document"
2326
else
24-
'/usr/local/ruby/3.0.4/bin/gem install ffi --no-document'
27+
"/usr/local/ruby/#{ruby_version}/bin/gem install ffi --no-document"
2528
end
2629

2730
control 'Install a Ruby gem' do
@@ -34,8 +37,8 @@
3437
its('stdout') { should match /Successfully installed ffi/ }
3538
end
3639

37-
describe command('/usr/local/ruby/3.0.4/bin/gem env') do
40+
describe command("/usr/local/ruby/#{ruby_version}/bin/gem env") do
3841
its('exit_status') { should eq 0 }
39-
its('stdout') { should match %r{gems/3.0.0} }
42+
its('stdout') { should match %r{gems/#{Regexp.escape(ruby_api_version)}} }
4043
end
4144
end

0 commit comments

Comments
 (0)