Sha256: 83de325aec173719eb56f07cdd06953ccae38663e12928ca60a68db7f85cddd7

Contents?: true

Size: 1015 Bytes

Versions: 10

Compression:

Stored size: 1015 Bytes

Contents

require 'spec_helper'

describe Apipie::Generator::Swagger::ResourceDescriptionComposite do
  let(:dsl_data) { {} }
  let(:resource_id) { 'pets' }
  let(:resource_description) do
    Apipie::ResourceDescription.new(PetsController, resource_id, dsl_data)
  end

  let(:resource_descriptions) { [resource_description] }
  let(:composite) { described_class.new(resource_descriptions, language: :en) }

  describe '#to-swagger' do
    subject { composite.to_swagger }

    it { is_expected.to include(:paths, :tags) }

    describe 'tags' do
      subject(:tag) { composite.to_swagger[:tags].first }

      it { is_expected.to be_blank }

      context 'when resource description has full description' do
        let(:dsl_data) { { description: 'something' } }

        it 'returns the name and description' do
          expect(tag).to eq(
            {
              name: resource_id,
              description: resource_description._full_description
            }
          )
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
apipie-rails-1.4.2 spec/lib/apipie/generator/swagger/resource_description_composite_spec.rb
apipie-rails-1.4.1 spec/lib/apipie/generator/swagger/resource_description_composite_spec.rb
apipie-rails-1.4.0 spec/lib/apipie/generator/swagger/resource_description_composite_spec.rb
apipie-rails-1.3.0 spec/lib/apipie/generator/swagger/resource_description_composite_spec.rb
apipie-rails-1.2.3 spec/lib/apipie/generator/swagger/resource_description_composite_spec.rb
apipie-rails-1.2.2 spec/lib/apipie/generator/swagger/resource_description_composite_spec.rb
apipie-rails-1.2.1 spec/lib/apipie/generator/swagger/resource_description_composite_spec.rb
apipie-rails-1.2.0 spec/lib/apipie/generator/swagger/resource_description_composite_spec.rb
apipie-rails-1.1.0 spec/lib/apipie/generator/swagger/resource_description_composite_spec.rb
apipie-rails-1.0.0 spec/lib/apipie/generator/swagger/resource_description_composite_spec.rb