Class: FIXSpec::Matchers::BeFIXEql

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/fix_spec/matchers/be_fix_eql.rb

Instance Method Summary collapse

Methods included from Helpers

#extract_message_type, #field_map_to_hash, #find_field_name, #find_field_type, #fixify_string, #message_to_hash, #message_to_unordered_json

Constructor Details

#initialize(expected_fix_as_json = nil) ⇒ BeFIXEql

Returns a new instance of BeFIXEql.



6
7
8
# File 'lib/fix_spec/matchers/be_fix_eql.rb', line 6

def initialize(expected_fix_as_json = nil)
  @json_matcher= JsonSpec::Matchers::BeJsonEql.new expected_fix_as_json
end

Instance Method Details

#actualObject



14
15
16
# File 'lib/fix_spec/matchers/be_fix_eql.rb', line 14

def actual
  @json_matcher.actual
end

#at_path(path) ⇒ Object



22
23
24
25
# File 'lib/fix_spec/matchers/be_fix_eql.rb', line 22

def at_path(path)
  @json_matcher.at_path path
  self
end

#descriptionObject



40
41
42
# File 'lib/fix_spec/matchers/be_fix_eql.rb', line 40

def description
  @json_matcher.message_with_path("equal FIX")
end

#diffable?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/fix_spec/matchers/be_fix_eql.rb', line 10

def diffable?
  @json_matcher.diffable?
end

#expectedObject



18
19
20
# File 'lib/fix_spec/matchers/be_fix_eql.rb', line 18

def expected
  @json_matcher.expected
end

#failure_message_for_shouldObject



32
33
34
# File 'lib/fix_spec/matchers/be_fix_eql.rb', line 32

def failure_message_for_should
  @json_matcher.message_with_path("Expected equivalent FIX")
end

#matches?(fix_message) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
30
# File 'lib/fix_spec/matchers/be_fix_eql.rb', line 27

def matches?(fix_message)
  fix_json =  message_to_unordered_json(fix_message)
  @json_matcher.matches? fix_json
end

#negative_failure_messageObject



36
37
38
# File 'lib/fix_spec/matchers/be_fix_eql.rb', line 36

def negative_failure_message
  @json_matcher.message_with_path("Expected inequivalent FIX")
end