Top Level Namespace
- Includes:
- Jackal::Utils::Config, Jackal::Utils::Payload
Defined Under Namespace
Modules: Jackal
Instance Method Summary (collapse)
-
- (Hash) config
included
from Jackal::Utils::Config
Configuration.
-
- (Array) config_path(class_name = self.class.name)
included
from Jackal::Utils::Config
Key path in configuration.
-
- (Symbol) destination(direction = :output)
included
from Jackal::Utils::Config
Generation destination key based on direction.
-
- (Smash) new_payload(name, payload, *args)
included
from Jackal::Utils::Payload
Generate a new payload.
-
- (Hash) payload_for(style, args = {})
Fetch test payload and create new payload.
-
- (Thread) run_setup(config)
Configure using custom configuration JSON within config directory of current test.
-
- (String) source_prefix
included
from Jackal::Utils::Config
Prefix of source for this callback.
-
- (Smash) unpack(message)
included
from Jackal::Utils::Payload
Extract payload from message.
Instance Method Details
- (Hash) config Originally defined in module Jackal::Utils::Config
Returns configuration
- (Array) config_path(class_name = self.class.name) Originally defined in module Jackal::Utils::Config
Returns key path in configuration
- (Symbol) destination(direction = :output) Originally defined in module Jackal::Utils::Config
Generation destination key based on direction
- (Smash) new_payload(name, payload, *args) Originally defined in module Jackal::Utils::Payload
Generate a new payload
- (Hash) payload_for(style, args = {})
style
is name of test payload without .json extension. Will
Fetch test payload and create new payload
search 'test/specs/payload' from CWD first, then fallback to 'payloads' directory within the directory of this file
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/jackal/utils/spec/helpers.rb', line 29 def payload_for(style, args={}) file = "#{style}.json" path = [File.join(Dir.pwd, 'test/specs/payloads'), Jackal::Utils::Spec.payload_storage].flatten.compact.map do |dir| if(File.exists?(full_path = File.join(dir, file))) full_path end end.compact.first if(path) if(args[:raw]) MultiJson.load(File.read(path)) else if(args[:nest]) Jackal::Utils.new_payload(:test, args[:nest] => MultiJson.load(File.read(path))) else Jackal::Utils.new_payload(:test, File.read(path)) end end else raise "Requested payload path for test does not exist: #{path ? File.(path) : 'no path discovered'}" end end |
- (Thread) run_setup(config)
Configure using custom configuration JSON within config directory of current test
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/jackal/utils/spec/helpers.rb', line 56 def run_setup(config) path = File.join(Dir.pwd, 'test/specs/config', "#{config}.json") Carnivore::Config.configure(:config_path => path) Thread.abort_on_exception = true runner = Thread.new do require 'jackal/loader' end source_wait(:setup) runner end |
- (String) source_prefix Originally defined in module Jackal::Utils::Config
Returns prefix of source for this callback
- (Smash) unpack(message) Originally defined in module Jackal::Utils::Payload
Extract payload from message