Sha256: d6e4e9c269f6068841f5423a47f0176264956e024f113ab93baab2123537b4a6

Contents?: true

Size: 1.2 KB

Versions: 9

Compression:

Stored size: 1.2 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 = {
          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]}")
      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]}")
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
apidoco-1.6.1 spec/features/apidoco/documentation_attributes/params_spec.rb
apidoco-1.6.0 spec/features/apidoco/documentation_attributes/params_spec.rb
apidoco-1.5.6 spec/features/apidoco/documentation_attributes/params_spec.rb
apidoco-1.5.5 spec/features/apidoco/documentation_attributes/params_spec.rb
apidoco-1.5.4 spec/features/apidoco/documentation_attributes/params_spec.rb
apidoco-1.5.3 spec/features/apidoco/documentation_attributes/params_spec.rb
apidoco-1.5.2 spec/features/apidoco/documentation_attributes/params_spec.rb
apidoco-1.5.1 spec/features/apidoco/documentation_attributes/params_spec.rb
apidoco-1.5.0 spec/features/apidoco/documentation_attributes/params_spec.rb