Sha256: b57eb9382f894175f378d3bd7e7d9a52e8913e2d9dc28bf982d8667f3f2b8e69
Contents?: true
Size: 1.69 KB
Versions: 13
Compression:
Stored size: 1.69 KB
Contents
require 'spec_helper' describe Apipie::Generator::Swagger::ParamDescription::Name do let(:validator_options) { {} } let(:param_description_options) { {}.merge(validator_options) } let(:with_null) { false } let(:http_method) { :GET } let(:path) { '/api' } let(:validator) { String } let(:prefixed_by) {} let(:base_dsl_data) do { :api => false, :api_args => [], :api_from_routes => nil, :errors => [], :tag_list => [], :returns => {}, :params => [], :headers => [], :resource_id => nil, :short_description => nil, :description => nil, :examples => [], :see => [], :formats => nil, :api_versions => [], :meta => nil, :show => true, :deprecated => false } end let(:dsl_data) do base_dsl_data.merge({ api_args: [ [ http_method, path, 'description', { deprecated: true } ] ] }) end let(:resource_desc) do Apipie::ResourceDescription.new(UsersController, 'dummy') end let(:method_desc) do Apipie::MethodDescription.new(:show, resource_desc, dsl_data) end let(:param_description) do Apipie::ParamDescription.new( method_desc, :param, validator, param_description_options ) end let(:name_definition) do described_class.new( param_description, prefixed_by: prefixed_by ).to_hash end subject { name_definition[:name] } it { is_expected.to eq(param_description.name) } context 'when prefixed by is given' do let(:prefixed_by) { 'some-prefix' } it { is_expected.to eq("#{prefixed_by}[#{param_description.name}]") } end end
Version data entries
13 entries across 13 versions & 1 rubygems