Sha256: af8d9363c1cacc040b2d507567370cc9ff595198aa4789999cefff0e404d017b

Contents?: true

Size: 1.65 KB

Versions: 13

Compression:

Stored size: 1.65 KB

Contents

require 'spec_helper'

describe Apipie::Generator::Swagger::ParamDescription::Description do
  let(:param_description_options) { {} }
  let(:http_method) { :GET }
  let(:path) { '/api' }
  let(:validator) { String }
  let(:language) {}

  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(:description_definition) do
    described_class.new(param_description, language: language).to_hash
  end

  describe 'description' do
    subject { description_definition[:description] }

    it { is_expected.to be_blank }

    context 'when desc is given to options' do
      let(:desc) { 'Some description' }
      let(:param_description_options) { { desc: desc } }

      it { is_expected.to eq(desc) }
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
apipie-rails-1.4.2 spec/lib/apipie/generator/swagger/param_description/description_spec.rb
apipie-rails-1.4.1 spec/lib/apipie/generator/swagger/param_description/description_spec.rb
apipie-rails-1.4.0 spec/lib/apipie/generator/swagger/param_description/description_spec.rb
apipie-rails-1.3.0 spec/lib/apipie/generator/swagger/param_description/description_spec.rb
apipie-rails-1.2.3 spec/lib/apipie/generator/swagger/param_description/description_spec.rb
apipie-rails-1.2.2 spec/lib/apipie/generator/swagger/param_description/description_spec.rb
apipie-rails-1.2.1 spec/lib/apipie/generator/swagger/param_description/description_spec.rb
apipie-rails-1.2.0 spec/lib/apipie/generator/swagger/param_description/description_spec.rb
apipie-rails-1.1.0 spec/lib/apipie/generator/swagger/param_description/description_spec.rb
apipie-rails-1.0.0 spec/lib/apipie/generator/swagger/param_description/description_spec.rb
apipie-rails-0.9.4 spec/lib/apipie/generator/swagger/param_description/description_spec.rb
apipie-rails-0.9.3 spec/lib/apipie/generator/swagger/param_description/description_spec.rb
apipie-rails-0.9.2 spec/lib/generator/swagger/param_description/description_spec.rb