Sha256: b1e0699c94e2ae72bec9451530ed7aa69378e4311a759599b7003b3046648e7b
Contents?: true
Size: 1.52 KB
Versions: 2
Compression:
Stored size: 1.52 KB
Contents
module Omnitest describe DocumentationGenerator do let(:scenario_name) { 'Quine' } # let(:search_path) { 'spec/fixtures/src-doc' } let(:bound_data) { double } describe 'process' do let(:generated_doc) { generator.process bound_data } context 'when template is readable' do subject(:generator) { DocumentationGenerator.new('spec/fixtures/src-doc/quine.md.erb', scenario_name) } it 'processes the template' do expect(generated_doc).to include 'Examples for Quine scenario:' end end context 'when template is not readable' do subject(:generator) { DocumentationGenerator.new('non_existant_file.md', scenario_name) } it 'processes the template' do expect(generated_doc).to be_nil end end end describe 'code2doc' do subject(:generator) { DocumentationGenerator.new } let(:source_code) do <<-eos.gsub(/^( |\t)+/, '') #!/usr/bin/env ruby # Comments are documentation puts 'And this is a code block' eos end let(:source_file) do file = Tempfile.new(['source', '.rb']) file.write source_code file.close file.path end it 'converts source code to documentation' do expect(generator.code2doc(source_file, 'ruby')).to eq( <<-eos.gsub(/^( |\t)+/, '') Comments are documentation ```ruby puts 'And this is a code block' ``` eos ) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
omnitest-0.2.2 | spec/omnitest/documentation_generator_spec.rb |
omnitest-0.2.1 | spec/omnitest/documentation_generator_spec.rb |