Sha256: 5f63a48c726f02900eed026e587ea802e5aa589ede489281772d8608fe51167d

Contents?: true

Size: 982 Bytes

Versions: 6

Compression:

Stored size: 982 Bytes

Contents

  #encoding:utf-8

require 'spec_helper'

describe WashOut::Type do

  it "defines custom type" do

    class Abraka1 < WashOut::Type
      map :test => :string
    end

    class Abraka2 < WashOut::Type
      type_name 'test'
      map :foo => Abraka1
    end

    expect(Abraka1.wash_out_param_name).to eq 'abraka1'
    expect(Abraka1.wash_out_param_map).to eq({:test => :string})

    expect(Abraka2.wash_out_param_name).to eq 'test'
    expect(Abraka2.wash_out_param_map).to eq({:foo => Abraka1})
  end

  it "allows arrays inside custom types" do
    class Abraka1 < WashOut::Type
      map :test => :string
    end
    class Abraka2 < WashOut::Type
      type_name 'test'
      map :foo => [:bar => Abraka1]
    end

    expect(Abraka1.wash_out_param_name).to eq 'abraka1'
    expect(Abraka1.wash_out_param_map).to eq({:test => :string})

    expect(Abraka2.wash_out_param_name).to eq 'test'
    expect(Abraka2.wash_out_param_map).to eq({:foo => [:bar => Abraka1]})
  end

end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
wash-out-0.10.1 spec/lib/wash_out/type_spec.rb
wash_out-0.12.0 spec/lib/wash_out/type_spec.rb
wash_out-0.11.0 spec/lib/wash_out/type_spec.rb
wash_out-0.11.0.beta.2 spec/lib/wash_out/type_spec.rb
wash_out-0.11.0.beta.1 spec/lib/wash_out/type_spec.rb
wash_out-0.10.0 spec/lib/wash_out/type_spec.rb