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

Prevent its(:to_i) from generated tests #639

Merged
merged 1 commit into from Apr 15, 2016
Merged

Prevent its(:to_i) from generated tests #639

merged 1 commit into from Apr 15, 2016

Conversation

alexpop
Copy link
Contributor

@alexpop alexpop commented Apr 14, 2016

This is because the rspec-its dependency is not working properly for strings:

require 'rspec/its'

describe "655555" do
  its("size") { should be <= 4 }
  its(:size) { should be <= 4 }
  its(:to_i) { should be <= 4 }
  its("length") { should be <= 4 }
end

Expecting all tests to fail:

$ rspec

655555
  size
    should be <= 4
  size
    should be <= 4
  to_i
    should be <= 4
  length
    should be <= 4 (FAILED - 1)

Failures:

  1) 655555 length should be <= 4
     Failure/Error: its("length") { should be <= 4 }

       expected: <= 4
            got:    6
     # ./spec/unit/default_spec.rb:7:in `block (2 levels) in <top (required)>'

Finished in 0.01098 seconds (files took 0.08507 seconds to load)
4 examples, 1 failure

@arlimus
Copy link
Contributor

arlimus commented Apr 15, 2016

Thank you @alexpop for working around this issue!

Let me be clear: I hate that we have to merge this in, as the underlying framework (afaics) produces this unexpected behavior. We'll have to reconsider some of its work 😁

Kudos Alex 👍

@arlimus arlimus merged commit c68edb5 into master Apr 15, 2016
@arlimus arlimus deleted the ap/no-its-to_i branch April 15, 2016 05:11
@arlimus arlimus added the Type: Bug Feature not working as expected label Apr 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Feature not working as expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants