coruro-ruby 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile.lock +2 -2
- data/lib/coruro.rb +11 -3
- data/lib/coruro/mailcatcher_adapter.rb +22 -21
- data/lib/coruro/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8e3b2a6efaaa233689e7c9d9c514c47a0d7d41e5
|
4
|
+
data.tar.gz: 4631a618419aedfb4bcc5b5bd8da479de5058a0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fcc66ed8fd6fd7bb39de58ca83caa9864b08a48988e968b59342a4feb96ee14fcb0084d49ba2977dc0f8c29a036c2242283db795d6a922fa5bab10ba4356d7d
|
7
|
+
data.tar.gz: dfd2d860d6e8aa2230cb254cfdde319784886924c09b664036b8efab0c5d2eb67a9ff9e903b362d673d4df4b0e5519800eff28b11a771e5721534fec4ce59c9c
|
data/Gemfile.lock
CHANGED
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
|
-
|
16
|
-
|
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
|
data/lib/coruro/version.rb
CHANGED
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.
|
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-
|
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.
|
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
|