Sha256: f8eb0985a8750d77a028ac298a2d61d3810326d84782480c54e3db3a48475fe5

Contents?: true

Size: 878 Bytes

Versions: 2

Compression:

Stored size: 878 Bytes

Contents

require 'spec_helper'
require 'rake'

def capture_stdout(&block)
  original_stdout = $stdout
  $stdout = fake = StringIO.new
  begin
    yield
  ensure
    $stdout = original_stdout
  end
  fake.string
end

describe Rake do
  context 'rapidoc:generate' do
    before do
      Rake.application.rake_require "tasks/rapidoc"
      Rake::Task.define_task(:environment)
    end

    after do
      remove_doc 
    end

    let :run_rake_task do
      Rake::Task["rapidoc:generate"].reenable
      Rake.application.invoke_task "rapidoc:generate"
    end

    it "should create documentation" do
      output = capture_stdout { run_rake_task }
      output.should be_include( 'Generating API documentation...' )
      output.should be_include( 'Completed API documentation generation' )

      File.exists?( ::Rails.root.to_s + "/rapidoc/index.html" ).should == true
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rapidoc-0.0.6 spec/lib/rake_spec.rb
rapidoc-0.0.5 spec/lib/rake_spec.rb