Sha256: ba8529aaa4a421c586da38df499d931c30b189a88e86458884920bd476cb66bc
Contents?: true
Size: 947 Bytes
Versions: 3
Compression:
Stored size: 947 Bytes
Contents
module Tap module Test module FileMethodsClass # Access the test root structure (a Tap::Root) attr_accessor :trs # Infers the test root directory from the calling file. Ex: # 'some_class.rb' => 'some_class' # 'some_class_test.rb' => 'some_class' def file_test_root # the calling file is not the direct caller of +method_root+... this method is # only accessed from within another method call, hence the target caller is caller[1] # rather than caller[0]. # caller[1] is considered the calling file (which should be the test case) # note that the output of calller.first is like: # ./path/to/file.rb:10 # ./path/to/file.rb:10:in 'method' calling_file = caller[1].gsub(/:\d+(:in .*)?$/, "") calling_file.chomp!("#{File.extname(calling_file)}") calling_file.chomp("_test") end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bahuvrihi-tap-0.10.2 | lib/tap/test/file_methods_class.rb |
bahuvrihi-tap-0.10.3 | lib/tap/test/file_methods_class.rb |
bahuvrihi-tap-0.10.4 | lib/tap/test/file_methods_class.rb |