Sha256: a596e525535ec7f433a845b3c84b20aefac4414a53f7d84349020573429ad767

Contents?: true

Size: 1.74 KB

Versions: 44

Compression:

Stored size: 1.74 KB

Contents

# encoding: utf-8

require "spec_helper"
require "amq/client/openable"

describe AMQ::Client::Openable do
  subject do
    Class.new { include AMQ::Client::Openable }.new
  end

  describe "#status=" do
    context "if it is in the permitted values" do
      it "should be able to store status" do
        lambda { subject.status = :opened }.should_not raise_error
      end
    end

    context "when given value isn't in the permitted values" do
      it "should raise ImproperStatusError" do
        lambda { subject.status = :sleepy }.should raise_error(AMQ::Client::Openable::ImproperStatusError)
      end
    end
  end

  describe "#opened?" do
    it "should be true if the status is :opened" do
      subject.status = :opened
      subject.should be_opened
    end

    it "should be false if the status isn't :opened" do
      subject.status = :opening
      subject.should_not be_opened
    end
  end

  describe "#closed?" do
    it "should be true if the status is :closed" do
      subject.status = :closed
      subject.should be_closed
    end

    it "should be false if the status isn't :closed" do
      subject.status = :closing
      subject.should_not be_closed
    end
  end

  describe "#opening?" do
    it "should be true if the status is :opening" do
      subject.status = :opening
      subject.should be_opening
    end

    it "should be false if the status isn't :opening" do
      subject.status = :opened
      subject.should_not be_opening
    end
  end

  describe "#closing?" do
    it "should be true if the status is :closing" do
      subject.status = :closing
      subject.should be_closing
    end

    it "should be false if the status isn't :closing" do
      subject.status = :opening
      subject.should_not be_closing
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
amq-client-0.9.0 spec/unit/client/mixins/status_spec.rb
amq-client-0.9.0.pre2 spec/unit/client/mixins/status_spec.rb
amq-client-0.9.0.pre1 spec/unit/client/mixins/status_spec.rb
amq-client-0.8.7 spec/unit/client/mixins/status_spec.rb
amq-client-0.8.7.pre1 spec/unit/client/mixins/status_spec.rb
amq-client-0.8.6 spec/unit/client/mixins/status_spec.rb
amq-client-0.8.5 spec/unit/client/mixins/status_spec.rb
amq-client-0.8.4 spec/unit/client/mixins/status_spec.rb
amq-client-0.8.3 spec/unit/client/mixins/status_spec.rb
amq-client-0.8.2 spec/unit/client/mixins/status_spec.rb
amq-client-0.8.1 spec/unit/client/mixins/status_spec.rb
amq-client-0.8.0 spec/unit/client/mixins/status_spec.rb
amq-client-0.7.0.alpha35 spec/unit/client/mixins/status_spec.rb
amq-client-0.7.0.alpha34 spec/unit/client/mixins/status_spec.rb
amq-client-0.7.0.alpha33 spec/unit/client/mixins/status_spec.rb
amq-client-0.7.0.alpha32 spec/unit/client/mixins/status_spec.rb
amq-client-0.7.0.alpha31 spec/unit/client/mixins/status_spec.rb
amq-client-0.7.0.alpha30 spec/unit/client/mixins/status_spec.rb
amq-client-0.7.0.alpha29 spec/unit/client/mixins/status_spec.rb
amq-client-0.7.0.alpha28 spec/unit/client/mixins/status_spec.rb