coruro-ruby 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 71d204be90e212c0d424b02666b5ce2d36210a6f201c3c435057daa0a2ca111e
4
- data.tar.gz: c0363f1f25d724503bd0bbf645f8b9d657e8f8b9570652616aacbee92cf05c93
2
+ SHA1:
3
+ metadata.gz: 8e3b2a6efaaa233689e7c9d9c514c47a0d7d41e5
4
+ data.tar.gz: 4631a618419aedfb4bcc5b5bd8da479de5058a0a
5
5
  SHA512:
6
- metadata.gz: 4d02e9549d3336f1f37bf8a369b93eedae6cedc6f66ed0752944a2e162213d6b4c795d510b42198b275176d09757e266faa6995afe950aeeb881195ca9a111ab
7
- data.tar.gz: 12ad3ace46fad696d1b7993d60235550e65dea1f82bda27638908b5393f1e766815968589a66840cbdfb724030718e1837ff4b3fa5228f55dd3fffb9fb1a287b
6
+ metadata.gz: 3fcc66ed8fd6fd7bb39de58ca83caa9864b08a48988e968b59342a4feb96ee14fcb0084d49ba2977dc0f8c29a036c2242283db795d6a922fa5bab10ba4356d7d
7
+ data.tar.gz: dfd2d860d6e8aa2230cb254cfdde319784886924c09b664036b8efab0c5d2eb67a9ff9e903b362d673d4df4b0e5519800eff28b11a771e5721534fec4ce59c9c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- coruro-ruby (0.4.0)
4
+ coruro-ruby (0.6.0)
5
5
  mail (~> 2.7.0)
6
6
 
7
7
  GEM
@@ -52,4 +52,4 @@ DEPENDENCIES
52
52
  rake (~> 10.0)
53
53
 
54
54
  BUNDLED WITH
55
- 1.16.1
55
+ 1.16.2
data/lib/coruro.rb CHANGED
@@ -12,9 +12,8 @@ class Coruro
12
12
  def_delegators :adapter, :all, :where, :stop
13
13
 
14
14
  def initialize(adapter:, on_wait_tick: -> (count) { }, timeout: 1.0, adapter_config: {})
15
- case adapter
16
- when :mailcatcher
17
- self.adapter = MailcatcherAdapter.new(timeout: timeout, config: adapter_config)
15
+ if adapters.key?(adapter)
16
+ self.adapter = adapters[adapter].new(timeout: timeout, config: adapter_config)
18
17
  self.adapter.start unless self.adapter.up?
19
18
  else
20
19
  raise UnrecognizedAdapterError, adapter
@@ -33,5 +32,14 @@ class Coruro
33
32
  end
34
33
 
35
34
  class UnrecognizedAdapterError < StandardError; end
35
+
36
+
37
+ def adapters
38
+ self.class.adapters
39
+ end
40
+
41
+ def self.adapters
42
+ @adapters ||= { mailcatcher: MailcatcherAdapter }
43
+ end
36
44
  end
37
45
 
@@ -5,27 +5,9 @@ require 'singleton'
5
5
  require_relative 'unbundle'
6
6
 
7
7
  class Coruro
8
- class Configuration
9
- attr_accessor :config
10
- def initialize(config)
11
- self.config = config
12
- end
13
-
14
- def http_root
15
- config.fetch(:http_root, 'http://localhost:1080')
16
- end
17
-
18
- def expose_stream?(stream)
19
- !expose_streams[stream].nil?
20
- end
21
-
22
- def expose_streams
23
- config.fetch(:expose_streams, {})
24
- end
25
- end
26
-
27
8
  # Translates between Curoro and Mailcatcher's API
28
9
  class MailcatcherAdapter
10
+
29
11
  attr_accessor :runner, :timeout, :config
30
12
  extend Forwardable
31
13
  def_delegators :runner, :stop
@@ -53,12 +35,12 @@ class Coruro
53
35
 
54
36
  def match?(query, value)
55
37
  return false if query.nil?
56
- return query.match?(value) if query.respond_to?(:match?) && !value.respond_to?(:any?)
57
38
  return value.any? { |child| match?(query, child) } if value.respond_to?(:any?)
39
+ return query.match?(value) if query.respond_to?(:match?)
40
+ return !query.match(value).nil? if query.respond_to?(:match)
58
41
  raise ArgumentError, "Query #{query} must respond to `match?` or Value #{value} must respond to `any?`"
59
42
  end
60
43
 
61
-
62
44
  def up?
63
45
  runner.up?(config)
64
46
  end
@@ -135,5 +117,24 @@ class Coruro
135
117
  { stderr: stderr, stdout: stdout, stdin: stdin }
136
118
  end
137
119
  end
120
+
121
+ class Configuration
122
+ attr_accessor :config
123
+ def initialize(config)
124
+ self.config = config
125
+ end
126
+
127
+ def http_root
128
+ config.fetch(:http_root, 'http://localhost:1080')
129
+ end
130
+
131
+ def expose_stream?(stream)
132
+ !expose_streams[stream].nil?
133
+ end
134
+
135
+ def expose_streams
136
+ config.fetch(:expose_streams, {})
137
+ end
138
+ end
138
139
  end
139
140
  end
@@ -1,3 +1,3 @@
1
1
  class Coruro
2
- VERSION="0.5.0"
2
+ VERSION="0.6.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coruro-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zee Spencer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-15 00:00:00.000000000 Z
11
+ date: 2018-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mail
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  version: '0'
138
138
  requirements: []
139
139
  rubyforge_project:
140
- rubygems_version: 2.7.4
140
+ rubygems_version: 2.5.2.3
141
141
  signing_key:
142
142
  specification_version: 4
143
143
  summary: Capybara-inspired testing library for emails and notifications