Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Expose wether exception cause is supported #240

Merged
merged 1 commit into from
Oct 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/rspec/support/ruby_features.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ def caller_locations_supported?
respond_to?(:caller_locations, true)
end

if Exception.method_defined?(:cause)
def supports_exception_cause?
true
end
else
def supports_exception_cause?
false
end
end

if Ruby.mri?
def kw_args_supported?
RUBY_VERSION >= '2.0.0'
Expand Down
4 changes: 4 additions & 0 deletions spec/rspec/support/ruby_features_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ module Support
end

describe RubyFeatures do
specify "#supports_exception_cause? exists" do
RubyFeatures.supports_exception_cause?
end

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