fix 0.11.1 → 0.12.0

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: d3a3a8baaafeb4c43a9557ad2490289b7647eb7e
4
- data.tar.gz: bcc497aa5fab96e9eac43b1377ee1326e237220d
3
+ metadata.gz: d0015a7505cc0ab4f4202b3a198685113e4c7a47
4
+ data.tar.gz: 14c5bfe6f8b5a34ea0ce99c1b246a73d81255624
5
5
  SHA512:
6
- metadata.gz: 0bc859ea4f452643759a0cd9a4048109c054b5b52394d522d44294f89f3a70c55f5bc2eaf0321ea2af873c05f43a2146252ae7fe9b647a2c62721edcba952804
7
- data.tar.gz: e4c54115f98ce44f4ad38f5c0fb2f1ad456f11196e9fd7d352bed5916be640015ee60bb16f96a3caf5cb9387981677430eac4ab956e951fd1c427089c31cffcf
6
+ metadata.gz: 3dddbe07d3f42ca6173c8a74481e92fd316a49af04119379b6afca8f36b02f16edc4db0f382393a3ac04f1adf97136d53922d08264f53e2bdd87d1798073e792
7
+ data.tar.gz: ee237b8eac427d5bff7f994587d8c4da5b5ecbc2a206cba159ea058f4c1dc2a9c1b183a37743afa5e5c94eb0c01ca8cee80f669956296f12cb55b358844e6594
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1 +1 @@
1
- 0.11.1
1
+ 0.12.0
@@ -0,0 +1 @@
1
+ 3205bd172dc4bdbc7ab6f213420e43389278b1138f6cf34a595a227432a00e080513edbed75d4fd6f8387796e403344fa69b05134ca1b917a588012d61e57b52
@@ -0,0 +1 @@
1
+ c7c3e73eafdbeecc61073bd643dc7eb6e5f9686fe5e3f4bc4e23889de3dcf3598f3d4b88e813cb5023e06ef4f44c5437f1f80351459668ef8403d3248d27468e
@@ -20,6 +20,7 @@ module Fix
20
20
  # Override Ruby's method_missing in order to provide let interface.
21
21
  #
22
22
  # @api private
23
+ #
23
24
  # @since 0.11.0
24
25
  #
25
26
  # @raise [NoMethodError] If doesn't respond to the given method.
@@ -1,10 +1,5 @@
1
- require 'defi'
2
-
3
1
  require_relative 'it'
4
-
5
- %w(it on).each do |helper|
6
- require_relative File.join 'helpers', "#{helper}_helper"
7
- end
2
+ require 'defi'
8
3
 
9
4
  module Fix
10
5
  # Wraps the target of challenge.
@@ -32,6 +27,69 @@ module Fix
32
27
  # @return [Array] The results.
33
28
  attr_reader :results
34
29
 
35
- [ItHelper, OnHelper].each { |helper| include helper }
30
+ # Add it method to the DSL.
31
+ #
32
+ # @api public
33
+ #
34
+ # @example It must eql "FOO"
35
+ # it { MUST Equal: 'FOO' }
36
+ #
37
+ # @param spec [Proc] A spec to compare against the computed actual value.
38
+ #
39
+ # @return [Array] List of results.
40
+ def it(&spec)
41
+ i = It.new(@front_object, @challenges, @helpers.dup)
42
+
43
+ result = begin
44
+ i.instance_eval(&spec)
45
+ rescue Spectus::Result::Fail => f
46
+ f
47
+ end
48
+
49
+ if @configuration.fetch(:verbose, true)
50
+ print result.to_char(@configuration.fetch(:color, false))
51
+ end
52
+
53
+ results << result
54
+ end
55
+
56
+ # Add on method to the DSL.
57
+ #
58
+ # @api public
59
+ #
60
+ # @example On +2, it must equal 44.
61
+ # on(:+, 2) do
62
+ # it { MUST Equal: 44 }
63
+ # end
64
+ #
65
+ # @param method_name [Symbol] The identifier of a method.
66
+ # @param args [Array] A list of arguments.
67
+ # @param block [Proc] A spec to compare against the computed value.
68
+ #
69
+ # @return [Array] List of results.
70
+ def on(method_name, *args, &block)
71
+ o = On.new(@front_object,
72
+ results,
73
+ (@challenges + [Defi.send(method_name, *args)]),
74
+ @helpers.dup,
75
+ @configuration)
76
+
77
+ o.instance_eval(&block)
78
+ end
79
+
80
+ # @api public
81
+ #
82
+ # @example Let's define the answer to the Ultimate Question of Life, the
83
+ # Universe, and Everything.
84
+ #
85
+ # let(:answer) { 42 }
86
+ #
87
+ # @param method_name [Symbol] The identifier of a method.
88
+ # @param block [Proc] A spec to compare against the computed value.
89
+ #
90
+ # @return [BasicObject] List of results.
91
+ def let(method_name, &block)
92
+ @helpers.update(method_name => block)
93
+ end
36
94
  end
37
95
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyril Wack
@@ -154,6 +154,8 @@ files:
154
154
  - checksum/fix-0.1.0.gem.sha512
155
155
  - checksum/fix-0.1.0.pre.gem.sha512
156
156
  - checksum/fix-0.10.0.gem.sha512
157
+ - checksum/fix-0.11.0.gem.sha512
158
+ - checksum/fix-0.11.1.gem.sha512
157
159
  - checksum/fix-0.2.0.gem.sha512
158
160
  - checksum/fix-0.3.0.gem.sha512
159
161
  - checksum/fix-0.4.0.gem.sha512
@@ -166,8 +168,6 @@ files:
166
168
  - checksum/fix-0.9.1.gem.sha512
167
169
  - fix.gemspec
168
170
  - lib/fix.rb
169
- - lib/fix/helpers/it_helper.rb
170
- - lib/fix/helpers/on_helper.rb
171
171
  - lib/fix/it.rb
172
172
  - lib/fix/on.rb
173
173
  - lib/fix/report.rb
metadata.gz.sig CHANGED
Binary file
@@ -1,33 +0,0 @@
1
- module Fix
2
- # It's helper.
3
- #
4
- # @api private
5
- #
6
- module ItHelper
7
- # Add it method to the DSL.
8
- #
9
- # @api public
10
- #
11
- # @example It must eql "FOO"
12
- # it { MUST Equal: 'FOO' }
13
- #
14
- # @param spec [Proc] A spec to compare against the computed actual value.
15
- #
16
- # @return [Array] List of results.
17
- def it(&spec)
18
- i = It.new(@front_object, @challenges, @helpers.dup)
19
-
20
- result = begin
21
- i.instance_eval(&spec)
22
- rescue Spectus::Result::Fail => f
23
- f
24
- end
25
-
26
- if @configuration.fetch(:verbose, true)
27
- print result.to_char(@configuration.fetch(:color, false))
28
- end
29
-
30
- results << result
31
- end
32
- end
33
- end
@@ -1,46 +0,0 @@
1
- module Fix
2
- # On's helper.
3
- #
4
- # @api private
5
- #
6
- module OnHelper
7
- # Add on method to the DSL.
8
- #
9
- # @api public
10
- #
11
- # @example On +2, it must equal 44.
12
- # on(:+, 2) do
13
- # it { MUST Equal: 44 }
14
- # end
15
- #
16
- # @param method_name [Symbol] The identifier of a method.
17
- # @param args [Array] A list of arguments.
18
- # @param block [Proc] A spec to compare against the computed value.
19
- #
20
- # @return [Array] List of results.
21
- def on(method_name, *args, &block)
22
- o = On.new(@front_object,
23
- results,
24
- (@challenges + [Defi.send(method_name, *args)]),
25
- @helpers.dup,
26
- @configuration)
27
-
28
- o.instance_eval(&block)
29
- end
30
-
31
- # @api public
32
- #
33
- # @example Let's define the answer to the Ultimate Question of Life, the
34
- # Universe, and Everything.
35
- #
36
- # let(:answer) { 42 }
37
- #
38
- # @param method_name [Symbol] The identifier of a method.
39
- # @param block [Proc] A spec to compare against the computed value.
40
- #
41
- # @return [BasicObject] List of results.
42
- def let(method_name, &block)
43
- @helpers.update(method_name => block)
44
- end
45
- end
46
- end