Sha256: 2d6f227ee9563c6cb4af3878b17809b1230991d1b107201a3739843d23256a2b

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

describe GrapeApiary::Config do
  include_context 'configuration'

  subject { GrapeApiary::Config }

  it 'allows for host to be set' do
    subject.host = host

    expect(subject.host).to eq(host)
  end

  it 'allows for name to be set' do
    subject.name = name

    expect(subject.name).to eq(name)
  end

  it 'allows for description to be set' do
    subject.description = description

    expect(subject.description).to eq(description)
  end

  context 'headers' do
    [:request_headers, :response_headers].each do |type|
      context type do
        it 'is an array' do
          expect(subject.send(type)).to be_a(Array)
        end

        it 'allows for request headers to be set in bulk' do
          headers = send(type)

          subject.send("#{type}=", headers)

          expect(subject.send(type)).to eq(headers)
        end

        it 'allows for request headers to be set individually' do
          header = { Host: 'api.connexiolabs-qa.com' }

          expect do
            subject.send(type) << header
          end.to change { subject.send(type).length }.by(1)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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