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-1.0.4 spec/unit/client/mixins/status_spec.rb
amq-client-1.0.3 spec/unit/client/mixins/status_spec.rb
amq-client-1.1.0.pre1 spec/unit/client/mixins/status_spec.rb
amq-client-1.0.2 spec/unit/client/mixins/status_spec.rb
amq-client-1.0.1 spec/unit/client/mixins/status_spec.rb
amq-client-1.0.0 spec/unit/client/mixins/status_spec.rb
amq-client-0.9.12 spec/unit/client/mixins/status_spec.rb
amq-client-0.9.11 spec/unit/client/mixins/status_spec.rb
amq-client-0.9.10 spec/unit/client/mixins/status_spec.rb
amq-client-0.9.9 spec/unit/client/mixins/status_spec.rb
amq-client-0.9.8 spec/unit/client/mixins/status_spec.rb
amq-client-0.9.7 spec/unit/client/mixins/status_spec.rb
amq-client-0.9.6 spec/unit/client/mixins/status_spec.rb
amq-client-0.9.5 spec/unit/client/mixins/status_spec.rb
amq-client-0.9.4 spec/unit/client/mixins/status_spec.rb
amq-client-1.0.0.pre2 spec/unit/client/mixins/status_spec.rb
amq-client-0.9.3 spec/unit/client/mixins/status_spec.rb
amq-client-1.0.0.pre1 spec/unit/client/mixins/status_spec.rb
amq-client-0.9.2 spec/unit/client/mixins/status_spec.rb
amq-client-0.9.1 spec/unit/client/mixins/status_spec.rb