Module: Probatio::ExtraErrorMethods
- Defined in:
- lib/probatio.rb
Instance Attribute Summary collapse
-
#test ⇒ Object
Returns the value of attribute test.
Instance Method Summary collapse
- #line ⇒ Object
- #loc ⇒ Object
- #location ⇒ Object
- #path ⇒ Object
- #source_lines ⇒ Object
- #summary(indent = '') ⇒ Object
- #trail ⇒ Object
Instance Attribute Details
#test ⇒ Object
Returns the value of attribute test.
869 870 871 |
# File 'lib/probatio.rb', line 869 def test @test end |
Instance Method Details
#line ⇒ Object
903 904 905 906 907 908 909 910 911 912 913 914 |
# File 'lib/probatio.rb', line 903 def line backtrace.each do |l| ss = l.split(':') next unless ss.find { |e| e == test.path } return ss.find { |e| e.match?(/^\d+$/) }.to_i end -1 end |
#loc ⇒ Object
873 |
# File 'lib/probatio.rb', line 873 def loc; location.map(&:to_s).join(':'); end |
#location ⇒ Object
872 |
# File 'lib/probatio.rb', line 872 def location; [ path, line ]; end |
#path ⇒ Object
871 |
# File 'lib/probatio.rb', line 871 def path; test.path; end |
#source_lines ⇒ Object
883 884 885 886 887 |
# File 'lib/probatio.rb', line 883 def source_lines @source_lines ||= Probatio::AssertionError.select_source_lines(test.path, line) end |
#summary(indent = '') ⇒ Object
889 890 891 892 893 894 895 896 897 898 899 900 901 |
# File 'lib/probatio.rb', line 889 def summary(indent='') o = StringIO.new o << self.class.name << ': ' << self..inspect << "\n" i = backtrace.index { |l| l.match?(/\/lib\/probatio\.rb:/) } || -1 backtrace[0..i] .inject(o) { |o, l| o << indent << l << "\n" } o.string end |