Sha256: 8f521fec22be2146106ead2acdb8d7933c0e4531ae4fd11f512e728e581e0871
Contents?: true
Size: 1.36 KB
Versions: 3
Compression:
Stored size: 1.36 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 ['sending', 'receiving'].each do |action| describe "#safe_process_#{action}" do it "returns the orginal message if an exception occurs while filtering" do Filters.define do |f| f.send(action) { |message| raise "foo" } end Filters.send("safe_process_#{action}", "Bar").should == "Bar" end 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 & 1 rubygems
Version | Path |
---|---|
rosetta_queue-0.5.2 | spec/rosetta_queue/filters_spec.rb |
rosetta_queue-0.5.0 | spec/rosetta_queue/filters_spec.rb |
rosetta_queue-0.4.0 | spec/rosetta_queue/filters_spec.rb |