Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Commit

Permalink
Allow usage of HTTP queue client for dev
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrei committed Oct 11, 2016
1 parent 09803d6 commit 8f93131
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

module ChampaignQueue
module Clients
class Direct
class HTTP
class << self
def push(params)
new(params).push
Expand All @@ -20,7 +20,7 @@ def initialize(params)
end

def push
return false if ak_processor_url.blank?
raise "Champaign queue http URL not set" if queue_http_url.blank?

Net::HTTP.start(uri.host, uri.port) do |http|
http.post(uri.path, @params.to_query)
Expand All @@ -34,11 +34,11 @@ def http
private

def uri
URI(ak_processor_url)
URI(queue_http_url)
end

def ak_processor_url
Settings.ak_processor_url
def queue_http_url
Settings.champaign_queue_http_url
end
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# frozen_string_literal: true
require 'rails_helper'

describe ChampaignQueue::Clients::Direct do
describe ChampaignQueue::Clients::HTTP do
before do
Settings.ak_processor_url = 'http://example.com/message'
Settings.champaign_queue_http_url = 'http://example.com/message'
end

before do
Expand All @@ -12,7 +12,7 @@
end

it 'posts directly to ActionKit worker' do
ChampaignQueue::Clients::Direct.push(foo: :bar)
ChampaignQueue::Clients::HTTP.push(foo: :bar)
expect(@stub).to have_been_requested
end
end

0 comments on commit 8f93131

Please sign in to comment.