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

Dependency limitations #142

Open
Amourlive opened this issue Jan 28, 2022 · 2 comments
Open

Dependency limitations #142

Amourlive opened this issue Jan 28, 2022 · 2 comments
Labels

Comments

@Amourlive
Copy link

Please add dependency limitations. Your gem is incompatible with rspec before version 3.4.1 at least.
https://github.com/rspec/rspec-support/blame/a0bc8606b33041dee1e1eae17def1e37ed4bf734/lib/rspec/support/object_formatter.rb

Before rspec 3.4.1, the ObjectFormatter class was a module.

@mcmire
Copy link
Collaborator

mcmire commented Jan 28, 2022

You're right — the RSpec part of this gem was implemented against RSpec 3.8.0 or greater. I don't think we can add a constraint in the gemfile because there are some parts of this gem you can use without using RSpec specifically (and support for other frameworks is planned for the future), but it might be a good idea to add a runtime check at the top of super_diff/rspec.rb, after the import "super_diff" line. Perhaps something like:

if !defined?(RSpec)
  raise LoadError, "RSpec is not available — are you using this in an RSpec environment?"
end

rspec_version = Gem::Version.new(RSpec::VERSION)
rspec_requirement = Gem::Requirement.new(">= 3.8.0")

if !rspec_requirement.satisfied_by?(rspec_version)
  raise LoadError, "RSpec >= 3.8.0 is required to use super_diff/rspec."
end

@AlexeyMatskevich
Copy link

I like this solution!
Thank you for considering my issue.

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

No branches or pull requests

3 participants