Class: Flow::CustomMatchers::HaveOnState

Inherits:
Object
  • Object
show all
Includes:
RSpec::Matchers
Defined in:
lib/flow/spec_helper/custom_matchers/have_on_state.rb

Instance Method Summary collapse

Constructor Details

#initialize(state_expectations) ⇒ HaveOnState



41
42
43
# File 'lib/flow/spec_helper/custom_matchers/have_on_state.rb', line 41

def initialize(state_expectations)
  @state_expectations = state_expectations
end

Instance Method Details

#descriptionObject



51
52
53
# File 'lib/flow/spec_helper/custom_matchers/have_on_state.rb', line 51

def description
  "have the expected data on state"
end

#matches?(object) ⇒ Boolean



45
46
47
48
49
# File 'lib/flow/spec_helper/custom_matchers/have_on_state.rb', line 45

def matches?(object)
  @state_expectations.all? do |key, value|
    expect(object.state.public_send(key)).to match value
  end
end