Sha256: a95a25b55e245240a3db4a55d07f508f3a7465f67a42cdb27f00ea93905095fe
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
RSpec.describe Celluloid::Internals::Links do subject { Celluloid::Internals::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 expect(subject).to be_an(Enumerable) end it "adds actors by their mailbox address" do expect(subject.include?(first_actor)).to be_falsey subject << first_actor expect(subject.include?(first_actor)).to be_truthy end it "removes actors by their mailbox address" do subject << first_actor expect(subject.include?(first_actor)).to be_truthy subject.delete first_actor expect(subject.include?(first_actor)).to be_falsey end it "iterates over all actors" do subject << first_actor subject << second_actor expect(subject.inject([]) { |all, a| all << a }).to eq([first_actor, second_actor]) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
celluloid-0.18.0 | spec/celluloid/internals/links_spec.rb |
celluloid-0.18.0.pre2 | spec/celluloid/internals/links_spec.rb |