speedflow-plugin-test 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/speedflow/plugin/test.rb +2 -20
- data/lib/speedflow/plugin/test/plugin.rb +48 -0
- data/lib/speedflow/plugin/test/version.rb +1 -1
- data/spec/spec_helper.rb +7 -5
- data/spec/speedflow/plugin/test/plugin_spec.rb +18 -0
- data/spec/speedflow/plugin/test_spec.rb +0 -9
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf8aa0e2526dac196dd60aa3340d9ab78cc16936
|
4
|
+
data.tar.gz: 409df4d02a062c9d92f87a21c3af5a628833ca7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea62b0e26cd41e67281d976cd4df2ce92b4eb1dab1866c68f0e6e8632ac62cb5856f44d7a33ed3ac2ba87ef371b71a9223a794086fd8509643dc1cff69bc42d5
|
7
|
+
data.tar.gz: f314a3e157f99446831116649d0e60d0b72ea48286b7cf49db2708068d20c39933079e51b638d12cf1c1c85f093b15ae82d098152735ab7d52929b6f33da19fe
|
@@ -1,29 +1,11 @@
|
|
1
1
|
require 'speedflow/plugin/test/version'
|
2
|
+
require 'speedflow/plugin/test/plugin'
|
2
3
|
|
3
4
|
# Speedflow GEM, help you to boost your flow and keep your time
|
4
5
|
module Speedflow
|
5
6
|
module Plugin
|
6
|
-
#
|
7
|
+
# Test plugin
|
7
8
|
module Test
|
8
|
-
class << self
|
9
|
-
# Public: Method missing
|
10
|
-
#
|
11
|
-
# Method used to catch others methods to test.
|
12
|
-
#
|
13
|
-
# args - Some arguments :)
|
14
|
-
#
|
15
|
-
# Returns Hash of arguments.
|
16
|
-
def method_missing(*args)
|
17
|
-
action = args.first
|
18
|
-
arguments = args.last
|
19
|
-
|
20
|
-
raise NoMethodError if action.to_s == 'action_no_method'
|
21
|
-
|
22
|
-
puts "Load: #{action} with args: #{arguments}"
|
23
|
-
|
24
|
-
arguments
|
25
|
-
end
|
26
|
-
end
|
27
9
|
end
|
28
10
|
end
|
29
11
|
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Speedflow
|
2
|
+
module Plugin
|
3
|
+
module Test
|
4
|
+
# Speedflow test plugin
|
5
|
+
class Plugin
|
6
|
+
# @return [Prompt] Plugin prompt.
|
7
|
+
attr_accessor :prompt
|
8
|
+
|
9
|
+
# @return [Config] Plugin config.
|
10
|
+
attr_accessor :config
|
11
|
+
|
12
|
+
# Public: Constructor
|
13
|
+
#
|
14
|
+
# config - Speedflow::Plugin::Configuration object.
|
15
|
+
#
|
16
|
+
# Examples
|
17
|
+
#
|
18
|
+
# Manager.new(<Speedflow::Plugin::Configuration.new({})>)
|
19
|
+
# # => <Speedflow::Plugin::Test>
|
20
|
+
#
|
21
|
+
# Returns nothing.
|
22
|
+
def initialize(config, prompt)
|
23
|
+
@config = config
|
24
|
+
@prompt = prompt
|
25
|
+
end
|
26
|
+
|
27
|
+
# Public: Method missing
|
28
|
+
#
|
29
|
+
# Method used to catch others methods to test.
|
30
|
+
#
|
31
|
+
# args - Some arguments :)
|
32
|
+
#
|
33
|
+
# Returns Hash of arguments.
|
34
|
+
def method_missing(*args)
|
35
|
+
action = args.first
|
36
|
+
|
37
|
+
raise NoMethodError if action.to_s == 'action_no_method'
|
38
|
+
|
39
|
+
@prompt.warn " - Pong: #{action}"
|
40
|
+
@prompt.warn " Config: #{@config.all_config}"
|
41
|
+
@prompt.warn " Input: #{@config.all_input}"
|
42
|
+
|
43
|
+
@config.all_input
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
+
|
2
3
|
require 'simplecov'
|
4
|
+
require 'codeclimate-test-reporter'
|
3
5
|
|
4
|
-
if ENV['CODECLIMATE_REPO_TOKEN']
|
5
|
-
require 'codeclimate-test-reporter'
|
6
|
-
CodeClimate::TestReporter.start
|
7
|
-
end
|
6
|
+
CodeClimate::TestReporter.start if ENV['CODECLIMATE_REPO_TOKEN']
|
8
7
|
|
9
|
-
SimpleCov.start
|
8
|
+
SimpleCov.start do
|
9
|
+
formatter SimpleCov::Formatter::MultiFormatter.new(
|
10
|
+
[SimpleCov::Formatter::HTMLFormatter, CodeClimate::TestReporter::Formatter])
|
11
|
+
end
|
10
12
|
|
11
13
|
require 'speedflow/plugin/test'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Speedflow::Plugin::Test::Plugin do
|
4
|
+
let(:plugin) { ::Speedflow::Plugin::Test::Plugin.new(double, double) }
|
5
|
+
|
6
|
+
it '.method_missing' do
|
7
|
+
allow(plugin.prompt).to receive(:warn).with(' - Pong: foo')
|
8
|
+
allow(plugin.config).to receive(:all_config)
|
9
|
+
allow(plugin.prompt).to receive(:warn)
|
10
|
+
allow(plugin.config).to receive(:all_input)
|
11
|
+
allow(plugin.prompt).to receive(:warn)
|
12
|
+
|
13
|
+
plugin.foo(bar: 'baz')
|
14
|
+
|
15
|
+
expect { plugin.action_no_method(bar: 'baz') }
|
16
|
+
.to raise_error(NoMethodError)
|
17
|
+
end
|
18
|
+
end
|
@@ -4,13 +4,4 @@ describe Speedflow::Plugin::Test do
|
|
4
4
|
it 'has a version number' do
|
5
5
|
expect(Speedflow::Plugin::Test::VERSION).not_to be nil
|
6
6
|
end
|
7
|
-
|
8
|
-
it '.method_missing' do
|
9
|
-
expect { Speedflow::Plugin::Test.foo(bar: 'baz') }
|
10
|
-
.to output("Load: foo with args: {:bar=>\"baz\"}\n").to_stdout
|
11
|
-
expect(Speedflow::Plugin::Test.foo(bar: 'baz'))
|
12
|
-
.to include(bar: 'baz')
|
13
|
-
expect { Speedflow::Plugin::Test.action_no_method(bar: 'baz') }
|
14
|
-
.to raise_error(NoMethodError)
|
15
|
-
end
|
16
7
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: speedflow-plugin-test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julien Breux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -149,8 +149,10 @@ files:
|
|
149
149
|
- bin/setup
|
150
150
|
- lib/speedflow-plugin-test.rb
|
151
151
|
- lib/speedflow/plugin/test.rb
|
152
|
+
- lib/speedflow/plugin/test/plugin.rb
|
152
153
|
- lib/speedflow/plugin/test/version.rb
|
153
154
|
- spec/spec_helper.rb
|
155
|
+
- spec/speedflow/plugin/test/plugin_spec.rb
|
154
156
|
- spec/speedflow/plugin/test_spec.rb
|
155
157
|
homepage: https://github.com/speedflow/speedflow-plugin-test
|
156
158
|
licenses:
|