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 case name
when :rubinius when :rubinius
RUBY_ENGINE.start_with?('rbx') RUBY_ENGINE.start_with?('rbx')
when :ruby, :jruby, :truffleruby, :ironruby, :macruby, :maglev, :topaz, :opal
RUBY_ENGINE.start_with?(name.to_s)
else else
raise "unknown implementation #{name}" RUBY_ENGINE.start_with?(name.to_s)
end end
end end
end end

View file

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