Sha256: a29665def84cfc6616bbe38536def1f4a3d6b374b2d23b2057097f1650a8d01b

Contents?: true

Size: 1.03 KB

Versions: 25

Compression:

Stored size: 1.03 KB

Contents

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

describe TextFilter do
  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

  it 'should allow description annotation' do
    ReverseFilter.description.should == %{Reverses text.}
  end
  
  it 'should description_file annotation' do
    CustomFilter.description.should == File.read(File.dirname(__FILE__) + "/../fixtures/sample.txt")
  end

  it 'should filter text with base filter' do
    filter = TextFilter.new
    filter.filter('test').should == 'test'
  end
  
  it 'should filter text with subclass' do
    ReverseFilter.filter('test').should == 'tset'
  end
  
  it 'should allow filter_name annotation' do
    CustomFilter.filter_name.should == 'Really Custom'
  end
  
  it 'should default filter_name annotation' do
    ReverseFilter.filter_name.should == 'Reverse'
  end
end

Version data entries

25 entries across 25 versions & 3 rubygems

Version Path
radiantcms-couchrest_model-0.2.4 spec/models/text_filter_spec.rb
radiantcms-couchrest_model-0.2.2 spec/models/text_filter_spec.rb
radiantcms-couchrest_model-0.2.1 spec/models/text_filter_spec.rb
radiantcms-couchrest_model-0.2 spec/models/text_filter_spec.rb
radiantcms-couchrest_model-0.1.9 spec/models/text_filter_spec.rb
radiantcms-couchrest_model-0.1.8 spec/models/text_filter_spec.rb
radiantcms-couchrest_model-0.1.7 spec/models/text_filter_spec.rb
radiantcms-couchrest_model-0.1.6 spec/models/text_filter_spec.rb
radiantcms-couchrest_model-0.1.5 spec/models/text_filter_spec.rb
radiantcms-couchrest_model-0.1.4 spec/models/text_filter_spec.rb
radiant-0.7.2 spec/models/text_filter_spec.rb
radiant-0.9.1 spec/models/text_filter_spec.rb
radiant-0.8.2 spec/models/text_filter_spec.rb
radiant-0.9.0.rc2 spec/models/text_filter_spec.rb
radiant-rc-0.9.0 spec/models/text_filter_spec.rb
radiant-0.8.1 spec/models/text_filter_spec.rb
radiant-0.6.5.1 spec/models/text_filter_spec.rb
radiant-0.6.5 spec/models/text_filter_spec.rb
radiant-0.6.7 spec/models/text_filter_spec.rb
radiant-0.6.6 spec/models/text_filter_spec.rb