aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/info_request_event_spec.rb
diff options
context:
space:
mode:
authortony <tony>2009-04-23 13:08:49 +0000
committertony <tony>2009-04-23 13:08:49 +0000
commit9b3d6ddc404615b409853c86473df5e1c3a11138 (patch)
tree202ad3c37e8041d51c41ad65bca47753a66bf22a /spec/models/info_request_event_spec.rb
parentb28e402f051ba3d9430953d039730750754c5780 (diff)
Add is_incoming_message?/is_outgoing_message?/is_comment? so we can just
ask "event.is_incoming_message?" instead of "!event.incoming_message.nil?"
Diffstat (limited to 'spec/models/info_request_event_spec.rb')
-rw-r--r--spec/models/info_request_event_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/models/info_request_event_spec.rb b/spec/models/info_request_event_spec.rb
index 428887c8b..fd263b2b8 100644
--- a/spec/models/info_request_event_spec.rb
+++ b/spec/models/info_request_event_spec.rb
@@ -25,5 +25,30 @@ describe InfoRequestEvent do
end
end
+
+ describe "should know" do
+
+ it "that it's an incoming message" do
+ event = InfoRequestEvent.new(:incoming_message => mock_model(IncomingMessage))
+ event.is_incoming_message?.should be_true
+ event.is_outgoing_message?.should be_false
+ event.is_comment?.should be_false
+ end
+
+ it "that it's an outgoing message" do
+ event = InfoRequestEvent.new(:outgoing_message => mock_model(OutgoingMessage))
+ event.is_incoming_message?.should be_false
+ event.is_outgoing_message?.should be_true
+ event.is_comment?.should be_false
+ end
+
+ it "that it's a comment" do
+ event = InfoRequestEvent.new(:comment => mock_model(Comment))
+ event.is_incoming_message?.should be_false
+ event.is_outgoing_message?.should be_false
+ event.is_comment?.should be_true
+ end
+
+ end
end