Sha256: fdc555cbe2fe7cd9299f3050c1cf39c1d9133cf689b12c5644f036393d05e77e

Contents?: true

Size: 647 Bytes

Versions: 2

Compression:

Stored size: 647 Bytes

Contents

require 'rspec-api/matchers'

module DSL
  module Request
    extend ActiveSupport::Concern

    module ClassMethods
      def should_match_headers_expectations(status_code)
        should_have_json_content_type if has_entity_body? status_code
        should_be_paginated(rspec_api[:page]) if rspec_api[:array] && rspec_api[:page]
      end

    private

      def should_have_json_content_type
        it { expect(response_headers).to have_json_content_type }
      end

      def should_be_paginated(page_parameter)
        it { expect(response_headers).to have_pagination_links(request_params[page_parameter.to_s]) }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec-api-0.1.1 lib/rspec-api/dsl/request/headers.rb
rspec-api-0.1.0 lib/rspec-api/dsl/request/headers.rb