Sha256: 7913049a9e79104af5d3db8b0d81fe7452f0ff2173823c931caafd6e44608ab0

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

describe GrapeApiary::Blueprint do
  include_context 'configuration'

  context '#generate' do
    before do
      GrapeApiary.config do |config|
        config.host               = host
        config.name               = name
        config.description        = description
        config.resource_exclusion = [:admin]
      end

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

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

    let(:klass) { SampleApi }

    subject { GrapeApiary::Blueprint.new(klass).generate }

    it 'sets the format to 1A' do
      expect(subject).to include('1A')
    end

    it 'sets the host based on configuration' do
      expect(subject).to include("HOST: #{host}")
    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 groups for each resource' do
      expect(subject).to include('# Group Widgets')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
grape-apiary-0.0.2 spec/grape-apiary/blueprint_spec.rb
grape-apiary-0.0.1 spec/grape-apiary/blueprint_spec.rb