Sha256: 2ebda75bb98f8cef965704390f16b65e5c8e7ca93c7efa0d9b920db468d04b62

Contents?: true

Size: 572 Bytes

Versions: 7

Compression:

Stored size: 572 Bytes

Contents

require 'test/unit'

class ChunkTest < Test::Unit::TestCase

  # Asserts a number of tests for the given type and text.
  def match(type, test_text, expected)
	pattern = type.pattern
    assert_match(pattern, test_text)
    pattern =~ test_text   # Previous assertion guarantees match
    chunk = type.new($~)
    
    # Test if requested parts are correct.
    for method_sym, value in expected do
      assert_respond_to(chunk, method_sym)
      assert_equal(value, chunk.method(method_sym).call, "Checking value of '#{method_sym}'")
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
Pimki-1.0.092 app/models/chunks/test.rb
Pimki-1.1.092 app/models/chunks/test.rb
Pimki-1.2.092 app/models/chunks/test.rb
Pimki-1.3.092 app/models/chunks/test.rb
instiki-0.10.2 app/models/chunks/test.rb
instiki-0.9.2 app/models/chunks/test.rb
instiki-0.10.1 app/models/chunks/test.rb