guard-compat 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/guard/compat/example.rb +12 -1
- data/lib/guard/compat/test/helper.rb +6 -6
- data/lib/guard/compat/version.rb +1 -1
- data/spec/guard/compat/example_spec.rb +11 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5c15f5a243693a6af0123db855199c6dd3ce1a0
|
4
|
+
data.tar.gz: 2b4187ea85ba0bfa512d5298788c5c21f46a89cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5c161fe3ef52a00aaca0a1c81ee30acda5febb69c642b9067ea8866ecfb4440f8d41da0ad5572fdd2ea2b7dde923b177dd6319b7c23b1a328d8db5f362806a3
|
7
|
+
data.tar.gz: 7706bfba6558b2abf1642afc25280f5cbb6af15c83f59af5b5bb5f29b7e19e9764e4d4634c1e9dfff11ecfaa0c8d12bb3a26d25f7def96a6c80ad5ff5b864165
|
data/lib/guard/compat/example.rb
CHANGED
@@ -4,12 +4,23 @@
|
|
4
4
|
module Guard
|
5
5
|
class MyPlugin < Plugin
|
6
6
|
def start
|
7
|
-
Guard::Notifier.notify('foo'
|
7
|
+
Guard::Notifier.notify('foo')
|
8
|
+
|
8
9
|
Guard::UI.info('foo')
|
9
10
|
Guard::UI.warning('foo')
|
10
11
|
Guard::UI.error('foo')
|
11
12
|
Guard::UI.debug('foo')
|
12
13
|
Guard::UI.deprecation('foo')
|
13
14
|
end
|
15
|
+
|
16
|
+
def run_all
|
17
|
+
Guard::Notifier.notify('foo', title: 'bar')
|
18
|
+
|
19
|
+
Guard::UI.info('foo', bar: :baz)
|
20
|
+
Guard::UI.warning('foo', bar: :baz)
|
21
|
+
Guard::UI.error('foo', bar: :baz)
|
22
|
+
Guard::UI.debug('foo', bar: :baz)
|
23
|
+
Guard::UI.deprecation('foo', bar: :baz)
|
24
|
+
end
|
14
25
|
end
|
15
26
|
end
|
@@ -9,29 +9,29 @@ module Guard
|
|
9
9
|
end
|
10
10
|
|
11
11
|
class Notifier
|
12
|
-
def self.notify(_msg, _options)
|
12
|
+
def self.notify(_msg, _options = {})
|
13
13
|
fail NotImplementedError, 'stub this method in your tests'
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
class UI
|
18
|
-
def self.info(_msg)
|
18
|
+
def self.info(_msg, _options = {})
|
19
19
|
fail NotImplementedError, 'stub this method in your tests'
|
20
20
|
end
|
21
21
|
|
22
|
-
def self.warning(_msg)
|
22
|
+
def self.warning(_msg, _options = {})
|
23
23
|
fail NotImplementedError, 'stub this method in your tests'
|
24
24
|
end
|
25
25
|
|
26
|
-
def self.error(_msg)
|
26
|
+
def self.error(_msg, _options = {})
|
27
27
|
fail NotImplementedError, 'stub this method in your tests'
|
28
28
|
end
|
29
29
|
|
30
|
-
def self.debug(_msg)
|
30
|
+
def self.debug(_msg, _options = {})
|
31
31
|
fail NotImplementedError, 'stub this method in your tests'
|
32
32
|
end
|
33
33
|
|
34
|
-
def self.deprecation(_msg)
|
34
|
+
def self.deprecation(_msg, _options = {})
|
35
35
|
fail NotImplementedError, 'stub this method in your tests'
|
36
36
|
end
|
37
37
|
end
|
data/lib/guard/compat/version.rb
CHANGED
@@ -18,14 +18,24 @@ RSpec.describe Guard::MyPlugin, exclude_stubs: [Guard::Plugin] do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'uses the notifier' do
|
21
|
-
expect(Guard::Notifier).to receive(:notify).with('foo'
|
21
|
+
expect(Guard::Notifier).to receive(:notify).with('foo')
|
22
22
|
subject.start
|
23
23
|
end
|
24
24
|
|
25
|
+
it 'uses the notifier with options' do
|
26
|
+
expect(Guard::Notifier).to receive(:notify).with('foo', title: 'bar')
|
27
|
+
subject.run_all
|
28
|
+
end
|
29
|
+
|
25
30
|
%w(info warning error deprecation debug).each do |type|
|
26
31
|
it "outputs #{type} messages" do
|
27
32
|
expect(Guard::UI).to receive(type.to_sym).with('foo')
|
28
33
|
subject.start
|
29
34
|
end
|
35
|
+
|
36
|
+
it "outputs #{type} messages with options" do
|
37
|
+
expect(Guard::UI).to receive(type.to_sym).with('foo', bar: :baz)
|
38
|
+
subject.run_all
|
39
|
+
end
|
30
40
|
end
|
31
41
|
end
|