1
0
Fork 0
mirror of https://github.com/awesome-print/awesome_print synced 2023-03-27 23:22:34 -04:00

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
This commit is contained in:
Tatsuya Hoshino 2018-05-17 21:56:39 +09:00
parent 2c706373b6
commit 1d718e82a0

View file

@ -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