spec/knapsack/adapters/minitest_adapter_spec.rb in knapsack-1.11.1 vs spec/knapsack/adapters/minitest_adapter_spec.rb in knapsack-1.12.0
- old
+ new
@@ -100,28 +100,48 @@
it { should eql '/code/project' }
end
describe '.test_path' do
- class FakeUserTest
- def test_user_age; end
-
- # method provided by Minitest
- # it returns test method name
- def name
- :test_user_age
- end
- end
-
- let(:obj) { FakeUserTest.new }
-
subject { described_class.test_path(obj) }
before do
parent_of_test_dir = File.expand_path('../../../', File.dirname(__FILE__))
parent_of_test_dir_regexp = Regexp.new("^#{parent_of_test_dir}")
described_class.class_variable_set(:@@parent_of_test_dir, parent_of_test_dir_regexp)
end
- it { should eq './spec/knapsack/adapters/minitest_adapter_spec.rb' }
+ context 'when regular test' do
+ class FakeUserTest
+ def test_user_age; end
+
+ # method provided by Minitest
+ # it returns test method name
+ def name
+ :test_user_age
+ end
+ end
+
+ let(:obj) { FakeUserTest.new }
+
+ it { should eq './spec/knapsack/adapters/minitest_adapter_spec.rb' }
+ end
+
+ context 'when shared examples test' do
+ module FakeSharedExamples
+ def test_from_shared_example; end
+ end
+
+ class FakeSharedExamplesUserTest
+ include FakeSharedExamples
+
+ def location
+ "test that use FakeSharedExamples#test_from_shared_example"
+ end
+ end
+
+ let(:obj) { FakeSharedExamplesUserTest.new }
+
+ it { should eq './spec/knapsack/adapters/minitest_adapter_spec.rb' }
+ end
end
end