Sha256: 2ce0ffcea5ae65fa72042ef5724f3df8422168eb73bb5d0b5947ca3f5123fa4e

Contents?: true

Size: 768 Bytes

Versions: 13

Compression:

Stored size: 768 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe CloudfujiLeadObserver do

  before do
    @observer = CloudfujiLeadObserver.send :new
  end 
  
  it "should process an event rule when a lead column is updated" do
    user = FactoryGirl.create(:user, :ido_id => "1234")
    @lead = FactoryGirl.create(:lead, :first_name => "Henry", :user => user, :campaign => nil)

    EventRule.create!(
      :event_category  => "lead_attribute_changed", 
      :lead_attribute  => "first_name",
      :action          => "change_lead_score",
      :change_score_by => 5
    )    
    
    EventRule.any_instance.should_receive(:process).with(@lead, ['Henry', 'George'])
    
    @lead.first_name = "George"
    @observer.after_update(@lead)
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ffcrm_cloudfuji-0.4.1 spec/observers/cloudfuji_lead_observer_spec.rb
ffcrm_cloudfuji-0.3.1 spec/observers/cloudfuji_lead_observer_spec.rb
ffcrm_cloudfuji-0.3.0 spec/observers/cloudfuji_lead_observer_spec.rb
ffcrm_cloudfuji-0.2.11 spec/observers/cloudfuji_lead_observer_spec.rb
ffcrm_cloudfuji-0.2.10 spec/observers/cloudfuji_lead_observer_spec.rb
ffcrm_cloudfuji-0.2.9 spec/observers/cloudfuji_lead_observer_spec.rb
ffcrm_cloudfuji-0.2.8 spec/observers/cloudfuji_lead_observer_spec.rb
ffcrm_cloudfuji-0.2.7 spec/observers/cloudfuji_lead_observer_spec.rb
ffcrm_cloudfuji-0.2.6 spec/observers/cloudfuji_lead_observer_spec.rb
ffcrm_cloudfuji-0.2.5 spec/observers/cloudfuji_lead_observer_spec.rb
ffcrm_cloudfuji-0.2.4 spec/observers/cloudfuji_lead_observer_spec.rb
ffcrm_cloudfuji-0.2.3 spec/observers/cloudfuji_lead_observer_spec.rb
ffcrm_cloudfuji-0.2.2 spec/observers/cloudfuji_lead_observer_spec.rb