Sha256: 92e201be960169feae4152d467f8b5764bf8b3397e8b1b66fbf5aec9ac8df11d

Contents?: true

Size: 615 Bytes

Versions: 14

Compression:

Stored size: 615 Bytes

Contents

RSpec::Matchers.define :match_example do |verb, resource, status = 200|
  match do |actual|
    expected_example = RamlParser.find_response_example(verb, resource, status)
    raise "Not found '#{verb.to_s.upcase} #{resource} #{status}' in '#{schema_file}'" unless expected_example

    # NOTE: when empty response, FaradayMiddleware::ParseJson convert to nil
    return true if status == 204 && actual.nil? && expected_example.empty?

    actual == expected_example
  end

  description do
    expected_example = RamlParser.find_response_example(verb, resource, status)
    "match '#{expected_example}'"
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
chatwork-1.0.1 spec/support/matchers/match_example.rb
chatwork-1.0.0 spec/support/matchers/match_example.rb
chatwork-0.12.3 spec/support/matchers/match_example.rb
chatwork-0.12.2 spec/support/matchers/match_example.rb
chatwork-0.12.1 spec/support/matchers/match_example.rb
chatwork-0.12.0 spec/support/matchers/match_example.rb
chatwork-0.11.0 spec/support/matchers/match_example.rb
chatwork-0.10.0 spec/support/matchers/match_example.rb
chatwork-0.9.0 spec/support/matchers/match_example.rb
chatwork-0.8.0 spec/support/matchers/match_example.rb
chatwork-0.7.0 spec/support/matchers/match_example.rb
chatwork-0.6.2 spec/support/matchers/match_example.rb
chatwork-0.6.1 spec/support/matchers/match_example.rb
chatwork-0.6.0 spec/support/matchers/match_example.rb