Sha256: 2409ff0e3c281bafcea50b51cb74ece1e64dfbdf643c4641a82b08968560eaad

Contents?: true

Size: 994 Bytes

Versions: 5

Compression:

Stored size: 994 Bytes

Contents

require File.dirname(__FILE__) + '/../test_helper'

class TextFilterTest < Test::Unit::TestCase

  class ReverseFilter < TextFilter
    description %{Reverses text.}
    def filter(text)
      text.reverse
    end
  end

  class CustomFilter < TextFilter
    filter_name "Really Custom"
    description_file File.dirname(__FILE__) + "/../fixtures/sample.txt"
  end

  def test_description
    assert_equal %{Reverses text.}, ReverseFilter.description    
  end
  
  def test_description_file
    assert_equal File.read(File.dirname(__FILE__) + "/../fixtures/sample.txt"), CustomFilter.description
  end

  def test_base_filter
    filter = TextFilter.new
    assert_equal 'test', filter.filter('test')
  end
  
  def test_filter
    assert_equal 'tset', ReverseFilter.filter('test')
  end
  
  def test_filter_name
    assert_equal 'Text Filter Test Reverse', ReverseFilter.filter_name
  end
  
  def test_custom_filter_name
    assert_equal 'Really Custom', CustomFilter.filter_name
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
radiant-0.6.1 test/unit/text_filter_test.rb
radiant-0.6.0 test/unit/text_filter_test.rb
radiant-0.6.2 test/unit/text_filter_test.rb
radiant-0.6.3 test/unit/text_filter_test.rb
radiant-0.6.4 test/unit/text_filter_test.rb