Sha256: b9353913ddf777a5f4a9578e59ad5aa1948d87c4b955dd8871531c663f641740

Contents?: true

Size: 954 Bytes

Versions: 7

Compression:

Stored size: 954 Bytes

Contents

RSpec.describe :build_parameters_spec do
  link :build_mapper_factory, from: :ree_mapper
  link :build_mapper_strategy, from: :ree_mapper
  link :build_parameters, from: :ree_swagger

  let(:mapper_factory) {
    strategies = [
      build_mapper_strategy(method: :cast, dto: Hash),
    ]

    build_mapper_factory(
      strategies: strategies
    )
  }

  it {
    caster = mapper_factory.call.use(:cast) do
      hash :id do
        string :name
      end
    end

    expect {
      build_parameters(caster, [:id], false)
    }.to raise_error(
      ReeSwagger::BuildParameters::ObjectPathParamError,
      "path parameter(id) can not be an object"
    )
  }

  it {
    caster = mapper_factory.call.use(:cast) do
      array :id, each: string
    end

    expect {
      build_parameters(caster, [:id], false)
    }.to raise_error(
      ReeSwagger::BuildParameters::ArrayPathParamError,
      "path parameter(id) can not be an array"
    )
  }
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ree_lib-1.0.37 lib/ree_lib/packages/ree_swagger/spec/functions/build_parameters_spec.rb
ree_lib-1.0.36 lib/ree_lib/packages/ree_swagger/spec/functions/build_parameters_spec.rb
ree_lib-1.0.35 lib/ree_lib/packages/ree_swagger/spec/functions/build_parameters_spec.rb
ree_lib-1.0.34 lib/ree_lib/packages/ree_swagger/spec/functions/build_parameters_spec.rb
ree_lib-1.0.33 lib/ree_lib/packages/ree_swagger/spec/functions/build_parameters_spec.rb
ree_lib-1.0.32 lib/ree_lib/packages/ree_swagger/spec/functions/build_parameters_spec.rb
ree_lib-1.0.31 lib/ree_lib/packages/ree_swagger/spec/functions/build_parameters_spec.rb