exemplor 2.4.2 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/examples.rb +2 -0
- data/examples/checking_nil.rb +10 -0
- data/examples/dumping_classes.rb +15 -0
- data/exemplor.gemspec +5 -1
- data/lib/exemplor.rb +9 -4
- metadata +5 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.6.0
|
data/examples.rb
CHANGED
@@ -46,6 +46,8 @@ eg { check_output_matches_expected_for :assertion_failure }
|
|
46
46
|
eg { check_output_matches_expected_for :assertion_success_and_failure }
|
47
47
|
eg { check_output_matches_expected_for :helpers }
|
48
48
|
eg { check_output_matches_expected_for :with_setup }
|
49
|
+
eg { check_output_matches_expected_for :checking_nil }
|
50
|
+
eg { check_output_matches_expected_for :dumping_classes }
|
49
51
|
|
50
52
|
eg "called with --list arg" do
|
51
53
|
list = YAML.load(run_example(:with_setup, '--list'))
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'exemplor'
|
2
|
+
|
3
|
+
eg "class name is printed when example returns a class" do
|
4
|
+
Object
|
5
|
+
end
|
6
|
+
|
7
|
+
eg "class name is printed when check is given a class" do
|
8
|
+
Check(Object)
|
9
|
+
end
|
10
|
+
|
11
|
+
__END__
|
12
|
+
|
13
|
+
(i) class name is printed when example returns a class: Object
|
14
|
+
(I) class name is printed when check is given a class:
|
15
|
+
(i) Object: Object
|
data/exemplor.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{exemplor}
|
8
|
-
s.version = "2.
|
8
|
+
s.version = "2.6.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Myles Byrne"]
|
@@ -26,6 +26,8 @@ Gem::Specification.new do |s|
|
|
26
26
|
"examples/assertion_success.rb",
|
27
27
|
"examples/assertion_success_and_failure.rb",
|
28
28
|
"examples/check_with_disambiguation.rb",
|
29
|
+
"examples/checking_nil.rb",
|
30
|
+
"examples/dumping_classes.rb",
|
29
31
|
"examples/helpers.rb",
|
30
32
|
"examples/no_checks.rb",
|
31
33
|
"examples/no_checks_non_string.rb",
|
@@ -46,6 +48,8 @@ Gem::Specification.new do |s|
|
|
46
48
|
"examples/assertion_success.rb",
|
47
49
|
"examples/assertion_success_and_failure.rb",
|
48
50
|
"examples/check_with_disambiguation.rb",
|
51
|
+
"examples/checking_nil.rb",
|
52
|
+
"examples/dumping_classes.rb",
|
49
53
|
"examples/helpers.rb",
|
50
54
|
"examples/no_checks.rb",
|
51
55
|
"examples/no_checks_non_string.rb",
|
data/lib/exemplor.rb
CHANGED
@@ -30,7 +30,7 @@ module Exemplor
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def status
|
33
|
-
return :info
|
33
|
+
return :info unless defined? @expectation
|
34
34
|
@value == @expectation ? :success : :failure
|
35
35
|
end
|
36
36
|
|
@@ -144,7 +144,7 @@ module Exemplor
|
|
144
144
|
env.instance_eval(&Example.setup_block) if Example.setup_block
|
145
145
|
value = env.instance_eval(&code)
|
146
146
|
if env._checks.empty?
|
147
|
-
value
|
147
|
+
render_value value
|
148
148
|
else
|
149
149
|
status = :infos if env._checks.all? { |check| check.info? }
|
150
150
|
status = :success if env._checks.all? { |check| check.success? }
|
@@ -165,12 +165,12 @@ module Exemplor
|
|
165
165
|
failure = check if check.failure?
|
166
166
|
break if failure
|
167
167
|
|
168
|
-
out["#{status_icon(check.status)} #{check.name}"] = check.value
|
168
|
+
out["#{status_icon(check.status)} #{check.name}"] = render_value check.value
|
169
169
|
end
|
170
170
|
if failure
|
171
171
|
fail_out = out["#{status_icon(failure.status)} #{failure.name}"] = OrderedHash.new
|
172
172
|
fail_out['expected'] = failure.expectation
|
173
|
-
fail_out['actual'] = failure.value
|
173
|
+
fail_out['actual'] = render_value failure.value
|
174
174
|
end
|
175
175
|
out
|
176
176
|
end
|
@@ -187,6 +187,11 @@ module Exemplor
|
|
187
187
|
icon = status == :infos ? '(I)' : "(#{status.to_s.slice(0,1)})"
|
188
188
|
end
|
189
189
|
|
190
|
+
# yaml doesn't want to print a class
|
191
|
+
def render_value(value)
|
192
|
+
value.kind_of?(Class) ? value.inspect : value
|
193
|
+
end
|
194
|
+
|
190
195
|
end
|
191
196
|
|
192
197
|
class << self
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exemplor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Myles Byrne
|
@@ -52,6 +52,8 @@ files:
|
|
52
52
|
- examples/assertion_success.rb
|
53
53
|
- examples/assertion_success_and_failure.rb
|
54
54
|
- examples/check_with_disambiguation.rb
|
55
|
+
- examples/checking_nil.rb
|
56
|
+
- examples/dumping_classes.rb
|
55
57
|
- examples/helpers.rb
|
56
58
|
- examples/no_checks.rb
|
57
59
|
- examples/no_checks_non_string.rb
|
@@ -94,6 +96,8 @@ test_files:
|
|
94
96
|
- examples/assertion_success.rb
|
95
97
|
- examples/assertion_success_and_failure.rb
|
96
98
|
- examples/check_with_disambiguation.rb
|
99
|
+
- examples/checking_nil.rb
|
100
|
+
- examples/dumping_classes.rb
|
97
101
|
- examples/helpers.rb
|
98
102
|
- examples/no_checks.rb
|
99
103
|
- examples/no_checks_non_string.rb
|