Sha256: 4ecfd7d778a7b8c2e69f842a64673bb56cbd3169f50bb7f4e00f2ede93224178

Contents?: true

Size: 1.69 KB

Versions: 1

Compression:

Stored size: 1.69 KB

Contents

require 'spec_helper'

describe "QuSpec Matchers" do
  before do
    QuSpec.reset!
  end

  let(:first_name) { 'Morton' }
  let(:last_name) { 'Jonuschat' }

  describe "#have_queued" do
    context "queued with a class" do
      before do
        Qu.enqueue(Person, first_name, last_name)
      end

      subject { Person }

      it { should have_queued(first_name, last_name) }
      it { should_not have_queued(last_name, first_name) }
    end

    context "#in" do

      before do
        Qu.enqueue(Person, first_name, last_name)
      end

      subject { Person }

      context "with #in(queue_name)" do
        it { should have_queued(first_name, last_name).in(:people) }
        it { should_not have_queued(last_name, first_name).in(:people) }
      end
    end
  end

  describe "#have_queue_size_of" do
    context "when nothing is queued" do
      subject { Person }

      it "raises the approrpiate exception" do
        expect do
          should have_queue_size_of(1)
        end.to raise_error(RSpec::Expectations::ExpectationNotMetError)
      end
    end

    context "queued with a class" do
      before do
        Qu.enqueue(Person, first_name, last_name)
      end

      subject { Person }

      it { should have_queue_size_of(1) }
    end
  end

  describe "#in" do
    before do
      Qu.enqueue(Person, first_name, last_name)
    end

    subject { Person }

    context "with #in(queue_name)" do
      it { should have_queue_size_of(1).in(:people) }
      it { should_not have_queue_size_of(1).in(:other_people) }
    end

    context "with #in('queue_name')" do
      it { should have_queue_size_of(1).in('people') }
      it { should_not have_queue_size_of(1).in('other_people') }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
qu-spec-0.1.2 spec/qu-spec/matchers_spec.rb