Module: Vigia::Sail::Examples::Default

Defined in:
lib/vigia/sail/examples/default.rb

Class Method Summary collapse

Class Method Details

.load!Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/vigia/sail/examples/default.rb', line 7

def load!
  Vigia::Sail::Example.register(
    :code_match,
    description: 'has the expected HTTP code',
    expectation: -> {
      if expectations.code.is_a?(Range)
        expect(expectations.code.member?(result.code)).to be true
      else
        expect(result.code).to be(expectations.code)
      end
    }
  )

  Vigia::Sail::Example.register(
    :include_headers,
    description: 'includes the expected headers',
    expectation: -> { expect(result.headers).to include(expectations.headers) }
  )
end