From 3270ea7c7e666c9d063cf6eba1e39ba8ad3aae26 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 12 Oct 2015 23:31:33 +0200 Subject: [PATCH] Fixed tests. --- app/models/ticket.rb | 2 +- test/unit/ticket_selector_test.rb | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/models/ticket.rb b/app/models/ticket.rb index 61c3bd043..3e9623271 100644 --- a/app/models/ticket.rb +++ b/app/models/ticket.rb @@ -414,7 +414,7 @@ condition example end bind_params.push time elsif selector['operator'] == 'within next (relative)' - query += "#{attribute} >= ?" + query += "#{attribute} <= ?" time = nil if selector['range'] == 'minute' time = Time.zone.now + selector['value'].to_i.minutes diff --git a/test/unit/ticket_selector_test.rb b/test/unit/ticket_selector_test.rb index d4793752d..b6da0727d 100644 --- a/test/unit/ticket_selector_test.rb +++ b/test/unit/ticket_selector_test.rb @@ -303,16 +303,16 @@ class TicketSelectorTest < ActiveSupport::TestCase }, } ticket_count, tickets = Ticket.selectors(condition, 10, agent1) - assert_equal( ticket_count, 0 ) + assert_equal( ticket_count, 2 ) ticket_count, tickets = Ticket.selectors(condition, 10, agent2) assert_equal( ticket_count, 0 ) ticket_count, tickets = Ticket.selectors(condition, 10, customer1) - assert_equal( ticket_count, 0 ) + assert_equal( ticket_count, 1 ) ticket_count, tickets = Ticket.selectors(condition, 10, customer2) - assert_equal( ticket_count, 0 ) + assert_equal( ticket_count, 1 ) condition = { 'ticket.group_id' => { @@ -461,16 +461,16 @@ class TicketSelectorTest < ActiveSupport::TestCase }, } ticket_count, tickets = Ticket.selectors(condition, 10, agent1) - assert_equal( ticket_count, 0 ) + assert_equal( ticket_count, 2 ) ticket_count, tickets = Ticket.selectors(condition, 10, agent2) assert_equal( ticket_count, 0 ) ticket_count, tickets = Ticket.selectors(condition, 10, customer1) - assert_equal( ticket_count, 0 ) + assert_equal( ticket_count, 1 ) ticket_count, tickets = Ticket.selectors(condition, 10, customer2) - assert_equal( ticket_count, 0 ) + assert_equal( ticket_count, 1 ) condition = { 'ticket.group_id' => {