You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The wrapper class here is a quick example of the behavior. While the example does not use the timeout library methods it is present in a larger project I am currently working on.
When I execute the tests I see an error that is the same error if you ran timeout without any parameters
$ rspec example_spec.rb
./usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rspec-its-1.2.0/lib/rspec/its.rb:115:in `block (3 levels) in its': Object#timeout is deprecated, use Timeout.timeout instead.FFailures: 1) DatabaseConfg development.timeout Failure/Error: its('development.timeout') { should eq 5000 } ArgumentError: wrong number of arguments (given 0, expected 1..3) # ./rspec_example_spec.rb:15:in `block (2 levels) in <top (required)>'Finished in 0.00413 seconds (files took 0.13378 seconds to load)2 examples, 1 failureFailed examples:rspec ./rspec_example_spec.rb:15 # DatabaseConfg development.timeout
The text was updated successfully, but these errors were encountered:
burtlo
changed the title
When requiring the Ruby's timeout library I can no longer retrieve a nested attribute named timeout
When requiring the Ruby's timeout library I can no longer retrieve a nested attribute named timeout on an OpenStruct
Mar 23, 2018
I tried this with a Hashie::Mash and run into the same issue. If I recall correctly these libraries do not define the methods but instead rely on method_missing to proxy the request or dynamically generate the method and proxy the request.
To workaround it, I created a timeout method on the instance itself.
It seems that require 'timeout' is monkey patching BasicObject and injects .timeout.
To confirm that, you can call development.send(:timeout), you'll get a
warning: Object#timeout is deprecated, use Timeout.timeout instead.
in addition to an ArgumentError exception because you're not passing the timeout in seconds.
The wrapper class here is a quick example of the behavior. While the example does not use the
timeout
library methods it is present in a larger project I am currently working on.Given this yaml file:
And a test file:
When I execute the tests I see an error that is the same error if you ran
timeout
without any parametersThe text was updated successfully, but these errors were encountered: