testme 0.4.85 → 0.5.3
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/.gitignore +1 -0
- data/.testme +6 -4
- data/README.md +39 -17
- data/bin/testme +51 -49
- data/lib/logic.rb +1 -9
- data/lib/testme.rb +41 -15
- data/spec/spec_helper.rb +5 -1
- data/testme.gemspec +1 -0
- metadata +20 -4
data/.gitignore
CHANGED
data/.testme
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require "testme"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
boot :test, '/test' do
|
4
|
+
testme.dir = '/test/'
|
5
|
+
testme.suffix = '.test.rb'
|
6
|
+
testme.format = :console
|
7
|
+
testme.colors = :default
|
8
|
+
end
|
data/README.md
CHANGED
@@ -45,19 +45,23 @@
|
|
45
45
|
|
46
46
|
`testme setup`
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
## Config
|
49
|
+
|
50
|
+
In your project root will be a `.testme` file, this is your bootstrap that runs before your tests
|
51
|
+
|
52
|
+
The `/test/` folder will house all your test files, you can change this in your bootstrap
|
53
|
+
|
54
|
+
## Bootstrap
|
51
55
|
|
52
56
|
*Default .testme boiler plate on setup*
|
53
57
|
*this might need to be reconfigured to cater to your project*
|
54
58
|
|
55
59
|
require "testme"
|
56
60
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
+
testme.dir = '/test/'
|
62
|
+
testme.suffix = '.test.rb'
|
63
|
+
testme.format = :console
|
64
|
+
testme.colors = :default
|
61
65
|
|
62
66
|
#### Example config with bundler
|
63
67
|
|
@@ -66,28 +70,42 @@
|
|
66
70
|
require "bundler/setup"
|
67
71
|
Bundler.require :default, :test
|
68
72
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
+
testme.dir = '/test/'
|
74
|
+
testme.suffix = '.test.rb'
|
75
|
+
testme.format = :console
|
76
|
+
testme.colors = :default
|
73
77
|
|
74
|
-
|
78
|
+
#### Named bootstraps are also possible
|
75
79
|
|
76
|
-
|
80
|
+
require "testme"
|
77
81
|
|
78
|
-
|
82
|
+
boot :test, '/test' do
|
83
|
+
testme.dir = '/test/'
|
84
|
+
testme.suffix = '.test.rb'
|
85
|
+
testme.format = :console
|
86
|
+
testme.colors = :default
|
87
|
+
end
|
88
|
+
|
89
|
+
boot :quiet, '/test' do
|
90
|
+
testme.dir = '/test/'
|
91
|
+
testme.suffix = '.test.rb'
|
92
|
+
testme.format = :none
|
93
|
+
end
|
79
94
|
|
80
95
|
### Config options
|
81
96
|
|
82
|
-
|
97
|
+
`testme.dir`
|
83
98
|
* default: '/test/'
|
84
99
|
|
85
|
-
|
100
|
+
`testme.suffix`
|
101
|
+
* default: '.test.rb'
|
102
|
+
|
103
|
+
`testme.format`
|
86
104
|
* choose how results are displayed
|
87
105
|
* options: :none, :text, :console
|
88
106
|
* default: :console
|
89
107
|
|
90
|
-
|
108
|
+
`testme.colors`
|
91
109
|
* color scheme for console output
|
92
110
|
* options: :default
|
93
111
|
* default: :default
|
@@ -101,6 +119,10 @@ default test folder: `/test/**/*`
|
|
101
119
|
|
102
120
|
$ testme
|
103
121
|
|
122
|
+
#### Test with named bootstrap
|
123
|
+
|
124
|
+
$ testme :test
|
125
|
+
|
104
126
|
#### Test all in directory
|
105
127
|
|
106
128
|
$ testme test/features
|
data/bin/testme
CHANGED
@@ -1,72 +1,74 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
3
|
+
@testme_boot = {}
|
4
|
+
def boot name, folder, &block
|
5
|
+
@testme_boot[name.to_sym] = [folder, block]
|
6
|
+
end
|
4
7
|
|
5
|
-
|
8
|
+
def testme_load filepath
|
9
|
+
if @file.include?(TestMe::testme.suffix)
|
10
|
+
testme do
|
11
|
+
load filepath
|
12
|
+
end
|
13
|
+
else
|
14
|
+
load filepath
|
15
|
+
end
|
16
|
+
end
|
6
17
|
|
18
|
+
def testme_setup
|
19
|
+
puts 'Creating bootstrap "/.testme"'
|
7
20
|
File.open("./.testme", "w") {|f| f.write(
|
8
21
|
%q[require "testme"
|
9
22
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
23
|
+
testme.dir = '/test/'
|
24
|
+
testme.suffix = '.test.rb'
|
25
|
+
testme.format = :console
|
26
|
+
testme.colors = :default
|
27
|
+
]
|
14
28
|
)} unless File.exists?("./.testme")
|
15
|
-
|
16
29
|
puts 'Creating test folder "/test"'
|
17
|
-
|
18
30
|
Dir::mkdir('./test/') unless File.directory?("./test/") || File.exists?("./test/")
|
19
|
-
|
20
31
|
puts 'Creating empty test file "/app.test.rb"'
|
32
|
+
File.open('./test/app.test.rb', 'w') {|f| f.write("")} unless File.exists?("./.test/app.test.rb")
|
33
|
+
puts 'Setup complete'
|
34
|
+
end
|
21
35
|
|
22
|
-
|
23
|
-
|
24
|
-
|
36
|
+
if ARGV[0] == 'setup'
|
37
|
+
testme_setup
|
38
|
+
exit
|
39
|
+
end
|
25
40
|
|
26
|
-
|
41
|
+
TESTME_INIT = true
|
27
42
|
|
43
|
+
if File.exists?("#{Dir.pwd}/.testme")
|
44
|
+
load "#{Dir.pwd}/.testme"
|
28
45
|
else
|
46
|
+
require "testme"
|
47
|
+
end
|
29
48
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
require "testme"
|
49
|
+
TESTME_RUNNING = true
|
50
|
+
|
51
|
+
if ARGV.empty?
|
52
|
+
testme do
|
53
|
+
Dir["#{Dir.pwd}/#{testme.DIR}/**/*#{testme.suffix}"].each{|f| load f }
|
36
54
|
end
|
55
|
+
elsif ARGV[0][0] == ':'
|
56
|
+
o = @testme_boot[ARGV[0][1..-1].to_sym][1]
|
57
|
+
o.call
|
37
58
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
else
|
46
|
-
ARGV.each do |arg|
|
47
|
-
@file = "#{Dir.pwd}/#{arg}"
|
59
|
+
Dir["#{o[0]}/**/*#{testme.suffix}"].each do |f|
|
60
|
+
testme_load(f)
|
61
|
+
end
|
62
|
+
else
|
63
|
+
ARGV.each do |arg|
|
64
|
+
@file = "#{Dir.pwd}/#{arg}"
|
48
65
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
if @file.include? TestMe::TESTME_SUFFIX
|
53
|
-
testme do
|
54
|
-
load @file
|
55
|
-
end
|
56
|
-
else
|
57
|
-
load @file
|
58
|
-
end
|
59
|
-
elsif File.exists? @file
|
60
|
-
if @file.include? TestMe::TESTME_SUFFIX
|
61
|
-
testme do
|
62
|
-
load @file
|
63
|
-
end
|
64
|
-
else
|
65
|
-
load @file
|
66
|
-
end
|
66
|
+
if File.directory?(@file)
|
67
|
+
Dir["#{@file}/**/*#{testme.suffix}"].each do |f|
|
68
|
+
testme_load(@file)
|
67
69
|
end
|
70
|
+
elsif File.exists?(@file)
|
71
|
+
testme_load(@file)
|
68
72
|
end
|
69
|
-
|
70
73
|
end
|
71
|
-
|
72
74
|
end
|
data/lib/logic.rb
CHANGED
@@ -1,12 +1,4 @@
|
|
1
|
-
def testme &block
|
2
|
-
if defined? TESTME_RUNNING
|
3
|
-
extend TestMe
|
4
|
-
block.call
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
1
|
module TestMe
|
9
|
-
|
10
2
|
def topic
|
11
3
|
@topic
|
12
4
|
end
|
@@ -16,7 +8,7 @@ module TestMe
|
|
16
8
|
@before = nil
|
17
9
|
@contexts = {}
|
18
10
|
|
19
|
-
@@formatter ||= Formatter::create(
|
11
|
+
@@formatter ||= Formatter::create(testme.format)
|
20
12
|
@@formatter.test topic
|
21
13
|
|
22
14
|
@topic_class = topic
|
data/lib/testme.rb
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
#********************************************************************#
|
6
6
|
|
7
7
|
module TestMe
|
8
|
+
# Dummy interface for inline tests - you don't want tests to run at application runtime!
|
8
9
|
|
9
10
|
# ---------------------------------------------------------------- #
|
10
11
|
# Alleviate the 'the big ball of mud'
|
@@ -43,32 +44,57 @@ module TestMe
|
|
43
44
|
def is? *args, █ end
|
44
45
|
# ---------------------------------------------------------------- #
|
45
46
|
|
47
|
+
# Create a base context
|
48
|
+
# Re-runs every time 'given' is called
|
49
|
+
# ` before do <block> end `
|
50
|
+
def before █ end
|
51
|
+
# ---------------------------------------------------------------- #
|
52
|
+
|
53
|
+
# ---------------------------------------------------------------- #
|
54
|
+
# Config Module
|
55
|
+
# ---------------------------------------------------------------- #
|
56
|
+
require "configatron"
|
57
|
+
@config = Configatron::Store.new
|
58
|
+
|
59
|
+
# Defaults
|
60
|
+
@config.dir = '/test/'
|
61
|
+
@config.suffix = '.test.rb'
|
62
|
+
@config.format = :console
|
63
|
+
@config.colors = :default
|
64
|
+
|
65
|
+
def self.config; @config; end
|
46
66
|
end
|
47
67
|
|
48
68
|
# ---------------------------------------------------------------- #
|
49
|
-
# Inline Testing
|
69
|
+
# Test Runner : Inline Testing
|
50
70
|
# ---------------------------------------------------------------- #
|
51
|
-
def testme &block
|
71
|
+
def testme &block
|
72
|
+
if block && defined? TESTME_RUNNING && block
|
73
|
+
extend TestMe
|
74
|
+
block.call
|
75
|
+
end
|
76
|
+
|
77
|
+
return TestMe::config
|
78
|
+
end
|
52
79
|
|
53
80
|
# ---------------------------------------------------------------- #
|
54
81
|
# Optional configuration
|
55
82
|
# ---------------------------------------------------------------- #
|
56
|
-
|
57
|
-
|
58
|
-
# default: '/test/'
|
83
|
+
#testme.dir
|
84
|
+
# default: '/test/'
|
59
85
|
|
60
|
-
|
86
|
+
#testme.suffix
|
87
|
+
# default: '.test.rb'
|
61
88
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
89
|
+
#testme.format
|
90
|
+
# choose how results are displayed
|
91
|
+
# options: :none, :text, :console
|
92
|
+
# default: :console
|
66
93
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
end
|
94
|
+
#testme.colors
|
95
|
+
# color scheme for console output
|
96
|
+
# options: :default
|
97
|
+
# default: :default
|
72
98
|
|
73
99
|
# ---------------------------------------------------------------- #
|
74
100
|
|
data/spec/spec_helper.rb
CHANGED
data/testme.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rainbow
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: 0.5.8
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: configatron
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 2.9.1
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.9.1
|
46
62
|
description: ! ' Minimalistic testing framework
|
47
63
|
|
48
64
|
'
|
@@ -85,7 +101,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
85
101
|
version: '0'
|
86
102
|
segments:
|
87
103
|
- 0
|
88
|
-
hash:
|
104
|
+
hash: 734885775
|
89
105
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
106
|
none: false
|
91
107
|
requirements:
|
@@ -94,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
110
|
version: '0'
|
95
111
|
segments:
|
96
112
|
- 0
|
97
|
-
hash:
|
113
|
+
hash: 734885775
|
98
114
|
requirements: []
|
99
115
|
rubyforge_project:
|
100
116
|
rubygems_version: 1.8.24
|