Sha256: 7bda4d03f29ad3e17759985083b74e95acd36d68b816754c62e8c4a4580374ce

Contents?: true

Size: 1.3 KB

Versions: 15

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe SwaggerDocsGenerator::Actions::Form, type: :parser,
                                              name: :params_form do
  let(:param_name) { nil }
  let(:param_description) { nil }
  let(:param_required) { nil }
  let(:param) do
    pname = param_name
    pdescription = param_description
    prequired = param_required
    SwaggerDocsGenerator::Actions::Parameter.new do
      form do
        name pname
        description pdescription
        required prequired
      end
    end
  end

  context 'when attribute complete' do
    let(:param_name) { Faker::Color.color_name }
    let(:param_description) { Faker::Beer.name }
    let(:param_required) { Faker::Boolean.boolean }

    it_behaves_like 'parameters form haves'
  end

  context 'when attribute is incomplete' do
    it_behaves_like 'parameters form haves'
  end

  context 'when name attribute alone' do
    let(:param_name) { Faker::Color.color_name }

    it_behaves_like 'parameters form haves'
  end

  context 'when description attribute alone' do
    let(:param_description) { Faker::Beer.name }

    it_behaves_like 'parameters form haves'
  end

  context 'when required attribute alone' do
    let(:param_required) { Faker::Boolean.boolean }

    it_behaves_like 'parameters form haves'
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
swagger_docs_generator-0.5.1 spec/swagger_docs_generator/parser/parameters/param_form_spec.rb
swagger_docs_generator-0.5.0.pre.42 spec/swagger_docs_generator/parser/parameters/param_form_spec.rb
swagger_docs_generator-0.4.0 spec/swagger_docs_generator/parser/parameters/param_form_spec.rb
swagger_docs_generator-0.3.6 spec/swagger_docs_generator/parser/parameters/param_form_spec.rb
swagger_docs_generator-0.3.6.pre.34 spec/swagger_docs_generator/parser/parameters/param_form_spec.rb
swagger_docs_generator-0.3.5 spec/swagger_docs_generator/parser/parameters/param_form_spec.rb
swagger_docs_generator-0.3.5.pre.31 spec/swagger_docs_generator/parser/parameters/param_form_spec.rb
swagger_docs_generator-0.3.4.pre.26 spec/swagger_docs_generator/parser/parameters/param_form_spec.rb
swagger_docs_generator-0.3.4 spec/swagger_docs_generator/parser/parameters/param_form_spec.rb
swagger_docs_generator-0.3.4.pre.23 spec/swagger_docs_generator/parser/parameters/param_form_spec.rb
swagger_docs_generator-0.3.3 spec/swagger_docs_generator/parser/parameters/param_form_spec.rb
swagger_docs_generator-0.3.2 spec/swagger_docs_generator/parser/parameters/param_form_spec.rb
swagger_docs_generator-0.3.1 spec/swagger_docs_generator/parser/parameters/param_form_spec.rb
swagger_docs_generator-0.3.0.pre.19 spec/swagger_docs_generator/parser/parameters/param_form_spec.rb
swagger_docs_generator-0.3.0.pre.18 spec/swagger_docs_generator/parser/parameters/param_form_spec.rb