Class: RSpec::Sidekiq::Matchers::BeExpiredIn
- Inherits:
-
Object
- Object
- RSpec::Sidekiq::Matchers::BeExpiredIn
- Defined in:
- lib/rspec/sidekiq/matchers/be_expired_in.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(expected_argument) ⇒ BeExpiredIn
constructor
A new instance of BeExpiredIn.
- #matches?(job) ⇒ Boolean
Constructor Details
#initialize(expected_argument) ⇒ BeExpiredIn
Returns a new instance of BeExpiredIn.
9 10 11 |
# File 'lib/rspec/sidekiq/matchers/be_expired_in.rb', line 9 def initialize(expected_argument) @expected_argument = expected_argument end |
Instance Method Details
#description ⇒ Object
13 14 15 |
# File 'lib/rspec/sidekiq/matchers/be_expired_in.rb', line 13 def description "to expire in #{@expected_argument}" end |
#failure_message ⇒ Object
17 18 19 |
# File 'lib/rspec/sidekiq/matchers/be_expired_in.rb', line 17 def "expected to expire in #{@expected_argument} but expired in #{@actual}" end |
#failure_message_when_negated ⇒ Object
21 22 23 |
# File 'lib/rspec/sidekiq/matchers/be_expired_in.rb', line 21 def "expected to not expire in #{@expected_argument}" end |
#matches?(job) ⇒ Boolean
25 26 27 28 29 |
# File 'lib/rspec/sidekiq/matchers/be_expired_in.rb', line 25 def matches?(job) @klass = job.is_a?(Class) ? job : job.class @actual = @klass.['expires_in'] @actual.to_s == @expected_argument.to_s end |