Sha256: 322d306f0662b30ad5a54577b6a5a6ecdbc9bdea37c93fe21ccbf0525edc5327

Contents?: true

Size: 1.29 KB

Versions: 7

Compression:

Stored size: 1.29 KB

Contents

require "./lib/roger/release.rb"
require "test/unit"

class ProcessorsTest < ::Test::Unit::TestCase
  def setup
    Roger::Release::Processors.map.clear
  end

  def test_register_processor
    processor = lambda{|e| raise "ProcessorName" }
    assert Roger::Release::Processors.register(:name, processor)
    assert_equal Roger::Release::Processors.map, {:name => processor}
  end

  def test_register_processor_with_symbol_only_name
    processor = lambda{|e| raise "ProcessorName" }

    assert_raise(ArgumentError){
      Roger::Release::Processors.register("name", processor) 
    }

    assert_raise(ArgumentError){
      Roger::Release::Processors.register("name", processor) 
    }
  end

  def test_register_processor_with_same_name
    processor = lambda{|e| raise "ProcessorName" }
    Roger::Release::Processors.register(:name, processor)

    assert_raise(ArgumentError){
      Roger::Release::Processors.register(:name, processor) 
    }
  end

  def test_register_processor_with_same_contents
    processor = lambda{|e| raise "ProcessorName" }
    Roger::Release::Processors.register(:name, processor)

    assert_nothing_raised{
      Roger::Release::Processors.register(:name2, processor) 
    }

    assert_equal Roger::Release::Processors.map, {:name => processor, :name2 => processor}
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
roger-1.1.3 test/unit/release/processors_test.rb
roger-1.1.2 test/unit/release/processors_test.rb
roger-1.1.1 test/unit/release/processors_test.rb
roger-1.1.0 test/unit/release/processors_test.rb
roger-1.0.1 test/unit/release/processors_test.rb
roger-1.0.0 test/unit/release/processors_test.rb
roger-0.13.0 test/unit/release/processors_test.rb