Sha256: 94c633d3c54d4e67cbe05d0775874e9b905e710eeac2199930038512989cdc95

Contents?: true

Size: 1.44 KB

Versions: 25

Compression:

Stored size: 1.44 KB

Contents

require 'spec_helper'

describe Maestrano::Connector::Rails::AllSynchronizationsJob do
  let(:organization_not_linked) { create(:organization, oauth_provider: 'salesforce', oauth_token: nil, sync_enabled: true) }
  let(:organization_not_active) { create(:organization, oauth_provider: 'salesforce', oauth_token: '123', sync_enabled: 0) }
  let(:organization_to_process) { create(:organization, oauth_provider: 'salesforce', oauth_token: '123', sync_enabled: true) }

  subject { Maestrano::Connector::Rails::AllSynchronizationsJob.perform_now() }

  # before{
  #   organization_not_active.update(encrypted_oauth_token: Maestrano::Connector::Rails::Organization.encrypt_oauth_token('123', key: 'This is a key that is 256 bits!!', iv: 'This iv is 12 bytes or longer'))
  #   organization_to_process.update(encrypted_oauth_token: Maestrano::Connector::Rails::Organization.encrypt_oauth_token('123', key: 'This is a key that is 256 bits!!', iv: 'This iv is 12 bytes or longer'))
  # }

  describe 'perform' do
    it 'does not calls sync entity' do
      expect(Maestrano::Connector::Rails::SynchronizationJob).to_not receive(:perform_later).with(organization_not_linked, anything)
      expect(Maestrano::Connector::Rails::SynchronizationJob).to_not receive(:perform_later).with(organization_not_active, anything)
      expect(Maestrano::Connector::Rails::SynchronizationJob).to receive(:perform_later).with(organization_to_process, anything)

      subject
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
maestrano-connector-rails-2.0.0.pre.RC6 spec/jobs/all_synchronizations_job_spec.rb
maestrano-connector-rails-2.0.0.pre.RC5 spec/jobs/all_synchronizations_job_spec.rb
maestrano-connector-rails-2.0.0.pre.RC4 spec/jobs/all_synchronizations_job_spec.rb
maestrano-connector-rails-2.0.0.pre.RC3 spec/jobs/all_synchronizations_job_spec.rb
maestrano-connector-rails-2.0.0.pre.RC2 spec/jobs/all_synchronizations_job_spec.rb
maestrano-connector-rails-2.0.0.pre.RC1 spec/jobs/all_synchronizations_job_spec.rb
maestrano-connector-rails-1.4.0 spec/jobs/all_synchronizations_job_spec.rb
maestrano-connector-rails-1.3.5 spec/jobs/all_synchronizations_job_spec.rb
maestrano-connector-rails-1.3.4 spec/jobs/all_synchronizations_job_spec.rb
maestrano-connector-rails-1.3.3 spec/jobs/all_synchronizations_job_spec.rb
maestrano-connector-rails-1.3.2 spec/jobs/all_synchronizations_job_spec.rb
maestrano-connector-rails-1.3.1 spec/jobs/all_synchronizations_job_spec.rb
maestrano-connector-rails-1.3.0 spec/jobs/all_synchronizations_job_spec.rb
maestrano-connector-rails-1.2.3 spec/jobs/all_synchronizations_job_spec.rb
maestrano-connector-rails-1.2.2 spec/jobs/all_synchronizations_job_spec.rb
maestrano-connector-rails-1.2.1 spec/jobs/all_synchronizations_job_spec.rb
maestrano-connector-rails-1.2.0 spec/jobs/all_synchronizations_job_spec.rb
maestrano-connector-rails-1.1.2 spec/jobs/all_synchronizations_job_spec.rb
maestrano-connector-rails-1.1.1 spec/jobs/all_synchronizations_job_spec.rb
maestrano-connector-rails-1.1.0 spec/jobs/all_synchronizations_job_spec.rb