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.124 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.123 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.122 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.121 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.120 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.119 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.118 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.117 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.116 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.115 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.114 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.113 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.112 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.111 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.110 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.109 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.108 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.107 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.106 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb
ree_lib-1.0.105 lib/ree_lib/packages/ree_swagger/spec/functions/build_request_body_spec.rb