matest 1.6.4 → 1.6.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc5e86300096a6ca0547c40b070f248c80fc96f6
4
- data.tar.gz: 41808bf9b7fef44040c2aeec06c042944ed511d4
3
+ metadata.gz: 36062f8b707332afa8c056e0fa968518dcd9086b
4
+ data.tar.gz: 752248ac4ba6c9e4004c6b94d28f2516e8a43dac
5
5
  SHA512:
6
- metadata.gz: 228a61e509a3f3bd31a7a442f26eeb0c8c4bc1870bf1ff348107e27a981815ee7123c2313c125e82e37115b14498f83e245aa8bafb204b8a65e3126c72c89e28
7
- data.tar.gz: 9361c7f168c71f3bb22cb1a267909b40873b09fc373118f8e631531e821fb258e989a99fcf4af3d1c28d82bb56ddefb70b852f0babb12675dbe006bc8f6c2481
6
+ metadata.gz: 9b6dca03db53a6ff0fc0259a706fa0b1780eff0faa887b5be4287c0b511ef9f6e52dfb22c8d28796b4a8eda967f09fa6d0a294769e26cb671f1e18ede19d6e4c
7
+ data.tar.gz: a6ba560b0816ce402402fd8fab385cdf006e3dca350c3fd0f8bac978bbf340c89e03811d156e6aec9ac21b9a791492c02a43d8ecd0fa5f46d85657ef4e2b1737
data/bin/matest CHANGED
@@ -24,26 +24,4 @@ runner.execute!
24
24
 
25
25
  time_elapsed = Time.now - start_time
26
26
 
27
- puts
28
- info = runner.info
29
-
30
- def spec_detail(info)
31
- info[:num_specs].map { |name, num|
32
- " #{num} #{name.downcase}."
33
- }.join("\n")
34
- end
35
-
36
- good_bye_message = <<-EOF
37
- ------------------------------------------
38
- Specs:
39
- #{spec_detail(info)}
40
-
41
- EOF
42
-
43
- puts good_bye_message
44
-
45
- time_elapsed = Time.now - start_time
46
- puts "Elapsed: #{time_elapsed} seconds."
47
-
48
-
49
- exit(1) unless info[:success]
27
+ exit(1) unless runner.info[:success]
@@ -28,7 +28,7 @@ module Matest
28
28
  instance_eval(&scope_block)
29
29
  specs.shuffle.each do |spec, desc|
30
30
  res = run_spec(spec)
31
- printer.print(res)
31
+ printer.prints(res)
32
32
  end
33
33
 
34
34
  end
@@ -16,7 +16,7 @@ module Matest
16
16
  instance_eval(&scope_block)
17
17
  specs.each do |spec|
18
18
  res = run_spec(spec)
19
- printer.print(res)
19
+ printer.prints(res)
20
20
  end
21
21
  end
22
22
 
@@ -4,12 +4,12 @@ module Matest
4
4
  class SpecPrinter
5
5
  include Color
6
6
 
7
- def print(res)
8
- send(colors[res.class], res.to_s)
7
+ def prints(res)
8
+ print send(colors[res.class], res.to_s)
9
9
  end
10
10
 
11
11
  def print_messages(runner)
12
- puts "\n\n### Messages ###"
12
+ puts header("\n\n### Messages ###")
13
13
 
14
14
  statuses = []
15
15
  runner.info[:success] = true
@@ -19,8 +19,8 @@ module Matest
19
19
  current_group.statuses.each do |status|
20
20
  runner.info[:num_specs][:total] += 1
21
21
 
22
- runner.info[:num_specs][status.name] ||= 0
23
- runner.info[:num_specs][status.name] += 1
22
+ runner.info[:num_specs][status.class] ||= 0
23
+ runner.info[:num_specs][status.class] += 1
24
24
 
25
25
  if !status.is_a?(Matest::SpecPassed)
26
26
  puts send(colors[status.class], "\n[#{status.name}] #{status.description}")
@@ -48,7 +48,7 @@ module Matest
48
48
  end
49
49
  if status.is_a?(Matest::NotANaturalAssertion)
50
50
  runner.info[:success] = false
51
- puts " # => #{status.result.inspect}"
51
+ puts " # => #{status.result.inspect}", reset("")
52
52
  print_explanation_for(status)
53
53
  end
54
54
  if status.is_a?(Matest::ExceptionRaised)
@@ -57,11 +57,19 @@ module Matest
57
57
  status.result.backtrace.each do |l|
58
58
  puts error(" #{l}")
59
59
  end
60
-
61
60
  end
62
61
  end
63
62
  end
64
63
  end
64
+ puts nil, "-"*50, nil
65
+ puts "Specs:"
66
+
67
+ p runner.info
68
+ runner.info[:num_specs].each { |klass, num|
69
+ puts send(colors[klass], " #{num} #{klass.to_s.downcase}.")
70
+ }
71
+
72
+
65
73
  end
66
74
 
67
75
  def print_explanation_for(status)
@@ -99,7 +107,7 @@ module Matest
99
107
  private
100
108
 
101
109
  def header(str)
102
- str + ":"
110
+ white(str + ":")
103
111
  end
104
112
 
105
113
  def expression(str)
@@ -111,7 +119,7 @@ module Matest
111
119
  end
112
120
 
113
121
  def key_value(key, value)
114
- " #{yellow(key.to_s)} #{bright_black("=>")} #{blue(value.inspect)}"
122
+ " #{yellow(key.to_s)} #{bright_black("=>")} #{blue(value.inspect)}#{reset("")}"
115
123
  end
116
124
 
117
125
  def error(str)
@@ -119,13 +127,19 @@ module Matest
119
127
  end
120
128
 
121
129
  def colors
122
- {
123
- Matest::SpecPassed => :green,
124
- Matest::SpecFailed => :red,
125
- Matest::SpecSkipped => :yellow,
126
- Matest::NotANaturalAssertion => :cyan,
127
- Matest::ExceptionRaised => :magenta,
128
- }
130
+ @colors ||= get_colors
131
+ end
132
+
133
+ def get_colors
134
+ h = Hash.new(:white)
135
+
136
+ h[Matest::SpecPassed] = :green
137
+ h[Matest::SpecFailed] = :red
138
+ h[Matest::SpecSkipped] = :yellow
139
+ h[Matest::NotANaturalAssertion] = :cyan
140
+ h[Matest::ExceptionRaised] = :magenta
141
+
142
+ h
129
143
  end
130
144
  end
131
145
  end
@@ -15,6 +15,14 @@ module Matest
15
15
  def description
16
16
  example.description
17
17
  end
18
+
19
+ def name
20
+ self.class.name
21
+ end
22
+
23
+ def self.to_s
24
+ name
25
+ end
18
26
  end
19
27
 
20
28
  class SpecPassed < SpecStatus
@@ -22,7 +30,7 @@ module Matest
22
30
  "."
23
31
  end
24
32
 
25
- def name
33
+ def self.name
26
34
  "PASSING"
27
35
  end
28
36
  end
@@ -32,7 +40,7 @@ module Matest
32
40
  "F"
33
41
  end
34
42
 
35
- def name
43
+ def self.name
36
44
  "FAILING"
37
45
  end
38
46
  end
@@ -42,7 +50,7 @@ module Matest
42
50
  "S"
43
51
  end
44
52
 
45
- def name
53
+ def self.name
46
54
  "SKIPPED"
47
55
  end
48
56
  end
@@ -51,7 +59,7 @@ module Matest
51
59
  "N"
52
60
  end
53
61
 
54
- def name
62
+ def self.name
55
63
  "NOT A NATURAL ASSERTION"
56
64
  end
57
65
  end
@@ -62,7 +70,7 @@ module Matest
62
70
  "E"
63
71
  end
64
72
 
65
- def name
73
+ def self.name
66
74
  "ERROR"
67
75
  end
68
76
  end
@@ -1,3 +1,3 @@
1
1
  module Matest
2
- VERSION = "1.6.4"
2
+ VERSION = "1.6.5"
3
3
  end
@@ -25,3 +25,4 @@ scope "A" do
25
25
  end
26
26
  end
27
27
  end
28
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: matest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.4
4
+ version: 1.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Federico Iachetti