Sha256: b867f13a9d443acb7123bab0e5426b7cd0a3ad8c10017c1938eab417b579f55f

Contents?: true

Size: 842 Bytes

Versions: 75

Compression:

Stored size: 842 Bytes

Contents

RSpec.describe :build_request_body_schema_spec do
  link :build_mapper_factory, from: :ree_mapper
  link :build_mapper_strategy, from: :ree_mapper
  link :build_request_body_schema, from: :ree_swagger

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

    build_mapper_factory(
      strategies: strategies
    )
  }

  it {
    caster = mapper_factory.call(register_as: :user).use(:cast) do
      string :name
      string :email
      string? :last_name
      user :friend
    end

    schema = {
      type: "object",
      properties: {
        name: { type: "string" },
        email: { type: "string" },
        last_name: { type: "string" },
        friend: {}
      },
      required: ["name", "email"]
    }

    expect(build_request_body_schema(caster)).to eq(schema)
  }
end

Version data entries

75 entries across 75 versions & 1 rubygems

Version Path
ree_lib-1.0.64 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.63 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.62 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.61 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.60 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.59 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.58 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.57 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.56 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.55 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.54 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.53 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.52 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.51 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.50 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb