Class: Fitting::Report::Actions
- Inherits:
-
Object
- Object
- Fitting::Report::Actions
- Defined in:
- lib/fitting/report/actions.rb
Instance Method Summary collapse
- #cram_into_the_appropriate_action(test) ⇒ Object
- #details(prefix) ⇒ Object
-
#initialize(actions) ⇒ Actions
constructor
A new instance of Actions.
- #join(tests) ⇒ Object
- #there_a_suitable_action?(test) ⇒ Boolean
- #to_a ⇒ Object
Constructor Details
Instance Method Details
#cram_into_the_appropriate_action(test) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/fitting/report/actions.rb', line 34 def cram_into_the_appropriate_action(test) @actions.map do |action| if test.method == action.method && action.path_match(test.path) action.add_test(test) break end end end |
#details(prefix) ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/fitting/report/actions.rb', line 43 def details(prefix) { tests_without_actions: prefix.tests.without_actions, actions_details: @actions.map do |a| { method: a.method, path: a.path, tests_size: a.tests.size, responses: a.details } end } end |
#join(tests) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/fitting/report/actions.rb', line 17 def join(tests) tests.to_a.map do |test| if there_a_suitable_action?(test) cram_into_the_appropriate_action(test) test.mark_action end end end |
#there_a_suitable_action?(test) ⇒ Boolean
26 27 28 29 30 31 32 |
# File 'lib/fitting/report/actions.rb', line 26 def there_a_suitable_action?(test) @actions.map do |action| return true if test.method == action.method && action.path_match(test.path) end false end |
#to_a ⇒ Object
13 14 15 |
# File 'lib/fitting/report/actions.rb', line 13 def to_a @actions end |