Sha256: c72a6e5e97e6b059bdd6267861a59d4410aa32979a3ba4aeb0ee3cf560b75a05

Contents?: true

Size: 1.04 KB

Versions: 15

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'

describe Celluloid::Links do
  subject { Celluloid::Links.new }

  let(:mailbox_mock) do
    Class.new(Array) do
      attr_reader :address
      def initialize address
        @address = address
      end
    end
  end

  let(:first_actor) do
    Struct.new(:mailbox).new(mailbox_mock.new('foo123'))
  end

  let(:second_actor) do
    Struct.new(:mailbox).new(mailbox_mock.new('bar456'))
  end

  it 'is Enumerable' do
    subject.should be_an(Enumerable)
  end

  it 'adds actors by their mailbox address' do
    subject.include?(first_actor).should be_false
    subject << first_actor
    subject.include?(first_actor).should be_true
  end

  it 'removes actors by their mailbox address' do
    subject << first_actor
    subject.include?(first_actor).should be_true
    subject.delete first_actor
    subject.include?(first_actor).should be_false
  end

  it 'iterates over all actors' do
    subject << first_actor
    subject << second_actor
    subject.inject([]) { |all, a| all << a }.should == [first_actor, second_actor]
  end
end

Version data entries

15 entries across 13 versions & 5 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/celluloid-0.16.0/spec/celluloid/links_spec.rb
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/celluloid-0.16.0/spec/celluloid/links_spec.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/celluloid-0.16.0/spec/celluloid/links_spec.rb
scoot-0.0.4 .bundle/gems/ruby/2.2.0/gems/celluloid-0.16.0/spec/celluloid/links_spec.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/celluloid-0.16.0/spec/celluloid/links_spec.rb
celluloid-0.16.0 spec/celluloid/links_spec.rb
celluloid-0.16.0.pre3 spec/celluloid/links_spec.rb
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/gems/celluloid-0.15.2/spec/celluloid/links_spec.rb
celluloid-0.16.0.pre2 spec/celluloid/links_spec.rb
celluloid-0.16.0.pre spec/celluloid/links_spec.rb
celluloid-0.15.2 spec/celluloid/links_spec.rb
celluloid-0.15.1 spec/celluloid/links_spec.rb
celluloid-0.15.0 spec/celluloid/links_spec.rb
celluloid-0.15.0.pre2 spec/celluloid/links_spec.rb
celluloid-0.15.0.pre spec/celluloid/links_spec.rb