Improved web server detection.
This commit is contained in:
parent
438bd42b8d
commit
23dc2d9522
3 changed files with 6 additions and 4 deletions
|
@ -18,7 +18,7 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
|
||||||
EventBuffer.reset
|
EventBuffer.reset
|
||||||
|
|
||||||
via_web = false
|
via_web = false
|
||||||
if ENV['RACK_ENV'] || defined? Rails.configuration.webserver_is_active
|
if ENV['RACK_ENV'] || Rails.configuration.webserver_is_active
|
||||||
via_web = true
|
via_web = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
2
config/initializers/web_server.rb
Normal file
2
config/initializers/web_server.rb
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
|
||||||
|
Rails.configuration.webserver_is_active = false
|
|
@ -86,7 +86,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
assert(ticket1)
|
assert(ticket1)
|
||||||
|
|
||||||
# execute ticket events
|
# execute ticket events
|
||||||
ENV['SERVER_NAME'] = nil
|
Rails.configuration.webserver_is_active = nil
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Ticket::Notification.transaction
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
@ -121,7 +121,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
assert(ticket1)
|
assert(ticket1)
|
||||||
|
|
||||||
# execute ticket events
|
# execute ticket events
|
||||||
ENV['SERVER_NAME'] = 'some_host'
|
Rails.configuration.webserver_is_active = true
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Ticket::Notification.transaction
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
@ -159,7 +159,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
assert( ticket1, 'ticket created - ticket notification simple' )
|
assert( ticket1, 'ticket created - ticket notification simple' )
|
||||||
|
|
||||||
# execute ticket events
|
# execute ticket events
|
||||||
ENV['SERVER_NAME'] = 'some_host'
|
Rails.configuration.webserver_is_active = true
|
||||||
Observer::Ticket::Notification.transaction
|
Observer::Ticket::Notification.transaction
|
||||||
#puts Delayed::Job.all.inspect
|
#puts Delayed::Job.all.inspect
|
||||||
Delayed::Worker.new.work_off
|
Delayed::Worker.new.work_off
|
||||||
|
|
Loading…
Reference in a new issue