Class: RSpec::ActiveJob::Matchers::GlobalID

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/active_job/global_id.rb

Instance Method Summary collapse

Constructor Details

#initialize(expected) ⇒ GlobalID

Returns a new instance of GlobalID.



7
8
9
10
11
12
13
# File 'lib/rspec/active_job/global_id.rb', line 7

def initialize(expected)
  unless valid_expected?(expected)
    raise "expected argument must implement to_global_id"
  end

  @expected = expected
end

Instance Method Details

#===(other) ⇒ Object



15
16
17
18
19
# File 'lib/rspec/active_job/global_id.rb', line 15

def ===(other)
  other.is_a?(Hash) &&
    other.keys == ['_aj_globalid'] &&
    global_id_matches?(other['_aj_globalid'])
end

#descriptionObject



21
22
23
24
# File 'lib/rspec/active_job/global_id.rb', line 21

def description
  "serialized global ID of #{@expected}" unless @expected.is_a?(Class)
  "serialized global ID of #{@expected.name}"
end