Sha256: f4b9ce643b7f5780ab630e328b34d1567a3b740dcff996c166bd45cb1f811ca2

Contents?: true

Size: 1.2 KB

Versions: 9

Compression:

Stored size: 1.2 KB

Contents

module RSpec
  module Mocks
    module ArgumentMatchers
      RSpec.describe ArrayIncludingMatcher do
        it "describes itself properly" do
          expect(ArrayIncludingMatcher.new([1, 2, 3]).description).to eq "array_including(1, 2, 3)"
        end

        context "passing" do
          it "matches the same array" do
            expect(array_including(1, 2, 3)).to be === [1, 2, 3]
          end

          it "matches the same array,  specified without square brackets" do
            expect(array_including(1, 2, 3)).to be === [1, 2, 3]
          end

          it "matches the same array,  which includes nested arrays" do
            expect(array_including([1, 2], 3, 4)).to be === [[1, 2], 3, 4]
          end

          it "works with duplicates in expected" do
            expect(array_including(1, 1, 2, 3)).to be === [1, 2, 3]
          end

          it "works with duplicates in actual" do
            expect(array_including(1, 2, 3)).to be === [1, 1, 2, 3]
          end
        end

        context "failing" do
          it "fails when not all the entries in the expected are present" do
            expect(array_including(1,2,3,4,5)).not_to be === [1,2]
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
opal-rspec-0.6.2 rspec-mocks/spec/rspec/mocks/array_including_matcher_spec.rb
opal-rspec-0.6.1 rspec-mocks/spec/rspec/mocks/array_including_matcher_spec.rb
opal-rspec-0.6.0 rspec-mocks/spec/rspec/mocks/array_including_matcher_spec.rb
opal-rspec-0.6.0.beta1 rspec-mocks/spec/rspec/mocks/array_including_matcher_spec.rb
opal-connect-rspec-0.5.0 rspec-mocks/spec/rspec/mocks/array_including_matcher_spec.rb
opal-rspec-0.5.0 rspec-mocks/spec/rspec/mocks/array_including_matcher_spec.rb
opal-rspec-0.5.0.beta3 rspec-mocks/spec/rspec/mocks/array_including_matcher_spec.rb
opal-rspec-0.5.0.beta2 rspec-mocks/spec/rspec/mocks/array_including_matcher_spec.rb
opal-rspec-0.5.0.beta1 rspec-mocks/spec/rspec/mocks/array_including_matcher_spec.rb