mirror of
https://github.com/Fishwaldo/huginn.git
synced 2025-03-15 19:31:26 +00:00
Fixes postgres and DST related spec issues
This commit is contained in:
parent
89a7848c80
commit
842528ab3e
3 changed files with 19 additions and 14 deletions
|
@ -28,7 +28,7 @@ describe ScenariosController do
|
|||
|
||||
it "loads Agents for the requested Scenario" do
|
||||
get :show, :id => scenarios(:bob_weather).to_param
|
||||
expect(assigns(:agents).pluck(:id)).to eq(scenarios(:bob_weather).agents.pluck(:id))
|
||||
expect(assigns(:agents).pluck(:id).sort).to eq(scenarios(:bob_weather).agents.pluck(:id).sort)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ describe Rufus::Scheduler do
|
|||
it 'registers active SchedulerAgents' do
|
||||
@scheduler.schedule_scheduler_agents
|
||||
|
||||
expect(@scheduler.scheduler_agent_jobs.map(&:scheduler_agent)).to eq([@agent1, @agent2])
|
||||
expect(@scheduler.scheduler_agent_jobs.map(&:scheduler_agent).sort_by(&:id)).to eq([@agent1, @agent2])
|
||||
end
|
||||
|
||||
it 'unregisters disabled SchedulerAgents' do
|
||||
|
|
|
@ -561,12 +561,15 @@ describe Agent do
|
|||
|
||||
describe "cleaning up now-expired events" do
|
||||
before do
|
||||
@agent = Agents::SomethingSource.new(:name => "something")
|
||||
@agent.keep_events_for = 5
|
||||
@agent.user = users(:bob)
|
||||
@agent.save!
|
||||
@event = @agent.create_event :payload => { "hello" => "world" }
|
||||
expect(@event.expires_at.to_i).to be_within(2).of(5.days.from_now.to_i)
|
||||
@time = "2014-01-01 01:00:00 +00:00"
|
||||
time_travel_to @time do
|
||||
@agent = Agents::SomethingSource.new(:name => "something")
|
||||
@agent.keep_events_for = 5
|
||||
@agent.user = users(:bob)
|
||||
@agent.save!
|
||||
@event = @agent.create_event :payload => { "hello" => "world" }
|
||||
expect(@event.expires_at.to_i).to be_within(2).of(5.days.from_now.to_i)
|
||||
end
|
||||
end
|
||||
|
||||
describe "when keep_events_for has not changed" do
|
||||
|
@ -584,12 +587,14 @@ describe Agent do
|
|||
|
||||
describe "when keep_events_for is changed" do
|
||||
it "updates events' expires_at" do
|
||||
expect {
|
||||
@agent.options[:foo] = "bar1"
|
||||
@agent.keep_events_for = 3
|
||||
@agent.save!
|
||||
}.to change { @event.reload.expires_at }
|
||||
expect(@event.expires_at.to_i).to be_within(2).of(3.days.from_now.to_i)
|
||||
time_travel_to @time do
|
||||
expect {
|
||||
@agent.options[:foo] = "bar1"
|
||||
@agent.keep_events_for = 3
|
||||
@agent.save!
|
||||
}.to change { @event.reload.expires_at }
|
||||
expect(@event.expires_at.to_i).to be_within(2).of(3.days.from_now.to_i)
|
||||
end
|
||||
end
|
||||
|
||||
it "updates events relative to their created_at" do
|
||||
|
|
Loading…
Add table
Reference in a new issue