`_
diff --git a/app/views/apipie/apipies/_method_detail.erb b/app/views/apipie/apipies/_method_detail.erb
index 15767ecc..390a9b65 100644
--- a/app/views/apipie/apipies/_method_detail.erb
+++ b/app/views/apipie/apipies/_method_detail.erb
@@ -55,6 +55,8 @@
<%= render(:partial => "params", :locals => {:params => item[:returns_object]}) %>
+
+ <%= render(:partial => "headers", :locals => {:headers => item[:headers], :h_level => h_level+2 }) %>
<% end %>
<% end %>
diff --git a/app/views/apipie/apipies/_params.html.erb b/app/views/apipie/apipies/_params.html.erb
index 71a20bab..91ea0792 100644
--- a/app/views/apipie/apipies/_params.html.erb
+++ b/app/views/apipie/apipies/_params.html.erb
@@ -15,6 +15,7 @@
<%= param[:required] ? t('apipie.required') : t('apipie.optional') %>
<%= param[:allow_nil] ? ', '+t('apipie.nil_allowed') : '' %>
+ <%= param[:allow_blank] ? ', '+t('apipie.blank_allowed') : '' %>
diff --git a/app/views/apipie/apipies/_params_plain.html.erb b/app/views/apipie/apipies/_params_plain.html.erb
index 00d9aac3..2704ff1b 100644
--- a/app/views/apipie/apipies/_params_plain.html.erb
+++ b/app/views/apipie/apipies/_params_plain.html.erb
@@ -9,6 +9,7 @@
<%= param[:required] ? t('apipie.required') : t('apipie.optional') %>
<%= param[:allow_nil] ? ', '+t('apipie.nil_allowed') : '' %>
+ <%= param[:allow_blank] ? ', '+t('apipie.blank_allowed') : '' %>
<% if param[:validator] %>
[ <%= Apipie.markup_to_html(param[:validator]).html_safe %> ]
<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index f751cffe..91dcc653 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -15,6 +15,7 @@ en:
required: required
optional: optional
nil_allowed: nil allowed
+ blank_allowed: blank allowed
param_name: Param name
params: Params
examples: Examples
diff --git a/config/locales/ko.yml b/config/locales/ko.yml
index f15a70cb..01433c1d 100644
--- a/config/locales/ko.yml
+++ b/config/locales/ko.yml
@@ -15,6 +15,7 @@ ko:
required: 필수
optional: 옵션
nil_allowed: nil 허용
+ blank_allowed: blank 허용
param_name: Param 이름
params: Params
examples: 예시
diff --git a/lib/apipie/application.rb b/lib/apipie/application.rb
index c7867947..898f534f 100644
--- a/lib/apipie/application.rb
+++ b/lib/apipie/application.rb
@@ -89,7 +89,7 @@ def define_method_description(controller, method_name, dsl_data)
# we create separate method description for each version in
# case the method belongs to more versions. We return just one
- # becuase the version doesn't matter for the purpose it's used
+ # because the version doesn't matter for the purpose it's used
# (to wrap the original version with validators)
ret_method_description ||= method_description
resource_description.add_method_description(method_description)
diff --git a/lib/apipie/dsl_definition.rb b/lib/apipie/dsl_definition.rb
index 03cfe496..c41ee02c 100644
--- a/lib/apipie/dsl_definition.rb
+++ b/lib/apipie/dsl_definition.rb
@@ -178,7 +178,7 @@ def desc(description) #:doc:
alias full_description desc
# describe next method with document in given path
- # in convension, these doc located under "#{Rails.root}/doc"
+ # in convention, these doc located under "#{Rails.root}/doc"
# Example:
# document "hello_world.md"
# def hello_world
@@ -452,7 +452,7 @@ module Controller
include Apipie::DSL::Action
include Apipie::DSL::Param
- # defines the substitutions to be made in the API paths deifned
+ # defines the substitutions to be made in the API paths defined
# in concerns included. For example:
#
# There is this method defined in concern:
@@ -472,7 +472,7 @@ module Controller
#
# It has to be specified before the concern is included.
#
- # If not specified, the default predefined substitions are
+ # If not specified, the default predefined substitutions are
#
# {:conroller_path => controller.controller_path,
# :resource_id => `resource_id_from_apipie` }
diff --git a/lib/apipie/extractor/writer.rb b/lib/apipie/extractor/writer.rb
index 4ede1ca8..5affea84 100644
--- a/lib/apipie/extractor/writer.rb
+++ b/lib/apipie/extractor/writer.rb
@@ -324,7 +324,7 @@ def generate_apis_code(apis)
desc ||= case @action.to_s
when "show", "create", "update", "destroy"
name = name.singularize
- "#{@action.capitalize} #{name =~ /^[aeiou]/ ? 'an' : 'a'} #{name}"
+ "#{@action.capitalize} #{/^[aeiou]/.match?(name) ? 'an' : 'a'} #{name}"
when "index"
"List #{name}"
end
@@ -341,7 +341,7 @@ def generate_params_code(params, indent = "")
params.sort_by {|n,_| n }.each do |(name, desc)|
desc[:type] = (desc[:type] && desc[:type].first) || Object
code << "#{indent}param"
- if name =~ /\W/
+ if /\W/.match?(name)
code << " :'#{name}'"
else
code << " :#{name}"
@@ -397,7 +397,7 @@ def lines_above_method
lines_to_add = []
block_level = 0
ensure_line_breaks(controller_content.lines).first(action_line).reverse_each do |line|
- if line =~ /\s*\bend\b\s*/
+ if /\s*\bend\b\s*/.match?(line)
block_level += 1
end
if block_level > 0
@@ -405,10 +405,10 @@ def lines_above_method
else
added_lines << line
end
- if line =~ /\s*\b(module|class|def)\b /
+ if /\s*\b(module|class|def)\b /.match?(line)
break
end
- next unless line =~ /do\s*(\|.*?\|)?\s*$/
+ next unless /do\s*(\|.*?\|)?\s*$/.match?(line)
block_level -= 1
if block_level == 0
added_lines.concat(lines_to_add)
@@ -419,14 +419,14 @@ def lines_above_method
end
# this method would be totally useless unless some clever guy
- # desided that it would be great idea to change a behavior of
+ # decided that it would be great idea to change a behavior of
# "".lines method to not include end of lines.
#
# For more details:
# https://github.com/puppetlabs/puppet/blob/0dc44695/lib/puppet/util/monkey_patches.rb
def ensure_line_breaks(lines)
if lines.to_a.size > 1 && lines.first !~ /\n\Z/
- lines.map { |l| l !~ /\n\Z/ ? (l << "\n") : l }.to_enum
+ lines.map { |l| !/\n\Z/.match?(l) ? (l << "\n") : l }.to_enum
else
lines
end
diff --git a/lib/apipie/generator/swagger/method_description/response_service.rb b/lib/apipie/generator/swagger/method_description/response_service.rb
index 0b7fc7ec..c1d5449f 100644
--- a/lib/apipie/generator/swagger/method_description/response_service.rb
+++ b/lib/apipie/generator/swagger/method_description/response_service.rb
@@ -39,7 +39,8 @@ def responses
allow_null: false,
http_method: @http_method,
controller_method: @method_description
- ).to_swagger
+ ).to_swagger,
+ headers: response_headers(response.headers)
}.compact
end
end
@@ -55,4 +56,16 @@ def empty_returns
{ 200 => { description: 'ok' } }
end
+
+ # @param [Array] headers
+ #
+ # https://swagger.io/specification/v2/#header-object
+ def response_headers(headers)
+ headers.each_with_object({}) do |header, result|
+ result[header[:name].to_s] = {
+ description: header[:description],
+ type: header[:validator]
+ }
+ end
+ end
end
diff --git a/lib/apipie/helpers.rb b/lib/apipie/helpers.rb
index b5227d80..f5d8b054 100644
--- a/lib/apipie/helpers.rb
+++ b/lib/apipie/helpers.rb
@@ -27,7 +27,7 @@ def full_url(path)
end
path = path.sub(%r{^/},"")
ret = "#{@url_prefix}/#{path}"
- ret.insert(0,"/") unless ret =~ %r{\A[./]}
+ ret.insert(0,"/") unless %r{\A[./]}.match?(ret)
ret.sub!(%r{/*\Z},"")
ret
end
diff --git a/lib/apipie/param_description.rb b/lib/apipie/param_description.rb
index ea19ad90..7b917d68 100644
--- a/lib/apipie/param_description.rb
+++ b/lib/apipie/param_description.rb
@@ -245,7 +245,7 @@ def as_action
# makes modification that are based on the action that the param
# is defined for. Typical for required and allow_nil variations in
- # crate/update actions.
+ # create/update actions.
def action_awareness
if action_aware?
if !@options.key?(:allow_nil)
diff --git a/lib/apipie/response_description.rb b/lib/apipie/response_description.rb
index 7c11eea1..fd226bfd 100644
--- a/lib/apipie/response_description.rb
+++ b/lib/apipie/response_description.rb
@@ -6,6 +6,7 @@ class ResponseObject
include Apipie::DSL::Param
attr_accessor :additional_properties, :typename
+ attr_reader :headers
def initialize(method_description, scope, block, typename)
@method_description = method_description
@@ -13,6 +14,7 @@ def initialize(method_description, scope, block, typename)
@param_group = {scope: scope}
@additional_properties = false
@typename = typename
+ @headers = []
self.instance_exec(&block) if block
@@ -43,6 +45,18 @@ def prepare_hash_params
end
end
+ # @param [String] header_name
+ # @param [String, symbol, Class] validator
+ # @param [String] description
+ # @param [Hash] options
+ def header(header_name, validator, description, options = {})
+ @headers << {
+ name: header_name,
+ validator: validator.to_s.downcase,
+ description: description,
+ options: options
+ }
+ end
end
end
@@ -64,15 +78,6 @@ def self.from_dsl_data(method_description, code, args)
adapter)
end
- def is_array?
- @is_array_of != false
- end
-
- def typename
- @response_object.typename
- end
-
-
def initialize(method_description, code, options, scope, block, adapter)
@type_ref = options[:param_group]
@@ -105,6 +110,14 @@ def initialize(method_description, code, options, scope, block, adapter)
@response_object.additional_properties ||= options[:additional_properties]
end
+ def is_array?
+ @is_array_of != false
+ end
+
+ def typename
+ @response_object.typename
+ end
+
def param_description
nil
end
@@ -118,6 +131,17 @@ def additional_properties
end
alias allow_additional_properties additional_properties
+ # @return [Array]
+ def headers
+ # TODO: Support headers for Apipie::ResponseDescriptionAdapter
+ if @response_object.is_a?(Apipie::ResponseDescriptionAdapter)
+ return []
+ end
+
+ @response_object.headers
+ end
+
+ # @return [Hash{Symbol->TrueClass | FalseClass}]
def to_json(lang = nil)
{
:code => code,
@@ -125,6 +149,7 @@ def to_json(lang = nil)
:is_array => is_array?,
:returns_object => params_ordered.map{ |param| param.to_json(lang).tap{|h| h.delete(:validations) }}.flatten,
:additional_properties => additional_properties,
+ :headers => headers
}
end
end
diff --git a/lib/apipie/response_description_adapter.rb b/lib/apipie/response_description_adapter.rb
index 519b0903..f8caaf14 100644
--- a/lib/apipie/response_description_adapter.rb
+++ b/lib/apipie/response_description_adapter.rb
@@ -11,7 +11,7 @@ def self.additional_properties(yesno)
class ResponseDescriptionAdapter
class Modifier
def apply(adapter)
- raise "Modifer subclass must implement 'apply' method"
+ raise "Modifier subclass must implement 'apply' method"
end
end
diff --git a/lib/apipie/routes_formatter.rb b/lib/apipie/routes_formatter.rb
index 64ccf9f4..ebe51552 100644
--- a/lib/apipie/routes_formatter.rb
+++ b/lib/apipie/routes_formatter.rb
@@ -24,7 +24,7 @@ def format_verb(rails_route)
if verb.count != 1
verb = API_METHODS.select{|defined_verb| defined_verb == rails_route.constraints[:method]}
if verb.blank?
- raise "Unknow verb #{rails_route.path.spec.to_s}"
+ raise "Unknown verb #{rails_route.path.spec.to_s}"
end
end
verb.first
diff --git a/lib/apipie/version.rb b/lib/apipie/version.rb
index 9cf09a88..2d251ab3 100644
--- a/lib/apipie/version.rb
+++ b/lib/apipie/version.rb
@@ -1,3 +1,3 @@
module Apipie
- VERSION = "1.3.0".freeze
+ VERSION = "1.4.1".freeze
end
diff --git a/rel-eng/gem_release.ipynb b/rel-eng/gem_release.ipynb
index 1934c5bc..b3cdf191 100644
--- a/rel-eng/gem_release.ipynb
+++ b/rel-eng/gem_release.ipynb
@@ -10,7 +10,7 @@
"- push access to https://github.com/Apipie/apipie-rails\n",
"- push access to rubygems.org for apipie-rails\n",
"- sudo yum install python-slugify asciidoc\n",
- "- ensure neither the `git push` or `gem push` don't require interractive auth. If you can't use api key or ssh key to auth skip these steps and run them form the shell manually\n",
+ "- ensure neither the `git push` or `gem push` don't require interactive auth. If you can't use api key or ssh key to auth skip these steps and run them form the shell manually\n",
"- ensure all checks have passed on the branch you're about to release\n",
"\n",
"### Release process\n",
@@ -117,7 +117,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "### Run tests localy if your setup allows, otherwise ensure the HEAD is green"
+ "### Run tests locally if your setup allows, otherwise ensure the HEAD is green"
]
},
{
@@ -217,14 +217,14 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "#### Manual step: Update deps in the gemspec if neccessary"
+ "#### Manual step: Update deps in the gemspec if necessary"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "### Check what is going to be commited"
+ "### Check what is going to be committed"
]
},
{
@@ -347,7 +347,7 @@
"source": [
"### Some manual steps follow to improve the UX\n",
"\n",
- "#### New relase on GitHub\n",
+ "#### New release on GitHub\n",
"\n",
"Copy the following changelog lines to the description in form on link below\n",
"The release title is the new version."
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb
index f4fff6f4..3ac743d5 100644
--- a/spec/controllers/users_controller_spec.rb
+++ b/spec/controllers/users_controller_spec.rb
@@ -430,7 +430,7 @@ def reload_controllers
expect(b.full_description.length).to be > 400
end
- context "Usign routes.rb" do
+ context "Using routes.rb" do
it "should contain basic info about method" do
a = Apipie[UsersController, :create_route]
expect(a.apis.count).to eq(1)
diff --git a/spec/dummy/app/controllers/api/v2/empty_middle_controller.rb b/spec/dummy/app/controllers/api/v2/empty_middle_controller.rb
index 53ded523..d005f829 100644
--- a/spec/dummy/app/controllers/api/v2/empty_middle_controller.rb
+++ b/spec/dummy/app/controllers/api/v2/empty_middle_controller.rb
@@ -2,7 +2,7 @@ module Api
module V2
class EmptyMiddleController < V2::BaseController
# This is an empty controller, used to test cases where controllers
- # may inherit from a middle controler that does not define a resource_description,
+ # may inherit from a middle controller that does not define a resource_description,
# but the middle controller's parent does.
def inconsequential_method
diff --git a/spec/dummy/app/controllers/pets_controller.rb b/spec/dummy/app/controllers/pets_controller.rb
index 7935215c..fbf5516c 100644
--- a/spec/dummy/app/controllers/pets_controller.rb
+++ b/spec/dummy/app/controllers/pets_controller.rb
@@ -63,7 +63,7 @@ def index
# mixing request/response and response-only parameters
#
# the param_group :pet_with_id has several parameters which are
- # not expectd in the request, but would show up in the response
+ # not expected in the request, but would show up in the response
# and vice versa
#-----------------------------------------------------------
def_param_group :pet_with_id do
diff --git a/spec/dummy/app/controllers/twitter_example_controller.rb b/spec/dummy/app/controllers/twitter_example_controller.rb
index afc2f595..462d81a2 100644
--- a/spec/dummy/app/controllers/twitter_example_controller.rb
+++ b/spec/dummy/app/controllers/twitter_example_controller.rb
@@ -10,7 +10,7 @@ class TwitterExampleController < ApplicationController
api :GET, '/twitter_example/lookup', 'Return up to 100 users worth of extended information, specified by either ID, screen name, or combination of the two.'
param :screen_name, String, :desc => 'A comma separated list of screen names, up to 100 are allowed in a single request. You are strongly encouraged to use a POST for larger (up to 100 screen names) requests.'
param :user_id, Integer, :desc => 'A comma separated list of user IDs, up to 100 are allowed in a single request. You are strongly encouraged to use a POST for larger requests.'
- param :include_entities, String, :desc => 'When set to either true , t or 1 , each tweet will include a node called "entities,". This node offers a variety of metadata about the tweet in a discreet structure, including: user_mentions, urls, and hashtags. While entities are opt-in on timelines at present, they will be made a default component of output in the future. See Tweet Entities for more detail on entities.'
+ param :include_entities, String, :desc => 'When set to either true , t or 1 , each tweet will include a node called "entities,". This node offers a variety of metadata about the tweet in a discrete structure, including: user_mentions, urls, and hashtags. While entities are opt-in on timelines at present, they will be made a default component of output in the future. See Tweet Entities for more detail on entities.'
description <<-EOS
Return up to 100 users worth of extended information, specified by either ID, screen name, or combination of the two. The author's most recent status (if the authenticating user has permission) will be returned inline.
@@ -53,8 +53,8 @@ def profile_image
api :GET, '/twitter_example/search', 'Runs a search for users similar to Find People button on Twitter.com.'
param :q, String, :desc => 'The search query to run against people search.', :required => true
param :page, Integer, :desc => 'Specifies the page of results to retrieve.'
- param :per_page, Integer, :desc => 'The number of people to retrieve. Maxiumum of 20 allowed per page.'
- param :include_entities, String, :desc => 'When set to either true, t or 1, each tweet will include a node called "entities,". This node offers a variety of metadata about the tweet in a discreet structure, including: user_mentions, urls, and hashtags. While entities are opt-in on timelines at present, they will be made a default component of output in the future. See Tweet Entities for more detail on entities.'
+ param :per_page, Integer, :desc => 'The number of people to retrieve. Maximum of 20 allowed per page.'
+ param :include_entities, String, :desc => 'When set to either true, t or 1, each tweet will include a node called "entities,". This node offers a variety of metadata about the tweet in a discrete structure, including: user_mentions, urls, and hashtags. While entities are opt-in on timelines at present, they will be made a default component of output in the future. See Tweet Entities for more detail on entities.'
description <<-EOS
Runs a search for users similar to Find People button on Twitter.com. The results returned by people search on Twitter.com are the same as those returned by this API request. Note that unlike GET search, this method does not support any operators.
diff --git a/spec/lib/apipie/apipies_controller_spec.rb b/spec/lib/apipie/apipies_controller_spec.rb
index 90a497c9..47434c91 100644
--- a/spec/lib/apipie/apipies_controller_spec.rb
+++ b/spec/lib/apipie/apipies_controller_spec.rb
@@ -188,7 +188,7 @@
describe "authenticate user" do
- it "authenticate user if an authentication method is setted" do
+ it "authenticate user if an authentication method is set" do
test = false
Apipie.configuration.authenticate = Proc.new do
test = true
diff --git a/spec/lib/apipie/file_handler_spec.rb b/spec/lib/apipie/file_handler_spec.rb
index bd9e649f..274c1cc8 100644
--- a/spec/lib/apipie/file_handler_spec.rb
+++ b/spec/lib/apipie/file_handler_spec.rb
@@ -15,7 +15,7 @@
it { expect { file_handler.match? path }.to_not raise_error }
end
- context 'when the path contans an invalid byte sequence in UTF-8' do
+ context 'when the path contains an invalid byte sequence in UTF-8' do
let(:path) { "%B6" }
it { expect(file_handler.match? path).to be_falsy }
diff --git a/spec/lib/apipie/generator/swagger/method_description/response_service_spec.rb b/spec/lib/apipie/generator/swagger/method_description/response_service_spec.rb
new file mode 100644
index 00000000..71adc015
--- /dev/null
+++ b/spec/lib/apipie/generator/swagger/method_description/response_service_spec.rb
@@ -0,0 +1,62 @@
+require 'spec_helper'
+
+describe Apipie::Generator::Swagger::MethodDescription::ResponseService do
+ let(:http_method) { nil }
+ let(:language) { :en }
+ let(:dsl_data) { ActionController::Base.send(:_apipie_dsl_data_init) }
+
+ let(:method_description) do
+ Apipie::Generator::Swagger::MethodDescription::Decorator.new(
+ Apipie::MethodDescription.new(
+ 'create',
+ Apipie::ResourceDescription.new(ApplicationController, 'pets'),
+ dsl_data
+ )
+ )
+ end
+
+ let(:returns) { [] }
+
+ let(:service) do
+ described_class.new(
+ method_description,
+ http_method: http_method,
+ language: language
+ )
+ end
+
+ describe '#call' do
+ describe 'headers' do
+ subject(:headers) { service.call[status_code][:headers] }
+
+ let(:status_code) { 200 }
+
+ it { is_expected.to be_blank }
+
+ context 'when headers exists' do
+ let(:dsl_data) { super().merge({ returns: returns }) }
+ let(:returns) { { status_code => [{}, nil, returns_dsl, nil] } }
+
+ let(:returns_dsl) do
+ proc do
+ header 'link', String, 'Relative links'
+ header 'Current-Page', Integer, 'The current page'
+ end
+ end
+
+ it 'returns the correct format headers' do
+ expect(headers).to eq({
+ 'link' => {
+ description: 'Relative links',
+ type: 'string'
+ },
+ 'Current-Page' => {
+ description: 'The current page',
+ type: 'integer'
+ }
+ })
+ end
+ end
+ end
+ end
+end
diff --git a/spec/lib/apipie/param_description_spec.rb b/spec/lib/apipie/param_description_spec.rb
index f9aef925..096caf63 100644
--- a/spec/lib/apipie/param_description_spec.rb
+++ b/spec/lib/apipie/param_description_spec.rb
@@ -21,7 +21,7 @@
it "should return the metadata" do
meta = {
- :lenght => 32,
+ :length => 32,
:weight => '830g'
}
param = Apipie::ParamDescription.new(method_desc, :some_param, String, :meta => meta)
diff --git a/spec/lib/apipie/response_description/response_object_spec.rb b/spec/lib/apipie/response_description/response_object_spec.rb
new file mode 100644
index 00000000..47adf3be
--- /dev/null
+++ b/spec/lib/apipie/response_description/response_object_spec.rb
@@ -0,0 +1,22 @@
+require 'spec_helper'
+
+describe Apipie::ResponseDescription::ResponseObject do
+ describe '#header' do
+ let(:response_object) { described_class.new(nil, nil, nil, nil) }
+ let(:name) { 'Current-Page' }
+ let(:description) { 'The current page in the pagination' }
+
+ before { response_object.header(name, String, description) }
+
+ it 'adds it to the headers' do
+ expect(response_object.headers).to(
+ contain_exactly({
+ name: name,
+ description: description,
+ validator: 'string',
+ options: {}
+ })
+ )
+ end
+ end
+end
diff --git a/spec/lib/apipie/response_description_spec.rb b/spec/lib/apipie/response_description_spec.rb
new file mode 100644
index 00000000..f9f0fb2e
--- /dev/null
+++ b/spec/lib/apipie/response_description_spec.rb
@@ -0,0 +1,56 @@
+require 'spec_helper'
+
+describe Apipie::ResponseDescription do
+ let(:resource_description) do
+ Apipie::ResourceDescription.new(PetsController, 'pets')
+ end
+
+ let(:method_description) do
+ Apipie::MethodDescription.new(
+ 'create',
+ resource_description,
+ ActionController::Base.send(:_apipie_dsl_data_init)
+ )
+ end
+
+ let(:response_description_dsl) { proc {} }
+ let(:options) { {} }
+
+ let(:response_description) do
+ described_class.new(
+ method_description,
+ 204,
+ options,
+ PetsController,
+ response_description_dsl,
+ nil
+ )
+ end
+
+ describe '#to_json' do
+ let(:to_json) { response_description.to_json }
+
+ describe 'headers' do
+ subject(:headers) { to_json[:headers] }
+
+ it { is_expected.to be_blank }
+
+ context 'when response has headers' do
+ let(:response_description_dsl) do
+ proc do
+ header 'Current-Page', Integer, 'The current page in the pagination', required: true
+ end
+ end
+
+ it 'returns the header' do
+ expect(headers).to contain_exactly({
+ name: 'Current-Page',
+ description: 'The current page in the pagination',
+ validator: 'integer',
+ options: { required: true }
+ })
+ end
+ end
+ end
+ end
+end
|