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

Small spec fixes for Ruby 1.9.3

This commit is contained in:
Mike Dvorkin 2012-09-03 12:23:31 -07:00
parent fcdc3b6320
commit eb295c106d
2 changed files with 15 additions and 8 deletions

View file

@ -155,9 +155,10 @@ describe "Object methods" do
def m1; end
def m2; end
end
out = Hello.new.private_methods.ai(:plain => true).split("\n").grep(/m\d/)
out.first.should =~ /^\s+\[\d+\]\s+m1\(\)\s+Hello$/
out.last.should =~ /^\s+\[\d+\]\s+m2\(\)\s+Hello$/
out.first.should =~ /^\s+\[\s*\d+\]\s+m1\(\)\s+Hello$/
out.last.should =~ /^\s+\[\s*\d+\]\s+m2\(\)\s+Hello$/
end
it "no index: should handle object.private_methods" do
@ -167,9 +168,9 @@ describe "Object methods" do
end
out = Hello.new.private_methods.ai(:plain => true).split("\n").grep(/m\d/)
if RUBY_VERSION < '1.9.2'
out.first.should =~ /^\s+\[\d+\]\s+m3\(arg1, arg2\)\s+Hello$/
out.first.should =~ /^\s+\[\s*\d+\]\s+m3\(arg1, arg2\)\s+Hello$/
else
out.first.should =~ /^\s+\[\d+\]\s+m3\(a, b\)\s+Hello$/
out.first.should =~ /^\s+\[\s*\d+\]\s+m3\(a, b\)\s+Hello$/
end
end
end
@ -183,8 +184,8 @@ describe "Object methods" do
end
end
out = Hello.singleton_methods.ai(:plain => true).split("\n").grep(/m\d/)
out.first.should =~ /^\s+\[\d+\]\s+m1\(\)\s+Hello$/
out.last.should =~ /^\s+\[\d+\]\s+m2\(\)\s+Hello$/
out.first.should =~ /^\s+\[\s*\d+\]\s+m1\(\)\s+Hello$/
out.last.should =~ /^\s+\[\s*\d+\]\s+m2\(\)\s+Hello$/
end
it "no index: should handle object.singleton_methods" do
@ -266,8 +267,8 @@ describe "Class methods" do
def m2; end
end
out = Hello.protected_instance_methods.ai(:plain => true).split("\n").grep(/m\d/)
out.first.should =~ /^\s+\[\d+\]\s+m1\(\)\s+Hello\s\(unbound\)$/
out.last.should =~ /^\s+\[\d+\]\s+m2\(\)\s+Hello\s\(unbound\)$/
out.first.should =~ /^\s+\[\s*\d+\]\s+m1\(\)\s+Hello\s\(unbound\)$/
out.last.should =~ /^\s+\[\s*\d+\]\s+m2\(\)\s+Hello\s\(unbound\)$/
end
it "no index: should handle class.protected_instance_methods" do

View file

@ -8,6 +8,12 @@
# $ rake spec # Entire spec suite.
# $ rspec spec/objects_spec.rb # Individual spec file.
#
# NOTE: To successfully run specs with Ruby 1.8.6 the older versions of
# Bundler and RSpec gems are required:
#
# $ gem install bundler -v=1.0.2
# $ gem install rspec -v=2.6.0
#
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'awesome_print'