Sha256: 6d979fde9aa431ad8e402c3c63be405fd1bc4cc9ce64e5ff2ff5f9378eb4aff1

Contents?: true

Size: 1.24 KB

Versions: 3

Compression:

Stored size: 1.24 KB

Contents

require_relative 'spec_helper'

describe Xcode::Registry do

  def self.is_identifier? value
    value =~ /^[0-9A-F]{24,}$/
  end

  describe "ClassMethods" do
    subject { described_class }

    describe "#is_identifier?" do
      context "when the value is valid hexadecimal 24 character length string" do
        context "when it is all uppercase" do
          let(:input) { "0123456789ABCDEF01234567" }

          it "should be an identifier" do
            subject.is_identifier?(input).should be_true
          end
        end

        context "when it uses lowercase characters" do
          let(:input) { "0123456789abcdef01234567" }

          it "should be an identifier" do
            subject.is_identifier?(input).should be_true
          end
        end
      end

      context "when the value is less than 24 characters" do
        let(:input) { "0123456789ABCDEF" }

        it "should not be an identifier" do
          subject.is_identifier?(input).should be_false
        end
      end

      context "when it contains other than hexadecimal characters" do
        let(:input) { "0123456789ABCDEFGHIJKLMNO" }

        it "should not be an identifier" do
          subject.is_identifier?(input).should be_false
        end
      end

    end
  end


end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
xcoder-0.1.18 spec/registry_spec.rb
xcoder-0.1.15 spec/registry_spec.rb
xcoder-0.1.14 spec/registry_spec.rb