Sha256: 99e833f70c414dc7db6ccabe094a29c7adc72946ab87f5d897b035fa62521962

Contents?: true

Size: 660 Bytes

Versions: 1

Compression:

Stored size: 660 Bytes

Contents

module Telesignature
  module MockService
    class Railtie < ::Rails::Railtie
      initializer 'telesignature_railtie.configure_rails_initialization' do

        if ENV['TELESIGN_STUBBED']
          port = (ENV['TELESIGN_PORT'].to_i || 11989)
          if `lsof -i :#{port}`.blank? # no process running on 11988
            Process.detach(pid = Process.fork do
              require 'telesignature/mock_service/fake_server'
            end)
          else
            Rails.logger.warn "TELESIGN STUB MODE FAILED TO START\nProcess already listening on #{port}"
          end
        end

        at_exit { pid && `kill #{pid}` }

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
telesignature-0.0.6 lib/telesignature/mock_service/railtie.rb