From 1d718e82a0014f5ba4e57a22500375ac71df7c0a Mon Sep 17 00:00:00 2001 From: Tatsuya Hoshino Date: Thu, 17 May 2018 21:56:39 +0900 Subject: [PATCH] Fix specs for Ruby 2.4 or higher Since String#upcase was changed in Ruby 2.4, fix the tests that uses the methods. See: https://bugs.ruby-lang.org/issues/10085 --- spec/methods_spec.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/spec/methods_spec.rb b/spec/methods_spec.rb index 29db921..222727e 100644 --- a/spec/methods_spec.rb +++ b/spec/methods_spec.rb @@ -7,12 +7,20 @@ RSpec.describe 'Single method' do it 'plain: should handle a method with no arguments' do method = ''.method(:upcase) - expect(method.ai(plain: true)).to eq('String#upcase()') + if RUBY_VERSION >= '2.4.0' + expect(method.ai(plain: true)).to eq('String#upcase(*arg1)') + else + expect(method.ai(plain: true)).to eq('String#upcase()') + end end it 'color: should handle a method with no arguments' do method = ''.method(:upcase) - expect(method.ai).to eq("\e[1;33mString\e[0m#\e[0;35mupcase\e[0m\e[0;37m()\e[0m") + if RUBY_VERSION >= '2.4.0' + expect(method.ai).to eq("\e[1;33mString\e[0m#\e[0;35mupcase\e[0m\e[0;37m(*arg1)\e[0m") + else + expect(method.ai).to eq("\e[1;33mString\e[0m#\e[0;35mupcase\e[0m\e[0;37m()\e[0m") + end end it 'plain: should handle a method with one argument' do