aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/info_request_event_spec.rb
blob: 428887c8bbecd93b3ab3a8a5d1591b2d23e53350 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require File.dirname(__FILE__) + '/../spec_helper'

describe InfoRequestEvent do 
    
    describe "when storing serialized parameters" do

        it "should convert event parameters into YAML and back successfully" do
            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 
  
        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.should_receive(:xapian_mark_needs_index)
            event.save!
        end
    
    end
end