matest 1.3.2 → 1.4.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 161f528b33af0462a93a283e4fed0a333fd6f8cb
4
- data.tar.gz: 2c5a1a2bf62de2b4f9d283733297c5d274a756d5
3
+ metadata.gz: 74fc41b6ca3f18bac9a2414bd7b6084b4061b05a
4
+ data.tar.gz: 95492497f03ee0b221644c7f615ad72ebe14db25
5
5
  SHA512:
6
- metadata.gz: 9489765c88e786a6f2f71c4f2206c9ca15fe0de9c35cd5537d2534d028226bc96473c875355a87e440ef3773403a97341ebf76a6a9cdc1f2a80c906463676ae9
7
- data.tar.gz: f6266bf6ff5a21948f18767ac03821ba6404549c870f6eef3f679dcbcaad22d3c8f34a17667d43209fa26ff47bc9ea76994b885b237afeb719e1f6bc97a9efd4
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
@@ -1,6 +1,7 @@
1
1
  require "matest/version"
2
2
 
3
3
  require "matest/configure"
4
+ require "matest/color"
4
5
  require "matest/runner"
5
6
  require "matest/example_group"
6
7
  require "matest/example"
@@ -0,0 +1,13 @@
1
+ require 'term/ansicolor'
2
+
3
+ module Matest
4
+ module Color
5
+ module_function
6
+
7
+ Term::ANSIColor.attributes.each do |attr|
8
+ define_method(attr) do |str|
9
+ Matest::Configure.color? ? Term::ANSIColor.send(attr, str) : str
10
+ end
11
+ end
12
+ end
13
+ end
@@ -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
- blue(str + ":")
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 => :red,
111
+ Matest::ExceptionRaised => :magenta,
125
112
  }
126
113
  end
127
114
  end
@@ -1,3 +1,3 @@
1
1
  module Matest
2
- VERSION = "1.3.2"
2
+ VERSION = "1.4.0"
3
3
  end
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
- 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
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
- 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
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
- 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
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
- 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
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
- 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
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
- 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
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
- 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
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
- 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
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
- 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
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
- it "exists only inside a scope" do
105
- -> {
106
- spec do
107
- true
108
- end
109
- }.must_raise(NoMethodError)
110
- end
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
- 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
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
- 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
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
- 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
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
@@ -0,0 +1,9 @@
1
+ xscope "slow" do
2
+ spec { sleep(0.5); true }
3
+ spec { sleep(0.5); true }
4
+ spec { sleep(0.5); true }
5
+ spec { sleep(0.5); true }
6
+ spec { sleep(0.5); true }
7
+ spec { sleep(0.5); true }
8
+ spec { sleep(0.5); true }
9
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,5 @@
1
- $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
1
+ # $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
2
2
 
3
- require "minitest/autorun"
3
+ # require "minitest/autorun"
4
4
 
5
- require "matest"
5
+ # require "matest"
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.3.2
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-14 00:00:00.000000000 Z
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