Sha256: b2ad7e4d2695afa87c67f027e9d4cbf74a60c1e738481c0342d134959bc64b8e

Contents?: true

Size: 841 Bytes

Versions: 3

Compression:

Stored size: 841 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'minitest/autorun'
require 'webgen/task'

class Webgen::Task::SampleTestTask

  def self.call(website, other)
    other
  end

end

class TestTask < MiniTest::Unit::TestCase

  def setup
    @website = :dummy
    @task = Webgen::Task.new(@website)
  end

  def test_register_and_data
    @task.register('SampleTestTask', :data => :data)
    assert(@task.registered?('sample_test_task'))
    assert_equal(:data, @task.data('sample_test_task'))

    @task.register('doit') {|website|}
    assert(@task.registered?('doit'))
  end

  def test_execute
    @task.register('SampleTestTask')
    @task.register('doit') do |website, param|
      [website, param]
    end

    assert_equal([@website, :data], @task.execute('doit', :data))
    assert_equal(:data, @task.execute('sample_test_task', :data))
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
webgen-1.0.0.beta3 test/webgen/test_task.rb
webgen-1.0.0.beta2 test/webgen/test_task.rb
webgen-1.0.0.beta1 test/webgen/test_task.rb