1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2019-10-26 20:52:59 +02:00
parent 9c5a962354
commit 3eb0d50c0b
2 changed files with 5 additions and 8 deletions

View file

@ -6,10 +6,8 @@ class PlatformGuard < SpecGuard
case name
when :rubinius
RUBY_ENGINE.start_with?('rbx')
when :ruby, :jruby, :truffleruby, :ironruby, :macruby, :maglev, :topaz, :opal
RUBY_ENGINE.start_with?(name.to_s)
else
raise "unknown implementation #{name}"
RUBY_ENGINE.start_with?(name.to_s)
end
end
end

View file

@ -165,11 +165,10 @@ describe PlatformGuard, ".implementation?" do
PlatformGuard.implementation?(:ruby).should == true
end
it "raises an error when passed an unrecognized name" do
stub_const 'RUBY_ENGINE', 'ruby'
lambda {
PlatformGuard.implementation?(:python)
}.should raise_error(/unknown implementation/)
it "works for an unrecognized name" do
stub_const 'RUBY_ENGINE', 'myrubyimplementation'
PlatformGuard.implementation?(:myrubyimplementation).should == true
PlatformGuard.implementation?(:other).should == false
end
end