Sha256: ff5b8726861120d31283c6e3b57c6971e9e7f2b80fe8bb7641e839c9c0c8fd5e

Contents?: true

Size: 461 Bytes

Versions: 7

Compression:

Stored size: 461 Bytes

Contents

# frozen_string_literal: true

RSpec.describe Necromancer::ArrayConverters::ObjectToArrayConverter, '.call' do
  subject(:converter) { described_class.new(:object, :array) }

  it "converts nil to array" do
    expect(converter.call(nil)).to eq([])
  end

  it "converts custom object to array" do
    Custom = Class.new do
      def to_ary
        [:x, :y]
      end
    end
    custom = Custom.new
    expect(converter.call(custom)).to eq([:x, :y])
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
pokedex-terminal-0.2.8 vendor/bundle/ruby/2.7.0/gems/necromancer-0.5.1/spec/unit/converters/array/object_to_array_spec.rb
pokedex-terminal-0.2.7 vendor/bundle/ruby/2.7.0/gems/necromancer-0.5.1/spec/unit/converters/array/object_to_array_spec.rb
pokedex-terminal-0.2.6 vendor/bundle/ruby/2.7.0/gems/necromancer-0.5.1/spec/unit/converters/array/object_to_array_spec.rb
pokedex-terminal-0.2.5 vendor/bundle/ruby/2.7.0/gems/necromancer-0.5.1/spec/unit/converters/array/object_to_array_spec.rb
pokedex-terminal-0.2.4 vendor/bundle/ruby/2.7.0/gems/necromancer-0.5.1/spec/unit/converters/array/object_to_array_spec.rb
necromancer-0.5.1 spec/unit/converters/array/object_to_array_spec.rb
necromancer-0.5.0 spec/unit/converters/array/object_to_array_spec.rb