Sha256: 9cceaa396af44e06a42ccf8a5c43518ca6fc15d1d3d24a021aee0a215194dcf3

Contents?: true

Size: 630 Bytes

Versions: 1

Compression:

Stored size: 630 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})
    o.wont_be_nil
    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})
    o.wont_be_nil
    o.next_fire_at.must_equal time_at
    o.next_fire_at(time_at + 10.second).must_be_nil
    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-1.0.0 test/say_when/triggers/once_strategy_test.rb