Sha256: 78e395a6868cd7f03fdd9661c2b1461486e4ea98abc2fe1bd2320eabc08b281d

Contents?: true

Size: 776 Bytes

Versions: 6

Compression:

Stored size: 776 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)

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
disposable-0.6.3 test/twin/from_collection_test.rb
disposable-0.6.2 test/twin/from_collection_test.rb
disposable-0.6.1 test/twin/from_collection_test.rb
disposable-0.6.0 test/twin/from_collection_test.rb
disposable-0.5.0 test/twin/from_collection_test.rb
disposable-0.4.7 test/twin/from_collection_test.rb