matest 1.3.2 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +7 -1
- data/lib/matest.rb +1 -0
- data/lib/matest/color.rb +13 -0
- data/lib/matest/spec_printer.rb +2 -15
- data/lib/matest/version.rb +1 -1
- data/spec/matest_spec.rb +128 -128
- data/spec/matest_specs/slow_spec.rb +9 -0
- data/spec/spec_helper.rb +3 -3
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74fc41b6ca3f18bac9a2414bd7b6084b4061b05a
|
4
|
+
data.tar.gz: 95492497f03ee0b221644c7f615ad72ebe14db25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 219eab6da19166f386ee78efbd8ea50bb11f63263db871fd54f8f68f126bf77ea57896837a4e9ea15a95a2c6261591fec149426ddd19fd13f787ce6aff8a1935
|
7
|
+
data.tar.gz: 19178193c386f74cd6c550b71a7564260ebef1662314937c6ae6d7ac17a49d3febb3f2420885d6eabfc6fdc66503e341a1f2aff31fb2ccdd6f50b3359431ff13
|
data/Rakefile
CHANGED
@@ -3,7 +3,13 @@ require "bundler/gem_tasks"
|
|
3
3
|
task default: :matest
|
4
4
|
|
5
5
|
task :spec do
|
6
|
-
arg_files = ENV["FILES"] && ENV["FILES"].split(/[\s,]+/)
|
6
|
+
arg_files = (ENV["FILES"] && ENV["FILES"].split(/[\s,]+/)) || [ENV["SPEC"]]
|
7
|
+
if arg_files
|
8
|
+
arg_files.map! { |file_name|
|
9
|
+
Pathname(file_name).directory? ? file_name + "/**/*.rb" : file_name
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
7
13
|
all_files = Rake::FileList["./spec/matest_specs/**/*_spec.rb"]
|
8
14
|
files = arg_files || all_files
|
9
15
|
puts "\nRuning tests for: #{ files.join(" ") }\n\n"
|
data/lib/matest.rb
CHANGED
data/lib/matest/color.rb
ADDED
data/lib/matest/spec_printer.rb
CHANGED
@@ -1,17 +1,4 @@
|
|
1
1
|
require "matest/evaluator"
|
2
|
-
require 'term/ansicolor'
|
3
|
-
|
4
|
-
module Matest
|
5
|
-
module Color
|
6
|
-
module_function
|
7
|
-
|
8
|
-
Term::ANSIColor.attributes.each do |attr|
|
9
|
-
define_method(attr) do |str|
|
10
|
-
Matest::Configure.color? ? Term::ANSIColor.send(attr, str) : str
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
2
|
|
16
3
|
module Matest
|
17
4
|
class SpecPrinter
|
@@ -112,7 +99,7 @@ module Matest
|
|
112
99
|
private
|
113
100
|
|
114
101
|
def header(str)
|
115
|
-
|
102
|
+
str + ":"
|
116
103
|
end
|
117
104
|
|
118
105
|
def colors
|
@@ -121,7 +108,7 @@ module Matest
|
|
121
108
|
Matest::SpecFailed => :red,
|
122
109
|
Matest::SpecSkipped => :yellow,
|
123
110
|
Matest::NotANaturalAssertion => :cyan,
|
124
|
-
Matest::ExceptionRaised => :
|
111
|
+
Matest::ExceptionRaised => :magenta,
|
125
112
|
}
|
126
113
|
end
|
127
114
|
end
|
data/lib/matest/version.rb
CHANGED
data/spec/matest_spec.rb
CHANGED
@@ -1,141 +1,141 @@
|
|
1
|
-
require "spec_helper"
|
1
|
+
# require "spec_helper"
|
2
2
|
|
3
|
-
def get_statuses(&block)
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
end
|
8
|
-
describe "scope" do
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
3
|
+
# def get_statuses(&block)
|
4
|
+
# group = block.call.first
|
5
|
+
# group.execute!
|
6
|
+
# group.statuses
|
7
|
+
# end
|
8
|
+
# describe "scope" do
|
9
|
+
# it "can pass" do
|
10
|
+
# statuses = get_statuses do
|
11
|
+
# scope do
|
12
|
+
# spec do
|
13
|
+
# true
|
14
|
+
# end
|
15
|
+
# end
|
16
|
+
# end
|
17
|
+
# statuses.first.must_be_kind_of(Matest::SpecPassed)
|
18
|
+
# end
|
19
|
+
# end
|
20
20
|
|
21
|
-
describe "spec" do
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
21
|
+
# describe "spec" do
|
22
|
+
# describe "passing" do
|
23
|
+
# it "passes" do
|
24
|
+
# scope do
|
25
|
+
# res = spec do
|
26
|
+
# true
|
27
|
+
# end
|
28
|
+
# res.must_be_kind_of(Matest::SpecPassed)
|
29
|
+
# end
|
30
|
+
# end
|
31
|
+
# it "forwards the block" do
|
32
|
+
# scope do
|
33
|
+
# res = spec do
|
34
|
+
# true
|
35
|
+
# end
|
36
|
+
# res.block.call.must_equal(true)
|
37
|
+
# end
|
38
|
+
# end
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
40
|
+
# it "allows a description and forwards it" do
|
41
|
+
# scope do
|
42
|
+
# res = spec "THE DESCRIPTION" do
|
43
|
+
# true
|
44
|
+
# end
|
45
|
+
# res.description.must_equal("THE DESCRIPTION")
|
46
|
+
# end
|
47
|
+
# end
|
48
|
+
# end
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
50
|
+
# describe "failing" do
|
51
|
+
# it "fails" do
|
52
|
+
# scope do
|
53
|
+
# res = spec do
|
54
|
+
# false
|
55
|
+
# end
|
56
|
+
# res.must_be_kind_of(Matest::SpecFailed)
|
57
|
+
# end
|
58
|
+
# end
|
59
59
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
60
|
+
# it "forwards the block" do
|
61
|
+
# scope do
|
62
|
+
# res = spec do
|
63
|
+
# false
|
64
|
+
# end
|
65
|
+
# res.block.call.must_equal(false)
|
66
|
+
# end
|
67
|
+
# end
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
69
|
+
# it "allows a description and forwards it" do
|
70
|
+
# scope do
|
71
|
+
# res = spec "THE DESCRIPTION" do
|
72
|
+
# false
|
73
|
+
# end
|
74
|
+
# res.description.must_equal("THE DESCRIPTION")
|
75
|
+
# end
|
76
|
+
# end
|
77
|
+
# end
|
78
78
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
79
|
+
# it "only allows natural assertions" do
|
80
|
+
# scope do
|
81
|
+
# res = spec do
|
82
|
+
# :not_true_nor_false
|
83
|
+
# end
|
84
|
+
# res.must_be_kind_of(Matest::NotANaturalAssertion)
|
85
|
+
# end
|
86
|
+
# end
|
87
87
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
88
|
+
# it "skips if no block is given" do
|
89
|
+
# scope do
|
90
|
+
# res = spec
|
91
|
+
# res.must_be_kind_of(Matest::SpecSkipped)
|
92
|
+
# end
|
93
|
+
# end
|
94
94
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
95
|
+
# it "allows raising an exception" do
|
96
|
+
# scope do
|
97
|
+
# res = spec do
|
98
|
+
# raise RuntimeError
|
99
|
+
# end
|
100
|
+
# res.must_be_kind_of(Matest::ExceptionRaised)
|
101
|
+
# end
|
102
|
+
# end
|
103
103
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
end
|
104
|
+
# it "exists only inside a scope" do
|
105
|
+
# -> {
|
106
|
+
# spec do
|
107
|
+
# true
|
108
|
+
# end
|
109
|
+
# }.must_raise(NoMethodError)
|
110
|
+
# end
|
111
|
+
# end
|
112
112
|
|
113
|
-
describe "xspec" do
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
113
|
+
# describe "xspec" do
|
114
|
+
# it "skips" do
|
115
|
+
# scope do
|
116
|
+
# res = xspec do
|
117
|
+
# raise "Wanna raise an error? do it ... nothing will happen"
|
118
|
+
# :whatever
|
119
|
+
# end
|
120
|
+
# res.must_be_kind_of(Matest::SpecSkipped)
|
121
|
+
# end
|
122
|
+
# end
|
123
123
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
124
|
+
# it "forwards the block" do
|
125
|
+
# scope do
|
126
|
+
# res = xspec do
|
127
|
+
# false
|
128
|
+
# end
|
129
|
+
# res.block.call.must_equal(false)
|
130
|
+
# end
|
131
|
+
# end
|
132
132
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
end
|
133
|
+
# it "allows a description and forwards it" do
|
134
|
+
# scope do
|
135
|
+
# res = spec "THE DESCRIPTION" do
|
136
|
+
# false
|
137
|
+
# end
|
138
|
+
# res.description.must_equal("THE DESCRIPTION")
|
139
|
+
# end
|
140
|
+
# end
|
141
|
+
# end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: matest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Federico Iachetti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -81,6 +81,7 @@ files:
|
|
81
81
|
- Rakefile
|
82
82
|
- bin/matest
|
83
83
|
- lib/matest.rb
|
84
|
+
- lib/matest/color.rb
|
84
85
|
- lib/matest/configure.rb
|
85
86
|
- lib/matest/evaluator.rb
|
86
87
|
- lib/matest/example.rb
|
@@ -103,6 +104,7 @@ files:
|
|
103
104
|
- spec/matest_specs/printing_assertion_spec.rb
|
104
105
|
- spec/matest_specs/scope_spec.rb
|
105
106
|
- spec/matest_specs/scoping_stuff_spec.rb
|
107
|
+
- spec/matest_specs/slow_spec.rb
|
106
108
|
- spec/matest_specs/spec_helper.rb
|
107
109
|
- spec/spec_helper.rb
|
108
110
|
homepage: ''
|
@@ -139,5 +141,6 @@ test_files:
|
|
139
141
|
- spec/matest_specs/printing_assertion_spec.rb
|
140
142
|
- spec/matest_specs/scope_spec.rb
|
141
143
|
- spec/matest_specs/scoping_stuff_spec.rb
|
144
|
+
- spec/matest_specs/slow_spec.rb
|
142
145
|
- spec/matest_specs/spec_helper.rb
|
143
146
|
- spec/spec_helper.rb
|