k1LoW / awspec

RSpec tests for your AWS resources.
MIT License
1.17k stars 194 forks source link

Error requiring awspec when using Ruby 3.1.0 #553

Closed JeremyLoye closed 2 years ago

JeremyLoye commented 2 years ago

After updating the Ruby version to Ruby 3.1.0, the following error was encountered:

Failure/Error: require "awspec"

NameError:
  undefined method 'timeout' for class 'Awspec::Type::Base'
# ./vendor/bundle/ruby/3.1.0/bundler/gems/awspec-c438897a9555/lib/awspec/type/base.rb:55:in '<class:Base>'
# ./vendor/bundle/ruby/3.1.0/bundler/gems/awspec-c438897a9555/lib/awspec/type/base.rb:7:in '<module:Type>'
# ./vendor/bundle/ruby/3.1.0/bundler/gems/awspec-c438897a9555/lib/awspec/type/base.rb:6:in '<top (required)>'
# ./vendor/bundle/ruby/3.1.0/bundler/gems/awspec-c438897a9555/lib/awspec/helper/type.rb:4:in 'require'
# ./vendor/bundle/ruby/3.1.0/bundler/gems/awspec-c438897a9555/lib/awspec/helper/type.rb:4:in '<module:Type>'
# ./vendor/bundle/ruby/3.1.0/bundler/gems/awspec-c438897a9555/lib/awspec/helper/type.rb:3:in '<module:Helper>'
# ./vendor/bundle/ruby/3.1.0/bundler/gems/awspec-c438897a9555/lib/awspec/helper/type.rb:2:in '<module:Awspec>'
# ./vendor/bundle/ruby/3.1.0/bundler/gems/awspec-c438897a9555/lib/awspec/helper/type.rb:1:in '<top (required)>'
# ./vendor/bundle/ruby/3.1.0/bundler/gems/awspec-c438897a9555/lib/awspec/helper.rb:2:in 'require'
# ./vendor/bundle/ruby/3.1.0/bundler/gems/awspec-c438897a9555/lib/awspec/helper.rb:2:in '<top (required)>'
# ./vendor/bundle/ruby/3.1.0/bundler/gems/awspec-c438897a9555/lib/awspec.rb:16:in 'require'
# ./vendor/bundle/ruby/3.1.0/bundler/gems/awspec-c438897a9555/lib/awspec.rb:16:in '<top (required)>'
# ./spec/spec_helper.rb:22:in 'require'
# ./spec/spec_helper.rb:22:in '<top (required)>'

This seems to be an issue of incompatibility between awspec and ruby 3.1.0 due to the following line: undef :timeout in base.rb

Is this a known issue? And would removing just the line be an appropriate fix for the issue?

oudam-meas commented 2 years ago

If undef :timeout is needed, adding attr_reader :timeout should do it? so

attr_reader :timeout
undef :timeout 
k1LoW commented 2 years ago

Thank you for your report.

Fixed in https://github.com/k1LoW/awspec/releases/tag/v1.25.2