spec/unicode_scripts_spec.rb in unicode-scripts-1.7.0 vs spec/unicode_scripts_spec.rb in unicode-scripts-1.8.0

- old
+ new

@@ -14,23 +14,25 @@ it "will return all scripts in sorted order" do assert_equal ["Cyrillic", "Latin"], Unicode::Scripts.of("СA") assert_equal ["Cyrillic", "Latin"], Unicode::Scripts.of("AС") end - it "will call .script for every character" do - mocked_method = MiniTest::Mock.new - if RUBY_VERSION >= "2.7" - mocked_method.expect :call, "first script", ["С"] - mocked_method.expect :call, "second script", ["A"] - else - mocked_method.expect :call, "first script", ["С", {}] - mocked_method.expect :call, "second script", ["A", {}] + if RUBY_ENGINE != "jruby" + it "will call .script for every character" do + mocked_method = MiniTest::Mock.new + if RUBY_VERSION >= "2.7" + mocked_method.expect :call, "first script", ["С"] + mocked_method.expect :call, "second script", ["A"] + else + mocked_method.expect :call, "first script", ["С", {}] + mocked_method.expect :call, "second script", ["A", {}] + end + Unicode::Scripts.stub :script, mocked_method do + Unicode::Scripts.of("СA") + end + mocked_method.verify end - Unicode::Scripts.stub :script, mocked_method do - Unicode::Scripts.of("СA") - end - mocked_method.verify end end describe ".script" do it "will return script for that character" do @@ -108,16 +110,20 @@ it "will return all extended scripts in sorted order" do assert_equal ["Cyrillic", "Latin"], Unicode::Scripts.script_extensions("СA") assert_equal ["Cyrillic", "Latin"], Unicode::Scripts.script_extensions("AС") end - it "will call .scripts for characters that have no explicit script extension" do - mocked_method = MiniTest::Mock.new - mocked_method.expect :call, ["scripts"], ["A", {format: :long}] - Unicode::Scripts.stub :scripts, mocked_method do - Unicode::Scripts.script_extensions("A") + if RUBY_VERSION >= "3.0" && RUBY_ENGINE != "jruby" + it "will call .scripts for characters that have no explicit script extension" do + mocked_method = MiniTest::Mock.new + + mocked_method.expect(:call, ["scripts"], ["A"], format: :long) + + Unicode::Scripts.stub :scripts, mocked_method do + Unicode::Scripts.script_extensions("A") + end + mocked_method.verify end - mocked_method.verify end end describe ".names" do it "will return a list of all script names" do