Sha256: cc47ccf3c847b0c3a354a32f84305f9ed3ed695b80658f3abf8ed25f69600bb8

Contents?: true

Size: 690 Bytes

Versions: 1

Compression:

Stored size: 690 Bytes

Contents

# encoding: utf-8

require 'minitest_helper'
require 'say_when/triggers/once_strategy'

describe SayWhen::Triggers::OnceStrategy do

  it 'should be constucted with at option' do
    time_at = 1.second.ago
    o = SayWhen::Triggers::OnceStrategy.new(at: time_at, job: {})
    expect(o).wont_be_nil
    expect(o.once_at).must_equal time_at
  end

  it 'should return once at only once' do
    time_at = 1.second.ago
    o = SayWhen::Triggers::OnceStrategy.new(at: time_at, job: {})
    expect(o).wont_be_nil
    expect(o.next_fire_at).must_equal time_at
    expect(o.next_fire_at(time_at + 10.second)).must_be_nil
    expect(o.next_fire_at(time_at - 10.second)).must_equal time_at
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
say_when-2.2.2 test/say_when/triggers/once_strategy_test.rb