fix 0.7.1 → 0.8.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/VERSION.semver +1 -1
- data/lib/fix.rb +4 -3
- data/lib/fix/helpers/it_helper.rb +1 -1
- data/lib/fix/helpers/on_helper.rb +2 -1
- data/lib/fix/on.rb +9 -7
- data/lib/fix/report.rb +12 -14
- data/lib/fix/test.rb +11 -2
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1dbcef751a7f141ec73878ddf24961d2c0de3252
|
4
|
+
data.tar.gz: f5a1b9113e857511e2f81de21fcee062ccf2ce13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7131c6f5781345f0eb35ebb45b787ea7e04892e237cafdd413c3659670eb8aab3f64bb5e2bcdb3f9a97ae80d93ec4ea5f87645ee4e0b442fe8a61785db5e3849
|
7
|
+
data.tar.gz: f4174a6f9c687a4c726ad2d44d0dffc0c404dad88c3971254aeb6b7a5b74cd536efff75418766deac7d97c997112614e66bdf6ca9ffb08bfd03ab31be60487c5
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/VERSION.semver
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.8.0
|
data/lib/fix.rb
CHANGED
@@ -13,13 +13,14 @@ module Fix
|
|
13
13
|
# end
|
14
14
|
#
|
15
15
|
# @param front_object [BasicObject] The front object.
|
16
|
+
# @param options [Hash] Some options.
|
16
17
|
# @param specs [Proc] The set of specs.
|
17
18
|
#
|
18
19
|
# @return [ExpectationTarget] The expectation target.
|
19
|
-
def self.describe(front_object, &specs)
|
20
|
-
t = Test.new(front_object, &specs)
|
20
|
+
def self.describe(front_object, options = {}, &specs)
|
21
|
+
t = Test.new(front_object, options, &specs)
|
21
22
|
|
22
|
-
puts "#{t.report}"
|
23
|
+
puts "#{t.report}" if options.fetch(:verbose, true)
|
23
24
|
exit t.pass?
|
24
25
|
end
|
25
26
|
end
|
@@ -21,7 +21,8 @@ module Fix
|
|
21
21
|
def on(method_name, *args, &block)
|
22
22
|
o = On.new(@front_object,
|
23
23
|
results,
|
24
|
-
|
24
|
+
(@challenges + [Spectus::Challenge.new(method_name, *args)]),
|
25
|
+
@configuration)
|
25
26
|
|
26
27
|
o.instance_eval(&block)
|
27
28
|
end
|
data/lib/fix/on.rb
CHANGED
@@ -17,13 +17,15 @@ module Fix
|
|
17
17
|
class On
|
18
18
|
# Initialize the on class.
|
19
19
|
#
|
20
|
-
# @param front_object
|
21
|
-
# @param results
|
22
|
-
# @param challenges
|
23
|
-
|
24
|
-
|
25
|
-
@
|
26
|
-
@
|
20
|
+
# @param front_object [BasicObject] The front object of the test.
|
21
|
+
# @param results [Array] The list of collected results.
|
22
|
+
# @param challenges [Array] The list of challenges to apply.
|
23
|
+
# @param configuration [Hash] Settings.
|
24
|
+
def initialize(front_object, results, challenges, configuration = {})
|
25
|
+
@front_object = front_object
|
26
|
+
@results = results
|
27
|
+
@challenges = challenges
|
28
|
+
@configuration = configuration
|
27
29
|
end
|
28
30
|
|
29
31
|
# @!attribute [r] results
|
data/lib/fix/report.rb
CHANGED
@@ -20,11 +20,19 @@ module Fix
|
|
20
20
|
#
|
21
21
|
# @return [String] The report in plain text.
|
22
22
|
def to_s
|
23
|
-
|
23
|
+
maybe_thematic_break +
|
24
|
+
maybe_alerts_banner +
|
25
|
+
total_time_banner +
|
26
|
+
statistics_banner
|
24
27
|
end
|
25
28
|
|
26
29
|
private
|
27
30
|
|
31
|
+
# @private
|
32
|
+
def maybe_thematic_break
|
33
|
+
test.results.any? && @test.configuration.fetch(:verbose) ? "\n\n" : ''
|
34
|
+
end
|
35
|
+
|
28
36
|
# @private
|
29
37
|
def total_time_banner
|
30
38
|
"Ran #{test.results.length} tests in #{test.total_time} seconds\n"
|
@@ -36,14 +44,8 @@ module Fix
|
|
36
44
|
end
|
37
45
|
|
38
46
|
# @private
|
39
|
-
def
|
40
|
-
|
41
|
-
"\n" \
|
42
|
-
"\n" \
|
43
|
-
"#{results_banner.join("\n")}\n"
|
44
|
-
else
|
45
|
-
''
|
46
|
-
end
|
47
|
+
def maybe_alerts_banner
|
48
|
+
alerts.any? ? "#{results_banner.join("\n")}\n" : ''
|
47
49
|
end
|
48
50
|
|
49
51
|
# @private
|
@@ -55,11 +57,7 @@ module Fix
|
|
55
57
|
|
56
58
|
# @private
|
57
59
|
def maybe_backtrace(result)
|
58
|
-
|
59
|
-
" #{result.backtrace.first}\n"
|
60
|
-
else
|
61
|
-
''
|
62
|
-
end
|
60
|
+
result.respond_to?(:backtrace) ? " #{result.backtrace.first}\n" : ''
|
63
61
|
end
|
64
62
|
|
65
63
|
# @private
|
data/lib/fix/test.rb
CHANGED
@@ -10,17 +10,26 @@ module Fix
|
|
10
10
|
# Initialize the test class.
|
11
11
|
#
|
12
12
|
# @param front_object [BasicObject] The front object of the test.
|
13
|
+
# @param options [Hash] Some options.
|
13
14
|
# @param specs [Proc] The specs to test against the object.
|
14
|
-
def initialize(front_object, &specs)
|
15
|
+
def initialize(front_object, options = {}, &specs)
|
16
|
+
@configuration = { verbose: true }
|
17
|
+
@configuration.update(options)
|
18
|
+
|
15
19
|
start_time = Time.now
|
16
20
|
|
17
|
-
g = On.new(front_object, [])
|
21
|
+
g = On.new(front_object, [], [], @configuration)
|
18
22
|
g.instance_eval(&specs)
|
19
23
|
|
20
24
|
@results = g.results
|
21
25
|
@total_time = Time.now - start_time
|
22
26
|
end
|
23
27
|
|
28
|
+
# @!attribute [r] configuration
|
29
|
+
#
|
30
|
+
# @return [Hash] The settings.
|
31
|
+
attr_reader :configuration
|
32
|
+
|
24
33
|
# @!attribute [r] results
|
25
34
|
#
|
26
35
|
# @return [Array] The results.
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|