Sha256: 3df2d667d369c2c00c552b6dcf188d9ef91fee8512ec60348c6629e94adc853e

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

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

module RosettaQueue
  
  describe Filters do
    
    after(:each) do
      Filters.reset
    end
    
    describe "#process_receiving" do
      it "should process the passed in message with the defined receiving filter" do
        Filters.define do |f| 
          f.receiving {|message| "Foo #{message}"}
        end
        
        Filters.process_receiving("Bar").should == "Foo Bar"
      end
      
      it "should return the same message when no filter is defined" do
        Filters.process_receiving("Bar").should == "Bar"
      end
    end
    
    
    describe "#process_sending" do
      it "should process the passed in message with the defined sending filter" do
        Filters.define do |f| 
          f.sending {|message| "Foo #{message}"}
        end
        
        Filters.process_sending("Bar").should == "Foo Bar"
      end
      
      it "should return the same message when no filter is defined" do
        Filters.process_sending("Bar").should == "Bar"
      end      
    end
    
    
    
  end
  
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
bmabey-rosetta_queue-0.1.3 spec/rosetta_queue/filters_spec.rb
bmabey-rosetta_queue-0.2.0 spec/rosetta_queue/filters_spec.rb
cwyckoff-rosetta_queue-0.3.3 spec/rosetta_queue/filters_spec.rb