Sha256: 4a32319c8027dc8180881439d41c1e993c4b69f7eb61a433018962e0b898df90

Contents?: true

Size: 1.15 KB

Versions: 10

Compression:

Stored size: 1.15 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Hyperdrive::DSL do
  before do
    hyperdrive do
      name 'Example'
      description 'Example Description'
      vendor 'example'
      media_types %w(json)
      cors({ origins: '*', allow_headers: %w(Accept), test: 'test'})
      resource(:thing) {}
    end
  end

  after do
    hyperdrive.send(:reset!)
  end

  it "has a name" do
    hyperdrive.config[:name].must_equal 'Example'
  end

  it "has a description" do
    hyperdrive.config[:description].must_equal 'Example Description'
  end

  it "has a vendor" do
    hyperdrive.config[:vendor].must_equal 'example'
  end

  it "has media types" do
    hyperdrive.config[:media_types].must_equal ['json']
  end

  it "registers a resource" do
    hyperdrive.resources[:thing].must_be_instance_of ::Hyperdrive::Resource
  end

  it "can configure cors options" do
    hyperdrive.config[:cors][:allow_headers].must_equal ['Accept']
  end

  it "ensures missing options have default values" do
    hyperdrive.config[:cors][:credentials].must_equal 'false'
  end

  it "removes unsupported cors options" do
    hyperdrive.config[:cors].key?(:test).must_equal false
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
hyperdrive-0.0.15 spec/hyperdrive/dsl_spec.rb
hyperdrive-0.0.14 spec/hyperdrive/dsl_spec.rb
hyperdrive-0.0.13 spec/hyperdrive/dsl_spec.rb
hyperdrive-0.0.12 spec/hyperdrive/dsl_spec.rb
hyperdrive-0.0.11 spec/hyperdrive/dsl_spec.rb
hyperdrive-0.0.10 spec/hyperdrive/dsl_spec.rb
hyperdrive-0.0.9 spec/hyperdrive/dsl_spec.rb
hyperdrive-0.0.8 spec/hyperdrive/dsl_spec.rb
hyperdrive-0.0.7 spec/hyperdrive/dsl_spec.rb
hyperdrive-0.0.6 spec/hyperdrive/dsl_spec.rb