-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added SQSMessage class [#3 state:open]
- Loading branch information
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module QueueStick | ||
class SQSMessage < Message | ||
def id | ||
@raw_message[:id] | ||
end | ||
|
||
def body | ||
@raw_message[:body] | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper')) | ||
|
||
describe QueueStick::SQSMessage do | ||
before(:each) do | ||
@raw_message = { | ||
:id => "12345678904GEZX9746N|0N9ED344VK5Z3SV1DTM0|1RVYH4X3TJ0987654321", | ||
:body=>"message_1" | ||
} | ||
end | ||
|
||
it "should be a subclass of Message" do | ||
message = QueueStick::SQSMessage.new(@raw_message) | ||
message.should be_a_kind_of(QueueStick::Message) | ||
end | ||
|
||
describe "id" do | ||
it "should return the ID from the raw message" do | ||
message = QueueStick::SQSMessage.new(@raw_message) | ||
message.id.should == "12345678904GEZX9746N|0N9ED344VK5Z3SV1DTM0|1RVYH4X3TJ0987654321" | ||
end | ||
end | ||
|
||
describe "body" do | ||
it "should return the body from the raw message" do | ||
message = QueueStick::SQSMessage.new(@raw_message) | ||
message.body.should == "message_1" | ||
end | ||
end | ||
end |