Module: Doctest2::RSpec::DoctestHelpers

Defined in:
lib/doctest2/rspec/doctest_helpers.rb

Instance Method Summary collapse

Instance Method Details

#doctest(source) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/doctest2/rspec/doctest_helpers.rb', line 2

def doctest(source)
  context "doctests for #{source}" do
    Doctest2::Core.extract_from(source).each do |doctest|
      file_location = Pathname.new(doctest.original_file).relative_path_from(Pathname.pwd)

      it "at #{file_location}:#{doctest.line}" do
        expect(doctest).to be_a_valid_doctest
      end
    end
  end
end