Sha256: fbb0038d8619d319428709259bbe8f30145c4533024467bd7d34ed12bfa5cc72

Contents?: true

Size: 1.27 KB

Versions: 3

Compression:

Stored size: 1.27 KB

Contents

require 'rails_helper'

RSpec.feature 'Document Attributes', type: :feature do
  describe 'params', js: true do
    context 'when required is true' do
      it 'will list the documentation' do
        create_json = {
          name: 'Create Currency',
          end_point: '/currencies',
          published: true,
          params: [{
            key: "currency['name']",
            required: true,
            type: "String"
          }]
        }
        DocumentationBuilder.create(create_json)

        visit '/apidoco'
        param = create_json[:params][0]
        expect(page).to have_text(param[:key])
        expect(page).to have_text("REQUIRED")
        expect(page).to have_text(param[:type].downcase)
      end
    end

    context 'when required is false' do
      it 'will list the documentation' do
        create_json = {
          published: true,
          params: [{
            key: "currency['name']",
            required: false,
            type: "String"
          }]
        }
        DocumentationBuilder.create(create_json)

        visit '/apidoco'
        param = create_json[:params][0]
        expect(page).to have_text(param[:key])
        expect(page).to have_text("OPTIONAL")
        expect(page).to have_text(param[:type].downcase)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
apidoco-1.6.4 spec/features/apidoco/documentation_attributes/params_spec.rb
apidoco-1.6.3 spec/features/apidoco/documentation_attributes/params_spec.rb
apidoco-1.6.2 spec/features/apidoco/documentation_attributes/params_spec.rb