test_console 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/test_console +4 -4
- data/lib/test_console.rb +3 -42
- data/lib/test_console/builder.rb +5 -1
- data/lib/test_console/cli_parser.rb +40 -0
- data/lib/test_console/colors.rb +0 -6
- data/lib/test_console/config.rb +74 -0
- data/lib/test_console/help.rb +8 -7
- data/lib/test_console/monitor.rb +5 -5
- data/lib/test_console/output.rb +6 -5
- data/lib/test_console/runner.rb +8 -7
- data/lib/test_console/version.rb +1 -1
- data/test/dummy/log/test.log +1033 -0
- data/test/dummy/test/a_sample_test.rb +3 -0
- data/test/test_console/cli_parser_test.rb +36 -0
- data/test/test_console/config_test.rb +37 -0
- data/test/test_console/runner_test.rb +11 -0
- metadata +11 -3
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TestConsole::CliParserTest < ActiveSupport::TestCase
|
4
|
+
describe_class TestConsole::CliParser do
|
5
|
+
describe_method '#command' do
|
6
|
+
context 'when passed a string' do
|
7
|
+
should 'take the first segment of the string and return it' do
|
8
|
+
assert_equal 'something', TestConsole::CliParser.command('something')
|
9
|
+
assert_equal 'something', TestConsole::CliParser.command('something else')
|
10
|
+
assert_equal 'something', TestConsole::CliParser.command('something else /with_ex/')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe_method '#file' do
|
16
|
+
context 'when passed a string' do
|
17
|
+
should 'take the second segment of the string and return it' do
|
18
|
+
assert_equal nil, TestConsole::CliParser.file('something')
|
19
|
+
assert_equal 'else', TestConsole::CliParser.file('something else')
|
20
|
+
assert_equal 'else', TestConsole::CliParser.file('something else /with_ex/')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe_method '#filter' do
|
26
|
+
context 'when passed a string' do
|
27
|
+
should 'take the third segment of the string and return it as a regex' do
|
28
|
+
assert_equal nil, TestConsole::CliParser.filter('something')
|
29
|
+
assert_equal nil, TestConsole::CliParser.filter('something else')
|
30
|
+
assert_equal /with ex/, TestConsole::CliParser.filter('something else with ex')
|
31
|
+
assert_equal /with_ex/, TestConsole::CliParser.filter('something else /with_ex/')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TestConsole::ConfigTest < ActiveSupport::TestCase
|
4
|
+
describe_class TestConsole do
|
5
|
+
describe_method '#commands' do
|
6
|
+
context 'when passed a command type that exists' do
|
7
|
+
setup do
|
8
|
+
assert_not_nil TestConsole::Config.run_commands
|
9
|
+
end
|
10
|
+
should 'return the configured commands of that type' do
|
11
|
+
assert_equal TestConsole.commands(:run), TestConsole::Config.run_commands
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe_method '#setup' do
|
17
|
+
context 'when passed a block' do
|
18
|
+
context 'setting config variables' do
|
19
|
+
setup do
|
20
|
+
@old_run_commands = TestConsole::Config.run_commands
|
21
|
+
TestConsole.setup do |config|
|
22
|
+
config.run_commands = ['arretez']
|
23
|
+
end
|
24
|
+
end
|
25
|
+
teardown do
|
26
|
+
TestConsole.setup do |config|
|
27
|
+
config.run_commands = @old_run_commands
|
28
|
+
end
|
29
|
+
end
|
30
|
+
should 'update the config variables' do
|
31
|
+
assert_equal ['arretez'], TestConsole::Config.run_commands
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_console
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Adam Phillips
|
@@ -129,7 +129,9 @@ files:
|
|
129
129
|
- config/routes.rb
|
130
130
|
- lib/action_view/resolver.rb
|
131
131
|
- lib/test_console/builder.rb
|
132
|
+
- lib/test_console/cli_parser.rb
|
132
133
|
- lib/test_console/colors.rb
|
134
|
+
- lib/test_console/config.rb
|
133
135
|
- lib/test_console/help.rb
|
134
136
|
- lib/test_console/history.rb
|
135
137
|
- lib/test_console/monitor.rb
|
@@ -174,6 +176,9 @@ files:
|
|
174
176
|
- test/dummy/test/test_helper.rb
|
175
177
|
- test/support/helpers/shared_helpers.rb
|
176
178
|
- test/support/helpers/unit_helpers.rb
|
179
|
+
- test/test_console/cli_parser_test.rb
|
180
|
+
- test/test_console/config_test.rb
|
181
|
+
- test/test_console/runner_test.rb
|
177
182
|
- test/test_console/utility_test.rb
|
178
183
|
- test/test_console_test.rb
|
179
184
|
- test/test_helper.rb
|
@@ -245,6 +250,9 @@ test_files:
|
|
245
250
|
- test/dummy/test/test_helper.rb
|
246
251
|
- test/support/helpers/shared_helpers.rb
|
247
252
|
- test/support/helpers/unit_helpers.rb
|
253
|
+
- test/test_console/cli_parser_test.rb
|
254
|
+
- test/test_console/config_test.rb
|
255
|
+
- test/test_console/runner_test.rb
|
248
256
|
- test/test_console/utility_test.rb
|
249
257
|
- test/test_console_test.rb
|
250
258
|
- test/test_helper.rb
|