Sha256: 534252734c37a4949733676b8de2bc4295e80eb406ae1f7cb12dc77be3811d10

Contents?: true

Size: 1.08 KB

Versions: 7

Compression:

Stored size: 1.08 KB

Contents

require "spec_helper"

describe ElabsMatchers::Matchers::OnlyInclude do
  subject { %w[foo bar] }

  describe "#only_include" do
    it "returns true when all the elements are passed in the wrong order" do
      should only_include("bar", "foo")
      expect { should only_include("quox", "foo") }.to fail_assertion
    end

    it "returns false when given a present element several times" do
      should_not only_include("foo", "foo")
      expect { should only_include("foo", "foo") }.to fail_assertion
    end

    it "returns true when all the elements are passed in the correct order" do
      should only_include("foo", "bar")
      expect { should only_include("quox", "baz") }.to fail_assertion
    end

    it "returns false when one or more element is missing" do
      should_not only_include("foo")
      expect { should_not only_include("bar", "foo") }.to fail_assertion
    end

    it "returns false when one of the element is not in the list" do
      should_not only_include("foo", "bar", "baz")
      expect { should_not only_include("foo", "bar") }.to fail_assertion
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
elabs_matchers-2.0.0 spec/elabs_matchers/matchers/only_include_spec.rb
elabs_matchers-1.0.1 spec/elabs_matchers/matchers/only_include_spec.rb
elabs_matchers-1.0.0 spec/elabs_matchers/matchers/only_include_spec.rb
elabs_matchers-0.0.7 spec/elabs_matchers/matchers/only_include_spec.rb
elabs_matchers-0.0.6 spec/elabs_matchers/matchers/only_include_spec.rb
elabs_matchers-0.0.5 spec/elabs_matchers/matchers/only_include_spec.rb
elabs_matchers-0.0.4 spec/elabs_matchers/matchers/only_include_spec.rb