Skip to content

Commit

Permalink
(PA-7091) Update for ruby 3.2 - 3.4
Browse files Browse the repository at this point in the history
Ruby 3.2 introduced two breaking changes:
* String#taint was removed entirely
* Fixnum was removed in favor of Integer

Updates the gemspec to allow 3.2 - 3.4

Update workflow to test on the new versions
  • Loading branch information
joshcooper committed Jan 17, 2025
1 parent 9c5ceda commit 8527563
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ jobs:
- ruby: "3.0"
coverage: "yes"
- ruby: "3.1"
- ruby: "3.2"
- ruby: "3.3"
- ruby: "3.4"

env:
COVERAGE: ${{ matrix.coverage }}
Expand Down
2 changes: 1 addition & 1 deletion beaker-puppet.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Gem::Specification.new do |s|
s.description = 'For use for the Beaker acceptance testing tool'
s.license = 'Apache-2.0'

s.required_ruby_version = '>= 2.7', '< 3.2'
s.required_ruby_version = '>= 2.7', '< 3.5'

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
Expand Down
15 changes: 1 addition & 14 deletions lib/beaker-puppet/inifile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -343,17 +343,6 @@ def freeze
self
end

# Public: Mark this IniFile as tainted -- this will traverse each section
# marking each as tainted.
#
# Returns this IniFile.
def taint
super
@ini.each_value {|h| h.taint}
@ini.taint
self
end

# Public: Produces a duplicate of this IniFile. The duplicate is independent
# of the original -- i.e. the duplicate can be modified without changing the
# original. The tainted state of the original is copied to the duplicate.
Expand All @@ -363,14 +352,12 @@ def dup
other = super
other.instance_variable_set(:@ini, Hash.new {|h,k| h[k] = Hash.new})
@ini.each_pair {|s,h| other[s].merge! h}
other.taint if self.tainted?
other
end

# Public: Produces a duplicate of this IniFile. The duplicate is independent
# of the original -- i.e. the duplicate can be modified without changing the
# original. The tainted state and the frozen state of the original is copied
# to the duplicate.
# original.
#
# Returns a new IniFile.
def clone
Expand Down
2 changes: 1 addition & 1 deletion spec/beaker-puppet/helpers/facter_helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def logger
allow(subject).to receive(:on).and_return(result)
structured_fact = subject.fact_on('host', 'identity')

expect(structured_fact['uid'].class).to be Fixnum
expect(structured_fact['uid'].class).to be Integer
expect(structured_fact['user'].class).to be String
expect(structured_fact['privileged'].class).to be (TrueClass or FalseClass)
end
Expand Down

0 comments on commit 8527563

Please sign in to comment.