Skip to content

Commit

Permalink
Add support for detecting refinement support
Browse files Browse the repository at this point in the history
  • Loading branch information
JonRowe committed Jun 10, 2019
1 parent 6cce340 commit f74f31b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/rspec/support/ruby_features.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ def supports_rebinding_module_methods?
# rubocop:enable Lint/Eval
end

def module_refinement_supported?
Module.method_defined?(:refine) || Module.private_method_defined?(:refine)
end

def module_prepends_supported?
Module.method_defined?(:prepend) || Module.private_method_defined?(:prepend)
end
Expand Down
6 changes: 6 additions & 0 deletions spec/rspec/support/ruby_features_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ module Support
end

describe RubyFeatures do
specify "#module_refinedment_supported? reflects refinement support" do
if Ruby.mri? && RUBY_VERSION >= '2.1.0'
expect(RubyFeatures.module_refinement_supported?).to eq true
end
end

specify "#supports_exception_cause? exists" do
RubyFeatures.supports_exception_cause?
end
Expand Down

0 comments on commit f74f31b

Please sign in to comment.