Moderizing dev environment.
- Use rake-deveiate. - Fixes for README - Add History, break out Manifest - Remove keyword expansion constant REVISION - Use current Configurability APIs instead of the (now ancient) methods - Whitespace changes FossilOrigin-Name: a778fb275af99a238d9d2311cc601c58adf80e28bd68a37e06acdfb6efeb018d
This commit is contained in:
parent
07c927e13a
commit
2682000224
18 changed files with 210 additions and 227 deletions
|
|
@ -33,11 +33,13 @@ describe Symphony::Metronome::ScheduledEvent do
|
|||
Timecop.travel( time )
|
||||
end
|
||||
|
||||
|
||||
it 'applies migrations upon initial config' do
|
||||
migrations = described_class.db[ :schema_migrations ].all
|
||||
expect( migrations.first[:filename] ).to eq( '20140419_initial.rb' )
|
||||
end
|
||||
|
||||
|
||||
it 'can load all stored events sorted by next execution time' do
|
||||
ds.insert(
|
||||
:created => Time.now,
|
||||
|
|
@ -61,6 +63,7 @@ describe Symphony::Metronome::ScheduledEvent do
|
|||
expect( events.last.event.instance_variable_get(:@exp) ).to eq( 'at 3pm' )
|
||||
end
|
||||
|
||||
|
||||
it 'removes invalid expressions from storage when loading' do
|
||||
ds.insert(
|
||||
:created => Time.now,
|
||||
|
|
@ -77,6 +80,7 @@ describe Symphony::Metronome::ScheduledEvent do
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
context 'an instance' do
|
||||
|
||||
let( :time ) { Time.at(1262376000) }
|
||||
|
|
@ -94,6 +98,7 @@ describe Symphony::Metronome::ScheduledEvent do
|
|||
expect( ev.runtime ).to eq( time )
|
||||
end
|
||||
|
||||
|
||||
it 'can reschedule itself into the future when recurring (past start)' do
|
||||
ev = described_class.new(
|
||||
:created => time,
|
||||
|
|
@ -107,6 +112,7 @@ describe Symphony::Metronome::ScheduledEvent do
|
|||
expect( ev.runtime ).to be >= time + 3600 + 30
|
||||
end
|
||||
|
||||
|
||||
it 'can reschedule itself into the future when recurring (recently run)' do
|
||||
ds.insert(
|
||||
:created => time,
|
||||
|
|
@ -120,9 +126,10 @@ describe Symphony::Metronome::ScheduledEvent do
|
|||
ev.reset_runtime
|
||||
end
|
||||
|
||||
expect( ev.runtime ).to be >= time + 18
|
||||
expect( ev.runtime ).to be >= time + 17
|
||||
end
|
||||
|
||||
|
||||
it 'removes itself when firing if expired' do
|
||||
ds.insert(
|
||||
:created => time,
|
||||
|
|
@ -135,6 +142,7 @@ describe Symphony::Metronome::ScheduledEvent do
|
|||
expect( ds.count ).to eq( 0 )
|
||||
end
|
||||
|
||||
|
||||
it 'yields a deserialized options hash if okay to fire' do
|
||||
ev = described_class.new(
|
||||
:created => time,
|
||||
|
|
@ -150,6 +158,7 @@ describe Symphony::Metronome::ScheduledEvent do
|
|||
expect( res ).to be( 12 )
|
||||
end
|
||||
|
||||
|
||||
it "won't re-fire recurring events if they already fired within their interval window" do
|
||||
ds.insert(
|
||||
:created => time,
|
||||
|
|
@ -170,6 +179,7 @@ describe Symphony::Metronome::ScheduledEvent do
|
|||
expect( res ).to be( 0 )
|
||||
end
|
||||
|
||||
|
||||
it 'randomizes start times if a splay is configured' do
|
||||
described_class.instance_variable_set( :@splay, 5 )
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue