Sha256: 1db9d5c42cb440eb2a3ac8ef9290afa593ab74bef0a622f6519d6abcb542aa06

Contents?: true

Size: 554 Bytes

Versions: 7

Compression:

Stored size: 554 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.5.092 app/models/chunks/test.rb
Pimki-1.4.092 app/models/chunks/test.rb
Pimki-1.6.092 app/models/chunks/test.rb
Pimki-1.8.200 app/models/chunks/test.rb
Pimki-1.7.092 app/models/chunks/test.rb
Pimki-1.8.092 app/models/chunks/test.rb
instiki-0.10.0 app/models/chunks/test.rb