Sha256: ded7b6408e4723d4f0815c2a616f73359aae8ad3f566cafd8f4c4ef9db7c0e8b

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

require 'test/unit'
require 'dokkit'
require 'dokkit/app'
require 'rake'

module Rake
  class Application
    def collect_tasks(tasks = nil)
      return @top_level_tasks unless tasks
      @top_level_tasks.concat tasks
    end
  end
end

module Dokkit
  class Application
    def collect_tasks(tasks)
      Rake.application.collect_tasks(tasks)
    end
  end
end

class TestBuiltinTask < Test::Unit::TestCase
  OUTPUT_DIR = 'tests/data/output'
  def test_builtin_task
    Dokkit.application.init
    Dokkit.application.define_builtin_tasks
    assert_equal('create', Dokkit.application['create'].to_s)
  end

  def test_create_default_project_task
    Dokkit.application.init
    Dokkit.application.define_builtin_tasks
    Dokkit.application.collect_tasks ["create", "#{OUTPUT_DIR}/simple_document"]
    Dokkit.application.run
    dir_content = Dir["#{OUTPUT_DIR}/simple_document/*"]
    assert(!dir_content.empty? && !dir_content.include?('lib'))
  end

  def test_create_website_task
    Dokkit.application.init
    Dokkit.application.do_option('--project',"website")
    Dokkit.application.define_builtin_tasks
    Dokkit.application.collect_tasks ["create", "#{OUTPUT_DIR}/website_project"]
    Dokkit.application.run
    assert(Dir["#{OUTPUT_DIR}/website_project/*"].size > 1)
   end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dokkit-model-simpledocument-0.1.0 lib/tests/test_structure.rb