Class: PerfSpec::WhySoLong
- Inherits:
-
Object
- Object
- PerfSpec::WhySoLong
- Defined in:
- lib/perf_spec/why_so_long.rb
Instance Attribute Summary collapse
-
#bullet_enable_stat ⇒ Object
readonly
Returns the value of attribute bullet_enable_stat.
-
#bullet_warnings ⇒ Object
readonly
Returns the value of attribute bullet_warnings.
-
#check_result ⇒ Object
readonly
Returns the value of attribute check_result.
-
#expected_time ⇒ Object
readonly
Returns the value of attribute expected_time.
-
#meta_request_id ⇒ Object
readonly
Returns the value of attribute meta_request_id.
-
#real_time ⇒ Object
readonly
Returns the value of attribute real_time.
Instance Method Summary collapse
- #check(&block) ⇒ Object
- #failure_message(_actual, matcher) ⇒ Object
-
#initialize(expected_time) ⇒ WhySoLong
constructor
A new instance of WhySoLong.
- #success? ⇒ Boolean
Constructor Details
#initialize(expected_time) ⇒ WhySoLong
8 9 10 |
# File 'lib/perf_spec/why_so_long.rb', line 8 def initialize(expected_time) @expected_time = expected_time end |
Instance Attribute Details
#bullet_enable_stat ⇒ Object (readonly)
Returns the value of attribute bullet_enable_stat.
6 7 8 |
# File 'lib/perf_spec/why_so_long.rb', line 6 def bullet_enable_stat @bullet_enable_stat end |
#bullet_warnings ⇒ Object (readonly)
Returns the value of attribute bullet_warnings.
6 7 8 |
# File 'lib/perf_spec/why_so_long.rb', line 6 def bullet_warnings @bullet_warnings end |
#check_result ⇒ Object (readonly)
Returns the value of attribute check_result.
6 7 8 |
# File 'lib/perf_spec/why_so_long.rb', line 6 def check_result @check_result end |
#expected_time ⇒ Object (readonly)
Returns the value of attribute expected_time.
6 7 8 |
# File 'lib/perf_spec/why_so_long.rb', line 6 def expected_time @expected_time end |
#meta_request_id ⇒ Object (readonly)
Returns the value of attribute meta_request_id.
6 7 8 |
# File 'lib/perf_spec/why_so_long.rb', line 6 def end |
#real_time ⇒ Object (readonly)
Returns the value of attribute real_time.
6 7 8 |
# File 'lib/perf_spec/why_so_long.rb', line 6 def real_time @real_time end |
Instance Method Details
#check(&block) ⇒ Object
12 13 14 15 16 |
# File 'lib/perf_spec/why_so_long.rb', line 12 def check(&block) @real_time = Benchmark.realtime do @check_result = block.call end end |
#failure_message(_actual, matcher) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/perf_spec/why_so_long.rb', line 22 def (_actual, matcher) = (matcher) return unless [ , "\nTakes controller: ", META_REQUEST_KEYS.map { |key| "#{key}: #{duration_sum(meta_request_output, key)}" }.join(', '), "\n", .ai(indent: -2) ].join('') end |
#success? ⇒ Boolean
18 19 20 |
# File 'lib/perf_spec/why_so_long.rb', line 18 def success? @success ||= real_time <= expected_time end |