Sha256: f39bf9aa6f4390bb4597ddd5956e187bab68d4e8a5344f9a4325c4513cd71a61

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

RSpec.describe RSpeed::Splitter, '#need_warm?' 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.need_warm?).to be(false) }
    end

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

      it { expect(splitter.need_warm?).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.need_warm?).to be(false) }
    end

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

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