Sha256: aadc421e51e1a7c74e314870945336c3ab5cac2f800c5eeabfa620245746011c

Contents?: true

Size: 807 Bytes

Versions: 3

Compression:

Stored size: 807 Bytes

Contents

require 'spec_helper'

describe NetSuiteRails::PollTrigger do
  include ExampleModels

  it "should properly sync for the first time" do
  	allow(StandardRecord).to receive(:netsuite_poll).with(hash_including(:import_all => true))

  	NetSuiteRails::PollTrigger.sync list_models: []

  	expect(StandardRecord).to have_received(:netsuite_poll)
  end

  it "should trigger syncing when the time has passed is greater than frequency" do
  	allow(StandardRecord).to receive(:netsuite_poll)

  	StandardRecord.netsuite_sync_options[:frequency] = 5.minutes
  	timestamp = NetSuiteRails::PollTimestamp.for_class(StandardRecord)
  	timestamp.value = DateTime.now - 7.minutes
  	timestamp.save!

  	NetSuiteRails::PollTrigger.sync list_models: []

  	expect(StandardRecord).to have_received(:netsuite_poll)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
netsuite_rails-0.2.2 spec/models/poll_trigger_spec.rb
netsuite_rails-0.2.1 spec/models/poll_trigger_spec.rb
netsuite_rails-0.2.0 spec/models/poll_trigger_spec.rb