Sha256: 6bfd1a2f22e8edc45d93b8ef1b1083c986f09b4653405d58ca4bf71691da804d

Contents?: true

Size: 1.26 KB

Versions: 12

Compression:

Stored size: 1.26 KB

Contents

require "pact_broker/config/space_delimited_integer_list"

module PactBroker
  module Config
    describe SpaceDelimitedIntegerList do
      describe "parse" do
        subject { SpaceDelimitedIntegerList.parse(input) }

        context "when input is ''" do
          let(:input) { "" }

          it { is_expected.to eq [] }
          it { is_expected.to be_a SpaceDelimitedIntegerList }

          its(:to_s) { is_expected.to eq input }
        end

        context "when input is 'off'" do
          let(:input) { "off" }

          it { is_expected.to eq [] }
          it { is_expected.to be_a SpaceDelimitedIntegerList }

          its(:to_s) { is_expected.to eq "" }
        end

        context "when input is '0 1 1 2 3 5 8 13 21 34'" do
          let(:input) { "0 1 1 2 3 5 8 13 21 34" }

          it { is_expected.to eq [0, 1, 1, 2, 3, 5, 8, 13, 21, 34] }
          it { is_expected.to be_a SpaceDelimitedIntegerList }

          its(:to_s) { is_expected.to eq input }
        end

        context "when input is '13 17 foo 19'" do
          let(:input) { "13 17 foo 19" }

          it { is_expected.to eq [13, 17, 19] }
          it { is_expected.to be_a SpaceDelimitedIntegerList }

          its(:to_s) { is_expected.to eq "13 17 19" }
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pact_broker-2.89.1 spec/lib/pact_broker/config/space_delimited_integer_list_spec.rb
pact_broker-2.89.0 spec/lib/pact_broker/config/space_delimited_integer_list_spec.rb
pact_broker-2.88.0 spec/lib/pact_broker/config/space_delimited_integer_list_spec.rb
pact_broker-2.87.0 spec/lib/pact_broker/config/space_delimited_integer_list_spec.rb
pact_broker-2.86.0 spec/lib/pact_broker/config/space_delimited_integer_list_spec.rb
pact_broker-2.85.1 spec/lib/pact_broker/config/space_delimited_integer_list_spec.rb
pact_broker-2.85.0 spec/lib/pact_broker/config/space_delimited_integer_list_spec.rb
pact_broker-2.84.0 spec/lib/pact_broker/config/space_delimited_integer_list_spec.rb
pact_broker-2.83.0 spec/lib/pact_broker/config/space_delimited_integer_list_spec.rb
pact_broker-2.82.0 spec/lib/pact_broker/config/space_delimited_integer_list_spec.rb
pact_broker-2.81.0 spec/lib/pact_broker/config/space_delimited_integer_list_spec.rb
pact_broker-2.80.0 spec/lib/pact_broker/config/space_delimited_integer_list_spec.rb