Module: RSpecApi::DSL::Responses
- Includes:
- Expectations::Resourceful
- Defined in:
- lib/rspec-api/dsl/responses.rb
Instance Method Summary collapse
Instance Method Details
#expect_custom(response, route_params, &block) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/rspec-api/dsl/responses.rb', line 29 def expect_custom(response, route_params, &block) context 'matches custom expectations' do # THE ONLY MISSING THING: it { instance_exec response, route_params, &block } end end |
#respond_with(*args, &block) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rspec-api/dsl/responses.rb', line 8 def respond_with(*args, &block) if args.first.is_a?(Hash) more_status_expect = args.first more_headers_expect = {} more_body_expect = {} elsif args.first.is_a?(Array) more_status_expect, more_headers_expect, more_body_expect = args else more_status_expect = {status: args.first} more_headers_expect = {} more_body_expect = {} end all_expectations = @status_expect.merge(more_status_expect).merge( @headers_expect).merge(more_headers_expect).merge(@body_expect). merge(more_body_expect) expect_resourceful(@response, all_expectations) expect_custom(@response, @route_params, &block) if block_given? end |