Sha256: 45da8576a1e458a0cc1d53ecb4e8f0719624c39455b51ea81ae7a39a72f2ef8c

Contents?: true

Size: 744 Bytes

Versions: 23

Compression:

Stored size: 744 Bytes

Contents

require 'test_helper'

class TwinFromCollectionDecoratorTest < MiniTest::Spec
  module Model
    Artist = Struct.new(:id, :name)
  end

  module Twin
    class Artist < Disposable::Twin
      property :id
      property :name
    end
  end

  let (:artist1) { Model::Artist.new(1, "AFI") }
  let (:artist2) { Model::Artist.new(2, "Gary Moore") }
  let (:collection) { [artist1, artist2] }

  describe "from a collection" do
    it do
      twined_collection = Twin::Artist.from_collection(collection)

      twined_collection[0].must_be_instance_of Twin::Artist
      twined_collection[0].model.must_equal artist1
      twined_collection[1].must_be_instance_of Twin::Artist
      twined_collection[1].model.must_equal artist2
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
disposable-0.1.14 test/twin/from_collection_test.rb
disposable-0.1.13 test/twin/from_collection_test.rb
disposable-0.1.12 test/twin/from_collection_test.rb