Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

its against BasicObject fails to generate description #46

Open
dnagir opened this issue Oct 18, 2017 · 1 comment
Open

its against BasicObject fails to generate description #46

dnagir opened this issue Oct 18, 2017 · 1 comment

Comments

@dnagir
Copy link

dnagir commented Oct 18, 2017

When the subject is a BasicObject (which of course doesn't have respond_to?, is_a? and others) then RSpec (or rspec/its) cannot generate the test description.

Example code:

class Foo <BasicObject
  def name; 'hello'; end
end

RSpec.describe Foo do
  its(:name) { is_expected.to eq 'hello' }
end

This generates output similar to:

 example at .<spec file>:10 (Got an error when generating description from matcher: NoMethodError: undefined method `is_a?' for #<Foo:0x007fcd4c3bd938> -- /.../ruby-2.4.1/gems/activesupport-5.1.4/lib/active_support/core_ext/time/calculations.rb:16:in `===')

I'm not sure of there's the "right" way to fix this as it is not even possible to use respond_to? on the BasicObject.
But worth raising this.

@JonRowe
Copy link
Member

JonRowe commented Jan 10, 2019

Apologies for the long time taken to get an answer to this, I feel like this was probably fixed upstream, would you mind re-testing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants