jackal 0.1.6 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ # v0.1.8
2
+ * Allow extra arguments to be passed through new_payload
3
+ * Spec helper updates
4
+
1
5
  # v0.1.6
2
6
  * Include default source for HTTP endpoints if used and configuration enables
3
7
 
@@ -10,8 +10,9 @@ module Jackal
10
10
  #
11
11
  # @param name [String]
12
12
  # @param payload [Hash]
13
+ # @param args [Object] extra arguments
13
14
  # @return [Smash]
14
- def new_payload(name, payload)
15
+ def new_payload(name, payload, *args)
15
16
  Smash.new(
16
17
  :name => name,
17
18
  :id => Celluloid.uuid,
@@ -5,6 +5,27 @@ module Jackal
5
5
  # Testing helpers
6
6
  module Spec
7
7
  autoload :CallbackLocal, 'jackal/utils/spec/callback_local'
8
+
9
+ class << self
10
+
11
+ # Valid directories for test payloads
12
+ #
13
+ # @param args [String] list of directories to append
14
+ # @return [Array<String>]
15
+ def payload_storage(*args)
16
+ unless(@_payload_dirs)
17
+ @_payload_dirs = []
18
+ end
19
+ unless(args.empty?)
20
+ @_payload_dirs += args.find_all do |dir_path|
21
+ File.directory?(dir_path)
22
+ end
23
+ @_payload_dirs.uniq!
24
+ end
25
+ @_payload_dirs
26
+ end
27
+
28
+ end
8
29
  end
9
30
  end
10
31
  end
@@ -18,6 +18,16 @@ module Jackal
18
18
  @forwarded << payload
19
19
  end
20
20
 
21
+ class << self
22
+ # Init data store for internal message capture
23
+ def extended(klass)
24
+ klass.instance_eval do
25
+ @forwarded = []
26
+ end
27
+ end
28
+ alias_method :included, :extended
29
+ end
30
+
21
31
  end
22
32
  end
23
33
  end
@@ -16,9 +16,19 @@ ENV.each do |key, value|
16
16
  end
17
17
  end
18
18
 
19
+ # Fetch test payload and create new payload
20
+ #
21
+ # @param style [String, Symbol] name of payload
22
+ # @param args [Hash]
23
+ # @option args [TrueClass, FalseClass] :raw return loaded payload only
24
+ # @option args [String, Symbol] :nest place loaded payload within key namespace in hash
25
+ # @return [Hash] new payload
26
+ # @note `style` is name of test payload without .json extension. Will
27
+ # search 'test/specs/payload' from CWD first, then fallback to
28
+ # 'payloads' directory within the directory of this file
19
29
  def payload_for(style, args={})
20
30
  file = "#{style}.json"
21
- path = [File.join(Dir.pwd, 'test/specs/payloads'), File.join(File.dirname(__FILE__), 'payloads')].map do |dir|
31
+ path = [File.join(Dir.pwd, 'test/specs/payloads'), Jackal::Utils::Spec.payload_storage].flatten.compact.map do |dir|
22
32
  if(File.exists?(full_path = File.join(dir, file)))
23
33
  full_path
24
34
  end
@@ -34,13 +44,19 @@ def payload_for(style, args={})
34
44
  end
35
45
  end
36
46
  else
37
- raise "Requested payload path for test does not exist: #{File.expand_path(path)}"
47
+ raise "Requested payload path for test does not exist: #{path ? File.expand_path(path) : 'no path discovered'}"
38
48
  end
39
49
  end
40
50
 
51
+ # Configure using custom configuration JSON within config
52
+ # directory of current test
53
+ #
54
+ # @param config [String, Symbol] name of configuration file without json extension
55
+ # @return [Thread] thread with running source
41
56
  def run_setup(config)
42
57
  path = File.join(Dir.pwd, 'test/specs/config', "#{config}.json")
43
58
  Carnivore::Config.configure(:config_path => path)
59
+ Thread.abort_on_exception = true
44
60
  runner = Thread.new do
45
61
  require 'jackal/loader'
46
62
  end
@@ -1,5 +1,4 @@
1
1
  module Jackal
2
- class Version < Gem::Version
3
- end
4
- VERSION = Version.new('0.1.6')
2
+ # Current library version
3
+ VERSION = Gem::Version.new('0.1.8')
5
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jackal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-12 00:00:00.000000000 Z
12
+ date: 2014-07-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: carnivore