test_console 0.0.1 → 0.0.2
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.
- data/bin/test_console +1 -1
- data/config/application.rb +0 -5
- data/config/environments/development.rb +2 -2
- data/config/environments/production.rb +4 -4
- data/config/environments/test.rb +1 -1
- data/config/initializers/wrap_parameters.rb +1 -1
- data/lib/action_view/resolver.rb +8 -0
- data/lib/test_console/colors.rb +27 -0
- data/lib/test_console/help.rb +31 -0
- data/lib/test_console/output.rb +5 -3
- data/lib/test_console/runner.rb +2 -0
- data/lib/test_console/utility.rb +0 -6
- data/lib/test_console/version.rb +1 -1
- data/lib/test_console.rb +6 -59
- data/test/dummy/config/application.rb +0 -5
- data/test/dummy/config/environments/development.rb +2 -2
- data/test/dummy/config/environments/production.rb +4 -4
- data/test/dummy/config/environments/test.rb +1 -1
- data/test/dummy/config/initializers/wrap_parameters.rb +1 -1
- metadata +12 -25
- data/lib/tasks/test_console_tasks.rake +0 -4
data/bin/test_console
CHANGED
@@ -22,7 +22,7 @@ command = nil
|
|
22
22
|
|
23
23
|
TestConsole::History.read
|
24
24
|
|
25
|
-
TestConsole.out "#{TestConsole
|
25
|
+
TestConsole.out "#{TestConsole.color 'Test Console', :bold}: run <filename> runs the specified test; ? for more commands"
|
26
26
|
|
27
27
|
while line = Readline.readline('> ', false)
|
28
28
|
trap("SIGINT") {TestConsole.abort}
|
data/config/application.rb
CHANGED
@@ -40,11 +40,6 @@ module Dummy
|
|
40
40
|
# Configure sensitive parameters which will be filtered from the log file.
|
41
41
|
config.filter_parameters += [:password]
|
42
42
|
|
43
|
-
# Enable the asset pipeline
|
44
|
-
config.assets.enabled = true
|
45
|
-
|
46
|
-
# Version of your assets, change this if you want to expire all your assets
|
47
|
-
config.assets.version = '1.0'
|
48
43
|
end
|
49
44
|
end
|
50
45
|
|
@@ -23,8 +23,8 @@ Dummy::Application.configure do
|
|
23
23
|
config.action_dispatch.best_standards_support = :builtin
|
24
24
|
|
25
25
|
# Do not compress assets
|
26
|
-
config.assets.compress = false
|
26
|
+
#config.assets.compress = false
|
27
27
|
|
28
28
|
# Expands the lines which load the assets
|
29
|
-
config.assets.debug = true
|
29
|
+
#config.assets.debug = true
|
30
30
|
end
|
@@ -9,16 +9,16 @@ Dummy::Application.configure do
|
|
9
9
|
config.action_controller.perform_caching = true
|
10
10
|
|
11
11
|
# Disable Rails's static asset server (Apache or nginx will already do this)
|
12
|
-
config.serve_static_assets = false
|
12
|
+
#config.serve_static_assets = false
|
13
13
|
|
14
14
|
# Compress JavaScripts and CSS
|
15
|
-
config.assets.compress = true
|
15
|
+
#config.assets.compress = true
|
16
16
|
|
17
17
|
# Don't fallback to assets pipeline if a precompiled asset is missed
|
18
|
-
config.assets.compile = false
|
18
|
+
#config.assets.compile = false
|
19
19
|
|
20
20
|
# Generate digests for assets URLs
|
21
|
-
config.assets.digest = true
|
21
|
+
#config.assets.digest = true
|
22
22
|
|
23
23
|
# Defaults to Rails.root.join("public/assets")
|
24
24
|
# config.assets.manifest = YOUR_PATH
|
data/config/environments/test.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
7
|
ActiveSupport.on_load(:action_controller) do
|
8
|
-
wrap_parameters :format => [:json]
|
8
|
+
#wrap_parameters :format => [:json]
|
9
9
|
end
|
10
10
|
|
11
11
|
# Disable root element in JSON by default.
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module TestConsole
|
2
|
+
module Colors
|
3
|
+
|
4
|
+
# Standard terminal color codes
|
5
|
+
COLORS = {
|
6
|
+
:reset => '0',
|
7
|
+
:bold => '1',
|
8
|
+
:red => '31',
|
9
|
+
:green => '32',
|
10
|
+
:yellow => '33',
|
11
|
+
:blue => '34',
|
12
|
+
:magenta => '35',
|
13
|
+
:cyan => '36',
|
14
|
+
:white => '37'
|
15
|
+
}
|
16
|
+
|
17
|
+
ERROR_COLOR = :magenta
|
18
|
+
FAIL_COLOR = :red
|
19
|
+
SUCCESS_COLOR = :green
|
20
|
+
|
21
|
+
def color(text, color)
|
22
|
+
if COLORS[color]
|
23
|
+
"\e[#{COLORS[color]}m#{text}\e[#{COLORS[:reset]}m"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module TestConsole
|
2
|
+
module Help
|
3
|
+
# Help text
|
4
|
+
# =========
|
5
|
+
|
6
|
+
def help
|
7
|
+
"
|
8
|
+
Test console help
|
9
|
+
=================
|
10
|
+
Run Commands : #{RUN_COMMANDS.join(', ')}
|
11
|
+
|
12
|
+
To run a test, type 'run' followed by the path to the test
|
13
|
+
You can also append a string or regex to filter by
|
14
|
+
|
15
|
+
Examples:
|
16
|
+
run functional/mgm
|
17
|
+
run functional/application_controller_test.rb
|
18
|
+
run functional/application_controller_test.rb 'PartOfTestName'
|
19
|
+
run functional/application_controller_test.rb /PartOfTestName/i
|
20
|
+
|
21
|
+
Rerun Commands : #{RERUN_COMMANDS.join(', ')}
|
22
|
+
|
23
|
+
Reruns only the tests that failed or errored in the previous run
|
24
|
+
|
25
|
+
Quit Commands : #{QUIT_COMMANDS.join(', ')}
|
26
|
+
|
27
|
+
Exits the console
|
28
|
+
"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/test_console/output.rb
CHANGED
@@ -1,20 +1,22 @@
|
|
1
1
|
module TestConsole
|
2
2
|
module Output
|
3
|
+
include TestConsole::Colors
|
4
|
+
|
3
5
|
# Output functions
|
4
6
|
# =================
|
5
7
|
# Functions to format and display output
|
6
8
|
|
7
9
|
def out(text, text_color=nil)
|
8
10
|
if text_color
|
9
|
-
STDOUT.puts
|
11
|
+
STDOUT.puts color(text, text_color)
|
10
12
|
else
|
11
13
|
STDOUT.puts text
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
15
17
|
def error(message, backtrace=nil)
|
16
|
-
STDERR.puts
|
17
|
-
backtrace.each {|line| STDERR.puts
|
18
|
+
STDERR.puts color(message, ERROR_COLOR)
|
19
|
+
backtrace.each {|line| STDERR.puts color(line, ERROR_COLOR)} unless backtrace.nil? || backtrace.empty?
|
18
20
|
end
|
19
21
|
|
20
22
|
def print_negatives(items, color)
|
data/lib/test_console/runner.rb
CHANGED
data/lib/test_console/utility.rb
CHANGED
@@ -21,12 +21,6 @@ module TestConsole
|
|
21
21
|
return ret
|
22
22
|
end
|
23
23
|
|
24
|
-
def color(text, color)
|
25
|
-
if COLORS[color]
|
26
|
-
"\e[#{COLORS[color]}m#{text}\e[#{COLORS[:reset]}m"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
24
|
def const_defined?(klass)
|
31
25
|
klass = [klass] unless klass.kind_of? Array
|
32
26
|
klass.inject(Object) do |context, scope|
|
data/lib/test_console/version.rb
CHANGED
data/lib/test_console.rb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
require 'test_console/history'
|
2
|
+
require 'test_console/utility'
|
2
3
|
|
3
4
|
require 'test_console/builder'
|
5
|
+
require 'test_console/colors'
|
6
|
+
require 'test_console/help'
|
4
7
|
require 'test_console/monitor'
|
5
8
|
require 'test_console/output'
|
6
9
|
require 'test_console/runner'
|
7
10
|
|
8
|
-
require '
|
11
|
+
require 'action_view/resolver'
|
9
12
|
|
10
13
|
module TestConsole
|
11
14
|
|
@@ -22,24 +25,10 @@ module TestConsole
|
|
22
25
|
|
23
26
|
DUMMY_FOLDER = 'dummy/test'
|
24
27
|
|
25
|
-
COLORS = {
|
26
|
-
:reset => '0',
|
27
|
-
:bold => '1',
|
28
|
-
:red => '31',
|
29
|
-
:green => '32',
|
30
|
-
:yellow => '33',
|
31
|
-
:blue => '34',
|
32
|
-
:magenta => '35',
|
33
|
-
:cyan => '36',
|
34
|
-
:white => '37'
|
35
|
-
}
|
36
|
-
|
37
|
-
ERROR_COLOR = :magenta
|
38
|
-
FAIL_COLOR = :red
|
39
|
-
SUCCESS_COLOR = :green
|
40
|
-
|
41
28
|
class << self
|
42
29
|
include TestConsole::Builder
|
30
|
+
include TestConsole::Colors
|
31
|
+
include TestConsole::Help
|
43
32
|
include TestConsole::Monitor
|
44
33
|
include TestConsole::Output
|
45
34
|
include TestConsole::Runner
|
@@ -78,47 +67,5 @@ module TestConsole
|
|
78
67
|
end
|
79
68
|
end
|
80
69
|
|
81
|
-
# Utility functions
|
82
|
-
# =================
|
83
|
-
# Additional functions to help with general tasks
|
84
|
-
|
85
|
-
# Help text
|
86
|
-
# =========
|
87
|
-
|
88
|
-
def help
|
89
|
-
"
|
90
|
-
Test console help
|
91
|
-
=================
|
92
|
-
Run Commands : #{RUN_COMMANDS.join(', ')}
|
93
|
-
|
94
|
-
To run a test, type 'run' followed by the path to the test
|
95
|
-
You can also append a string or regex to filter by
|
96
|
-
|
97
|
-
Examples:
|
98
|
-
run functional/mgm
|
99
|
-
run functional/application_controller_test.rb
|
100
|
-
run functional/application_controller_test.rb 'PartOfTestName'
|
101
|
-
run functional/application_controller_test.rb /PartOfTestName/i
|
102
|
-
|
103
|
-
Rerun Commands : #{RERUN_COMMANDS.join(', ')}
|
104
|
-
|
105
|
-
Reruns only the tests that failed or errored in the previous run
|
106
|
-
|
107
|
-
Quit Commands : #{QUIT_COMMANDS.join(', ')}
|
108
|
-
|
109
|
-
Exits the console
|
110
|
-
"
|
111
|
-
end
|
112
|
-
|
113
70
|
end
|
114
71
|
end
|
115
|
-
|
116
|
-
# This sets ActionView to use our custom test when checking whether to cache view templates
|
117
|
-
module ActionView
|
118
|
-
class Resolver
|
119
|
-
def caching?
|
120
|
-
@caching = TestConsole.views_changed?
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
@@ -40,11 +40,6 @@ module Dummy
|
|
40
40
|
# Configure sensitive parameters which will be filtered from the log file.
|
41
41
|
config.filter_parameters += [:password]
|
42
42
|
|
43
|
-
# Enable the asset pipeline
|
44
|
-
config.assets.enabled = true
|
45
|
-
|
46
|
-
# Version of your assets, change this if you want to expire all your assets
|
47
|
-
config.assets.version = '1.0'
|
48
43
|
end
|
49
44
|
end
|
50
45
|
|
@@ -23,8 +23,8 @@ Dummy::Application.configure do
|
|
23
23
|
config.action_dispatch.best_standards_support = :builtin
|
24
24
|
|
25
25
|
# Do not compress assets
|
26
|
-
config.assets.compress = false
|
26
|
+
#config.assets.compress = false
|
27
27
|
|
28
28
|
# Expands the lines which load the assets
|
29
|
-
config.assets.debug = true
|
29
|
+
#config.assets.debug = true
|
30
30
|
end
|
@@ -9,16 +9,16 @@ Dummy::Application.configure do
|
|
9
9
|
config.action_controller.perform_caching = true
|
10
10
|
|
11
11
|
# Disable Rails's static asset server (Apache or nginx will already do this)
|
12
|
-
config.serve_static_assets = false
|
12
|
+
#config.serve_static_assets = false
|
13
13
|
|
14
14
|
# Compress JavaScripts and CSS
|
15
|
-
config.assets.compress = true
|
15
|
+
#config.assets.compress = true
|
16
16
|
|
17
17
|
# Don't fallback to assets pipeline if a precompiled asset is missed
|
18
|
-
config.assets.compile = false
|
18
|
+
#config.assets.compile = false
|
19
19
|
|
20
20
|
# Generate digests for assets URLs
|
21
|
-
config.assets.digest = true
|
21
|
+
#config.assets.digest = true
|
22
22
|
|
23
23
|
# Defaults to Rails.root.join("public/assets")
|
24
24
|
# config.assets.manifest = YOUR_PATH
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
7
|
ActiveSupport.on_load(:action_controller) do
|
8
|
-
wrap_parameters :format => [:json]
|
8
|
+
#wrap_parameters :format => [:json]
|
9
9
|
end
|
10
10
|
|
11
11
|
# Disable root element in JSON by default.
|
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: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Adam Phillips
|
@@ -15,21 +15,20 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-07-
|
18
|
+
date: 2012-07-12 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
23
23
|
none: false
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
hash:
|
27
|
+
hash: 7
|
28
28
|
segments:
|
29
29
|
- 3
|
30
|
-
- 1
|
31
30
|
- 0
|
32
|
-
version: 3.
|
31
|
+
version: "3.0"
|
33
32
|
requirement: *id001
|
34
33
|
name: rails
|
35
34
|
type: :runtime
|
@@ -45,7 +44,7 @@ dependencies:
|
|
45
44
|
- 0
|
46
45
|
version: "0"
|
47
46
|
requirement: *id002
|
48
|
-
name:
|
47
|
+
name: mocha
|
49
48
|
type: :development
|
50
49
|
- !ruby/object:Gem::Dependency
|
51
50
|
prerelease: false
|
@@ -59,7 +58,7 @@ dependencies:
|
|
59
58
|
- 0
|
60
59
|
version: "0"
|
61
60
|
requirement: *id003
|
62
|
-
name:
|
61
|
+
name: shoulda
|
63
62
|
type: :development
|
64
63
|
- !ruby/object:Gem::Dependency
|
65
64
|
prerelease: false
|
@@ -73,20 +72,6 @@ dependencies:
|
|
73
72
|
- 0
|
74
73
|
version: "0"
|
75
74
|
requirement: *id004
|
76
|
-
name: shoulda
|
77
|
-
type: :development
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
prerelease: false
|
80
|
-
version_requirements: &id005 !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ">="
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
hash: 3
|
86
|
-
segments:
|
87
|
-
- 0
|
88
|
-
version: "0"
|
89
|
-
requirement: *id005
|
90
75
|
name: sqlite3
|
91
76
|
type: :development
|
92
77
|
description: Console for testing Rails applications with TestUnit.
|
@@ -114,8 +99,10 @@ files:
|
|
114
99
|
- config/initializers/wrap_parameters.rb
|
115
100
|
- config/locales/en.yml
|
116
101
|
- config/routes.rb
|
117
|
-
- lib/
|
102
|
+
- lib/action_view/resolver.rb
|
118
103
|
- lib/test_console/builder.rb
|
104
|
+
- lib/test_console/colors.rb
|
105
|
+
- lib/test_console/help.rb
|
119
106
|
- lib/test_console/history.rb
|
120
107
|
- lib/test_console/monitor.rb
|
121
108
|
- lib/test_console/output.rb
|