Class: RSpec::Sidekiq::Matchers::SaveBacktrace
- Inherits:
-
Object
- Object
- RSpec::Sidekiq::Matchers::SaveBacktrace
- Defined in:
- lib/rspec/sidekiq/matchers/save_backtrace.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(expected_backtrace = true) ⇒ SaveBacktrace
constructor
A new instance of SaveBacktrace.
- #matches?(job) ⇒ Boolean
Constructor Details
#initialize(expected_backtrace = true) ⇒ SaveBacktrace
Returns a new instance of SaveBacktrace.
9 10 11 |
# File 'lib/rspec/sidekiq/matchers/save_backtrace.rb', line 9 def initialize(expected_backtrace=true) @expected_backtrace = expected_backtrace end |
Instance Method Details
#description ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/rspec/sidekiq/matchers/save_backtrace.rb', line 13 def description if @expected_backtrace.is_a?(Numeric) "save #{@expected_backtrace} lines of error backtrace" # backtrace: 5 elsif @expected_backtrace 'save error backtrace' # backtrace: true else 'not save error backtrace' # backtrace: false end end |
#failure_message ⇒ Object
23 24 25 |
# File 'lib/rspec/sidekiq/matchers/save_backtrace.rb', line 23 def "expected #{@klass} to #{description} but got #{@actual}" end |
#failure_message_when_negated ⇒ Object
33 34 35 |
# File 'lib/rspec/sidekiq/matchers/save_backtrace.rb', line 33 def "expected #{@klass} to not #{description}".gsub 'not not ', '' end |
#matches?(job) ⇒ Boolean
27 28 29 30 31 |
# File 'lib/rspec/sidekiq/matchers/save_backtrace.rb', line 27 def matches?(job) @klass = job.is_a?(Class) ? job : job.class @actual = @klass.['backtrace'] @actual == @expected_backtrace end |