Sha256: fabde12910b0ef81335df048bd8024052171a72dd5f875cbf7076106c58065f8
Contents?: true
Size: 1.52 KB
Versions: 5
Compression:
Stored size: 1.52 KB
Contents
module Polytrix 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
5 entries across 5 versions & 1 rubygems