Sha256: 0441e71b38b8b20e076a10529ac3095792bee5c172a0fda377312874d31f19bc
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "Processor" do before :each do class TextProcessor < Alter::Processor def output input + " + output" end end class UselessProcessor < Alter::Processor end class EligibilityProcessor < Alter::Processor def output if options[:age] >= 35 input + " + President eligible" else input + " + Too young to be President" end end end end it "should produce an output based upon a custom output method" do @processor = TextProcessor.new "Initial text" @processor.output.should == "Initial text + output" end it "should have an output equal to its input if no custom output method is provided" do @processor = UselessProcessor.new "Initial text" @processor.output.should == "Initial text" end it "should allow changing output based upon options" do @processor = EligibilityProcessor.new "Initial text", :age => 42 @processor.output.should == "Initial text + President eligible" end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
alter-0.0.3 | spec/processor_spec.rb |
alter-0.0.2 | spec/processor_spec.rb |
alter-0.0.1 | spec/processor_spec.rb |