Renamed helpers to correspond to renamed Controller classes.
[merb_radiant.git] / radiant_specs / spec / models / .svn / text-base / text_filter_spec.rb.svn-base
blobcbc1cca8e6eb12eb119bed853082551df6db9578
1 require File.dirname(__FILE__) + '/../spec_helper'
3 describe TextFilter do
4   class ReverseFilter < TextFilter
5     description %{Reverses text.}
6     def filter(text)
7       text.reverse
8     end
9   end
11   class CustomFilter < TextFilter
12     filter_name "Really Custom"
13     description_file File.dirname(__FILE__) + "/../fixtures/sample.txt"
14   end
16   it 'should allow description annotation' do
17     ReverseFilter.description.should == %{Reverses text.}
18   end
19   
20   it 'should description_file annotation' do
21     CustomFilter.description.should == File.read(File.dirname(__FILE__) + "/../fixtures/sample.txt")
22   end
24   it 'should filter text with base filter' do
25     filter = TextFilter.new
26     filter.filter('test').should == 'test'
27   end
28   
29   it 'should filter text with subclass' do
30     ReverseFilter.filter('test').should == 'tset'
31   end
32   
33   it 'should allow filter_name annotation' do
34     CustomFilter.filter_name.should == 'Really Custom'
35   end
36   
37   it 'should default filter_name annotation' do
38     ReverseFilter.filter_name.should == 'Reverse'
39   end
40 end