File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ def set_test_helper_path(file_path)
4848
4949 def self . test_path ( obj )
5050 # Pick the first public method in the class itself, that starts with "test_"
51- test_method_name = obj . public_methods ( false ) . select { |m | m =~ /^test_ / } . first
51+ test_method_name = obj . public_methods ( false ) . select { |m | m =~ /^test(:|_) / } . first
5252 method_object = obj . method ( test_method_name )
5353 full_test_path = method_object . source_location . first
5454 parent_of_test_dir_regexp = Regexp . new ( "^#{ @@parent_of_test_dir } " )
Original file line number Diff line number Diff line change @@ -122,4 +122,26 @@ def name
122122
123123 it { should eq './spec/knapsack/adapters/minitest_adapter_spec.rb' }
124124 end
125+
126+ describe 'shoulda context installed' do
127+ class FakeUserTest
128+ def test_user_age ; end
129+
130+ def name
131+ "test_: on delete qqq should allow us to make another portfolio for that user. "
132+ end
133+ end
134+
135+ let ( :obj ) { FakeUserTest . new }
136+
137+ subject { described_class . test_path ( obj ) }
138+
139+ before do
140+ parent_of_test_dir = File . expand_path ( '../../../' , File . dirname ( __FILE__ ) )
141+ parent_of_test_dir_regexp = Regexp . new ( "^#{ parent_of_test_dir } " )
142+ described_class . class_variable_set ( :@@parent_of_test_dir , parent_of_test_dir_regexp )
143+ end
144+
145+ it { should eq './spec/knapsack/adapters/minitest_adapter_spec.rb' }
146+ end
125147end
You can’t perform that action at this time.
0 commit comments