Class: Fix::On Private
- Inherits:
-
Object
- Object
- Fix::On
- Defined in:
- lib/fix/on.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Wraps the target of challenge.
Instance Attribute Summary collapse
-
#challenges ⇒ Array
readonly
private
The list of challenges to apply.
-
#configuration ⇒ Hash
readonly
private
Settings.
-
#described ⇒ #object_id
readonly
private
The front object of the test.
-
#helpers ⇒ Hash
readonly
private
The list of helpers.
-
#results ⇒ Array
readonly
private
The list of collected results.
Instance Method Summary collapse
-
#context(&block) ⇒ Array
Add context method to the DSL, to build an isolated scope.
-
#initialize(described, results, challenges, helpers, configuration) ⇒ On
constructor
private
Initialize the on class.
-
#it(&spec) ⇒ Array
Add it method to the DSL.
-
#let(method_name, &block) ⇒ #object_id
Add let method to the DSL, to define memoized helper methods.
-
#on(method_name, *args, &block) ⇒ Array
Add on method to the DSL.
Constructor Details
#initialize(described, results, challenges, helpers, configuration) ⇒ On
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize the on class.
19 20 21 22 23 24 25 |
# File 'lib/fix/on.rb', line 19 def initialize(described, results, challenges, helpers, configuration) @described = described @results = results @challenges = challenges @helpers = helpers @configuration = configuration end |
Instance Attribute Details
#challenges ⇒ Array (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns The list of challenges to apply.
40 41 42 |
# File 'lib/fix/on.rb', line 40 def challenges @challenges end |
#configuration ⇒ Hash (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Settings.
50 51 52 |
# File 'lib/fix/on.rb', line 50 def configuration @configuration end |
#described ⇒ #object_id (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns The front object of the test.
30 31 32 |
# File 'lib/fix/on.rb', line 30 def described @described end |
#helpers ⇒ Hash (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns The list of helpers.
45 46 47 |
# File 'lib/fix/on.rb', line 45 def helpers @helpers end |
#results ⇒ Array (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns The list of collected results.
35 36 37 |
# File 'lib/fix/on.rb', line 35 def results @results end |
Instance Method Details
#context(&block) ⇒ Array
Add context method to the DSL, to build an isolated scope.
127 128 129 130 131 132 133 134 135 |
# File 'lib/fix/on.rb', line 127 def context(*, &block) o = On.new(described, [], challenges, helpers.dup, configuration) results.concat(::Aw.fork! { o.instance_eval(&block) }) end |
#it(&spec) ⇒ Array
Add it method to the DSL.
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/fix/on.rb', line 62 def it(*, &spec) i = It.new(described, challenges, helpers) result = i.verify(&spec) if configuration.fetch(:verbose, true) print result.to_char(configuration.fetch(:color, false)) end results << result end |
#let(method_name, &block) ⇒ #object_id
Add let method to the DSL, to define memoized helper methods.
111 112 113 |
# File 'lib/fix/on.rb', line 111 def let(method_name, &block) helpers.update(method_name => block) end |