Sha256: 0139dd2078758c8104eb1e04ba508d89ae69416799d4225103b0f60268304134

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

RSpec.describe RSpeed::Splitter, '#append?' do
  subject(:splitter) { described_class.new }

  context 'when has no result' do
    before { allow(RSpeed::Redis).to receive(:result?).and_return(false) }

    context 'when is not the first pipe' do
      before { allow(splitter).to receive(:first_pipe?).and_return(false) }

      it { expect(splitter.append?).to be(false) }
    end

    context 'when is the first pipe' do
      before { allow(splitter).to receive(:first_pipe?).and_return(true) }

      it { expect(splitter.append?).to be(true) }
    end
  end

  context 'when has result' do
    before { allow(RSpeed::Redis).to receive(:result?).and_return(true) }

    context 'when is not the first pipe' do
      before { allow(splitter).to receive(:first_pipe?).and_return(false) }

      it { expect(splitter.append?).to be(true) }
    end

    context 'when is the first pipe' do
      before { allow(splitter).to receive(:first_pipe?).and_return(true) }

      it { expect(splitter.append?).to be(true) }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspeed-0.5.2 spec/models/rspeed/splitter/append_question_spec.rb
rspeed-0.5.1 spec/models/rspeed/splitter/append_question_spec.rb