Class: Fitting::Report::Action
- Inherits:
-
Object
- Object
- Fitting::Report::Action
- Defined in:
- lib/fitting/report/action.rb
Instance Attribute Summary collapse
-
#responses ⇒ Object
readonly
Returns the value of attribute responses.
-
#tests ⇒ Object
readonly
Returns the value of attribute tests.
Instance Method Summary collapse
- #add_test(test) ⇒ Object
- #details ⇒ Object
-
#initialize(action) ⇒ Action
constructor
A new instance of Action.
- #method ⇒ Object
- #path ⇒ Object
- #path_match(find_path) ⇒ Object
- #regexp ⇒ Object
Constructor Details
Instance Attribute Details
#responses ⇒ Object (readonly)
Returns the value of attribute responses.
20 21 22 |
# File 'lib/fitting/report/action.rb', line 20 def responses @responses end |
#tests ⇒ Object (readonly)
Returns the value of attribute tests.
20 21 22 |
# File 'lib/fitting/report/action.rb', line 20 def tests @tests end |
Instance Method Details
#add_test(test) ⇒ Object
22 23 24 |
# File 'lib/fitting/report/action.rb', line 22 def add_test(test) @tests.push(test) end |
#details ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/fitting/report/action.rb', line 39 def details { tests_without_responses: @tests.without_responses, responses_details: @responses.to_a.map do |r| { method: r.status, tests_size: r.tests.size, json_schema: r.id, combinations: r.details } end } end |
#method ⇒ Object
12 13 14 |
# File 'lib/fitting/report/action.rb', line 12 def method @action.method end |
#path ⇒ Object
16 17 18 |
# File 'lib/fitting/report/action.rb', line 16 def path @action.path.to_s end |
#path_match(find_path) ⇒ Object
26 27 28 |
# File 'lib/fitting/report/action.rb', line 26 def path_match(find_path) regexp =~ find_path end |
#regexp ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/fitting/report/action.rb', line 30 def regexp return @regexp if @regexp str = Regexp.escape(path) str = str.gsub(/\\{\w+\\}/, '[^&=\/]+') str = "\\A#{str}\\z" @regexp = Regexp.new(str) end |