aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/info_request_event_spec.rb
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2011-03-09 14:58:30 +0000
committerSeb Bacon <seb.bacon@gmail.com>2011-03-09 14:58:30 +0000
commitb4585af18e9c3a033f6cfe27213f0575af795a66 (patch)
tree996efa1487ac0d8cb7e4f53ee6478ad625b9d27d /spec/models/info_request_event_spec.rb
parent224b8a4ba3a24af91068505c7907724448a4096d (diff)
parent4cc2cf2a6d935adfd263ea4fd7791a6d84f704da (diff)
merge from master (post-CSRF changes)
Diffstat (limited to 'spec/models/info_request_event_spec.rb')
-rw-r--r--spec/models/info_request_event_spec.rb28
1 files changed, 14 insertions, 14 deletions
diff --git a/spec/models/info_request_event_spec.rb b/spec/models/info_request_event_spec.rb
index 9f6e466bb..666f5cb1a 100644
--- a/spec/models/info_request_event_spec.rb
+++ b/spec/models/info_request_event_spec.rb
@@ -1,47 +1,47 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
-describe InfoRequestEvent do
-
+describe InfoRequestEvent do
+
describe "when storing serialized parameters" do
it "should convert event parameters into YAML and back successfully" do
- ire = InfoRequestEvent.new
+ ire = InfoRequestEvent.new
example_params = { :foo => 'this is stuff', :bar => 83, :humbug => "yikes!!!" }
ire.params = example_params
ire.params_yaml.should == example_params.to_yaml
ire.params.should == example_params
end
-
+
end
- describe 'when saving' do
-
+ describe 'after saving' do
+
it 'should mark the model for reindexing in xapian if there is no no_xapian_reindex flag on the object' do
- event = InfoRequestEvent.new(:info_request => mock_model(InfoRequest),
- :event_type => 'sent',
- :params => {})
+ event = InfoRequestEvent.new(:info_request => mock_model(InfoRequest),
+ :event_type => 'sent',
+ :params => {})
event.should_receive(:xapian_mark_needs_index)
- event.save!
+ event.run_callbacks(:after_save)
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