spec/qsagi/message_spec.rb in qsagi-0.0.3 vs spec/qsagi/message_spec.rb in qsagi-0.1.0
- old
+ new
@@ -1,41 +1,23 @@
require "spec_helper"
describe Qsagi::Message do
describe "delivery_tag" do
it "returns the delivery_tag" do
- data = {
- :delivery_details => {:delivery_tag => "tag"},
- :payload => "raw_payload"
- }
- Qsagi::Message.new(data, :parsed_payload).delivery_tag.should == "tag"
+ delivery_details = OpenStruct.new(:delivery_tag => "tag")
+ Qsagi::Message.new(delivery_details, :parsed_payload).delivery_tag.should == "tag"
end
-
- it "gracefully handles no delivery details" do
- Qsagi::Message.new({}, :parsed_payload).delivery_tag.should be_nil
- end
end
describe "exchange" do
it "returns the exchange" do
- data = {
- :delivery_details => {:exchange => "the_exchange"},
- :payload => "raw_payload"
- }
- Qsagi::Message.new(data, :parsed_payload).exchange.should == "the_exchange"
+ delivery_details = OpenStruct.new(:exchange => "the_exchange")
+ Qsagi::Message.new(delivery_details, :parsed_payload).exchange.should == "the_exchange"
end
-
- it "gracefully handles no delivery details" do
- Qsagi::Message.new({}, :parsed_payload).exchange.should be_nil
- end
end
describe "payload" do
it "returns the parsed payload" do
- data = {
- :delivery_details => {:delivery_tag => "tag"},
- :payload => "raw_payload"
- }
- Qsagi::Message.new(data, :parsed_payload).payload.should == :parsed_payload
+ Qsagi::Message.new(:deliver_details, :parsed_payload).payload.should == :parsed_payload
end
end
end