Sha256: c546d50309a9dbcffd6f65e7b0fed798ca03e19f714b3b3082f308901d19bcbf
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 KB
Contents
module Fix # On's helper. # # @api private # module OnHelper # Add on method to the DSL. # # @api public # # @example On +2, it must equal 44. # on(:+, 2) do # it { MUST Equal: 44 } # end # # @param method_name [Symbol] The identifier of a method. # @param args [Array] A list of arguments. # @param block [Proc] A spec to compare against the computed value. # # @return [Array] List of results. def on(method_name, *args, &block) o = On.new(@front_object, results, (@challenges + [Defi.send(method_name, *args)]), @helpers.dup, @configuration) o.instance_eval(&block) end # @api public # # @example Let's define the answer to the Ultimate Question of Life, the # Universe, and Everything. # # let(:answer) { 42 } # # @param method_name [Symbol] The identifier of a method. # @param block [Proc] A spec to compare against the computed value. # # @return [BasicObject] List of results. def let(method_name, &block) @helpers.update(method_name => block) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fix-0.11.1 | lib/fix/helpers/on_helper.rb |
fix-0.11.0 | lib/fix/helpers/on_helper.rb |