Sha256: 5b17704b3901ae0251a159ac90debd14e60ce31c1e109b1ef6c08e7b51de41b1

Contents?: true

Size: 965 Bytes

Versions: 6

Compression:

Stored size: 965 Bytes

Contents

# -*- encoding : utf-8 -*-
require 'test_helper'

module TestBackgroundWorker
	mattr_accessor :result

	class << self
		def enqueue(tracking_type, opts)
			TestBackgroundWorker.result = "I got called with #{tracking_type} #{opts}"
		end
	end
end

class Odania::DeliverControllerTest < ActionController::TestCase
	def setup
		@site = create(:default_site)
		@request.host = @site.host
		@content = create(:content, site: @site)
	end

	test 'test should redirect to target' do
		target = 'http://www.mylyconet.com/mikepetersen/'
		Odania.setup do |config|
			config.background_enqueue = 'TestBackgroundWorker.enqueue'
		end

		get :click, {target: URI.escape(target), id: 'myid', type: 'test-type'}
		assert_response :redirect
		assert_redirected_to target
		assert_match /I got called with ClickWorker/, TestBackgroundWorker.result
		assert_match /obj_type.*"test-type"/, TestBackgroundWorker.result
		assert_match /id.*"myid"/, TestBackgroundWorker.result
	end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
odania_core-0.0.6 test/controllers/odania/deliver_controller_test.rb
odania_core-0.0.5 test/controllers/odania/deliver_controller_test.rb
odania_core-0.0.4 test/controllers/odania/deliver_controller_test.rb
odania_core-0.0.3 test/controllers/odania/deliver_controller_test.rb
odania_core-0.0.2 test/controllers/odania/deliver_controller_test.rb
odania_core-0.0.1 test/controllers/odania/deliver_controller_test.rb