<commit_before># encoding: utf-8

require "spec_helper"
require "amq/client/mixins/status"

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

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

    it "should raise ImproperStatusError if given value isn't in the permitted values" do
      lambda { subject.status = :sleepy }.should raise_error(AMQ::Client::StatusMixin::ImproperStatusError)
    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
<commit_msg>Use contexts instead of if ... suffixes in example titles<commit_after># encoding: utf-8

require "spec_helper"
require "amq/client/mixins/status"

describe AMQ::Client::StatusMixin do
  subject do
    Class.new { include AMQ::Client::StatusMixin }.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::StatusMixin::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

{'fraction_non_alphanumeric': 0.07351321585903084, 'fraction_numerical': 0.0005506607929515419, 'mean_word_length': 2.7185261003070624, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2343418', 'n_tokens_mistral': 1120, 'n_tokens_neox': 1038, 'n_words': 410}