Module: RSpecMatchTable

Defined in:
lib/rspec/rspec_match_table.rb

Class Method Summary collapse

Class Method Details

.build_failure_message(expected, actual) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rspec/rspec_match_table.rb', line 9

def build_failure_message(expected, actual)
  message = "expected: \#{expected.inspect}\n   got: \#{actual.inspect}\n  EOS\n\n  diff = RSpec::Expectations.differ.diff(actual.pretty_inspect, expected.pretty_inspect)\n\n  unless diff.strip.empty?\n    diff_label = RSpec::Matchers::ExpectedsForMultipleDiffs::DEFAULT_DIFF_LABEL\n    message << \"\\n\\n\" << diff_label << diff\n  end\n\n  message\nend\n".strip

.check_type(obj) ⇒ Object



2
3
4
5
6
# File 'lib/rspec/rspec_match_table.rb', line 2

def check_type(obj)
  unless obj.is_a?(Array) and obj.all? {|i| i.is_a?(Hash) }
    raise TypeError, "wrong type #{obj.inspect} (expected Array<Hash>)"
  end
end