Sha256: 56465bbdcb43c4d6e2f60a1a5f380f9e81347ecd7ca8a22c4d0a7a0ae44e96eb

Contents?: true

Size: 883 Bytes

Versions: 10

Compression:

Stored size: 883 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Hyperdrive::Param do
  before do
    @param = default_param
  end

  it "has a name" do
    @param.name.must_equal 'id'
  end

  it "has a description" do
    @param.description.must_equal 'Identifier'
  end

  it "returns an array of HTTP methods it's required for" do
    @param.required.must_equal %w(PUT PATCH DELETE)
  end

  it "returns true if the param is required for the given HTTP method" do
    @param.required?('PUT').must_equal true
  end

  it "returns false if the param is not required for the given HTTP method" do
    @param.required?('POST').must_equal false
  end

  it "converts itself as a hash" do
    constraints = { name: 'id', description: 'Identifier', type: 'String', constraints: 'Required for: PUT, PATCH, DELETE. Must be a valid BSON Object ID.' }
    @param.to_hash.must_equal constraints
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

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