Top Level Namespace
Defined Under Namespace
Modules: RSpecRayo
Instance Method Summary collapse
- #basic_validation(object, klass, validate_component_id = false) ⇒ Object
- #execution_expired?(event) ⇒ Boolean
- #match_type(object, type) ⇒ Object
- #uuid_match?(uuid, type) ⇒ Boolean
Instance Method Details
#basic_validation(object, klass, validate_component_id = false) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rspec-rayo/rayo/matchers.rb', line 24 def basic_validation(object, klass, validate_component_id = false) execution_expired? object match_type object, klass uuid_match? object.call_id, 'call_id' uuid_match? object.component_id, 'cmd_id' if validate_component_id yield if block_given? object unless @error end |
#execution_expired?(event) ⇒ Boolean
3 4 5 6 7 8 |
# File 'lib/rspec-rayo/rayo/matchers.rb', line 3 def execution_expired?(event) if event == "execution expired" @error = 'event was not delivered to queue before read timeout' raise RSpec::Expectations::ExpectationNotMetError end end |
#match_type(object, type) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/rspec-rayo/rayo/matchers.rb', line 17 def match_type(object, type) unless object.is_a?(type) @error = "expected reason to be #{type}, got #{object}" raise RSpec::Expectations::ExpectationNotMetError end end |
#uuid_match?(uuid, type) ⇒ Boolean
10 11 12 13 14 15 |
# File 'lib/rspec-rayo/rayo/matchers.rb', line 10 def uuid_match?(uuid, type) if uuid.match(/\A[\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12}/).nil? @error = "#{type} == #{uuid} - expected a GUID" raise RSpec::Expectations::ExpectationNotMetError end end |