forked from kookster/activemessaging
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added guard against registering callbacks with the dispatcher when …
…running outside of Rails * Made all tests run successfully outside Rails. Just run "rake test"
- Loading branch information
Showing
12 changed files
with
60 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
require 'activemessaging/adapter' | ||
|
||
module ActiveMessaging | ||
module Adapters | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
require 'dispatcher' unless defined?(::Dispatcher) | ||
::Dispatcher.class_eval do | ||
if defined? Rails | ||
ActiveMessaging.logger.debug "Rails available: Adding reload hooks." | ||
require 'dispatcher' unless defined?(::Dispatcher) | ||
::Dispatcher.class_eval do | ||
|
||
def self.prepare_application_for_dispatch | ||
disp = new(STDOUT) | ||
disp.run_callbacks :before_dispatch | ||
end | ||
|
||
def self.reset_application_after_dispatch | ||
disp = new(STDOUT) | ||
disp.run_callbacks :after_dispatch, :enumerator => :reverse_each | ||
end | ||
|
||
def self.prepare_application_for_dispatch | ||
disp = new(STDOUT) | ||
disp.run_callbacks :before_dispatch | ||
end | ||
|
||
def self.reset_application_after_dispatch | ||
disp = new(STDOUT) | ||
disp.run_callbacks :after_dispatch, :enumerator => :reverse_each | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Yaml config file for testing ActiveMessaging | ||
test: | ||
adapter: test | ||
reliable: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
# load the rails environment | ||
# TODO currently requires you to run tests as a installed plugin, we should try to fix this | ||
ENV['APP_ENV'] = "test" | ||
require File.expand_path(File.dirname(__FILE__) + "/../../../../config/environment") | ||
ENV['APP_ENV'] = 'test' | ||
APP_ENV = 'test' | ||
if defined? Rails | ||
APP_ROOT = RAILS_ROOT | ||
require File.expand_path(File.dirname(__FILE__) + "/../../../../config/environment") | ||
else | ||
APP_ROOT = File.dirname(__FILE__) + '/app' | ||
require 'rubygems' | ||
require 'activesupport' | ||
require File.dirname(__FILE__) + '/../lib/activemessaging/message_sender' | ||
require File.dirname(__FILE__) + '/../lib/activemessaging/processor' | ||
require File.dirname(__FILE__) + '/../lib/activemessaging/gateway' | ||
end | ||
|
||
# load other libraries | ||
require 'test/unit' | ||
|
||
# load activemessaging | ||
# TODO this is already loaded automatically by starting Rails | ||
# but we may need to do this if we want to run a13g tests without Rails | ||
#require File.dirname(__FILE__) + '/../lib/activemessaging/processor' | ||
#require File.dirname(__FILE__) + '/../lib/activemessaging/gateway' | ||
require File.dirname(__FILE__) + '/../lib/activemessaging/test_helper' | ||
|
||
|
||
require 'activemessaging/adapters/test' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters