Sha256: a1cd8403875a8e5d9ded7101ce89fd11c564076fd5b2d54f8eefd51154e848da
Contents?: true
Size: 1007 Bytes
Versions: 5
Compression:
Stored size: 1007 Bytes
Contents
require 'spec_helper' RSpec.describe Pubsubstub::Channel do subject { described_class.new('foobar') } it "has a name" do expect(subject.name).to be == 'foobar' end it "has a scrollback key derived from the name" do expect(subject.scrollback_key).to be == 'foobar.scrollback' end it "has a pubsub key derived from the name" do expect(subject.pubsub_key).to be == 'foobar.pubsub' end describe "#publish" do let(:event) { Pubsubstub::Event.new("refresh #1", id: 1) } it "records the event in the scrollback" do expect { subject.publish(event) }.to change { subject.scrollback(since: 0) }.from([]).to([event]) end end describe "#scrollback" do before do 10.times do |i| subject.publish(Pubsubstub::Event.new("refresh ##{i}", id: i)) end end it "returns the events with an id greater than the `since` parameter" do expect(subject.scrollback(since: 5).map(&:id)).to be == [6, 7, 8, 9] end end end
Version data entries
5 entries across 5 versions & 1 rubygems