Sha256: 9ec1f23339942dd2e9346238a7ca8c0ebab522f5ab6fc64dd043051a6793b37f

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'

describe GrapeSlate::Document do
  include_context 'configuration'

  before do
    GrapeSlate.config do |config|
      config.host               = host
      config.name               = name
      config.description        = description
      config.resource_exclusion = [:admin]
      config.include_root       = true
    end

    GrapeSlate.config.request_headers = [
      { 'Accept-Charset' => 'utf-8' },
      { 'Connection'     => 'keep-alive' }
    ]

    GrapeSlate.config.response_headers = [
      { 'Content-Length' => '21685' },
      { 'Connection'     => 'keep-alive' }
    ]
  end

  subject { GrapeSlate::Document.new(SampleApi) }

  context '#generate' do
    let(:klass) { SampleApi }

    subject { GrapeSlate::Document.new(klass).generate }

    it 'sets the title based on name' do
      expect(subject).to include("title: #{name} Reference")
    end

    it 'lists shell as the language type' do
      expect(subject).to include('  - shell')
    end

    it 'creates a header from configuration' do
      expect(subject).to include("# #{name}")
    end

    it 'adds the description' do
      expect(subject).to include(description)
    end

    it 'includes a headline for each resource' do
      expect(subject).to include('# Widgets')
    end

    it 'includes properties for the resources' do
      expect(subject).to include('Properties')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
grape-slate-0.0.3 spec/grape-slate/document_spec.rb
grape-slate-0.0.2 spec/grape-slate/document_spec.rb