Sha256: 365e672c3231b457ba4c2ffcdc3630cccd8dcc452e8aa7cec4efc4c4571404e3
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
require 'spec_helper' module SpecCombos describe AnyMatcher do it 'matches collections with at least one matching element' do expect([2,3,4]).to have_any_that { be_odd } end it 'does not match collections where no element match' do expect([2,4,6]).not_to have_any_that { be_odd } end it "has a straigtforward description" do matcher = have_any_that { be_odd } expect(matcher.description).to eq "have any that #{be_odd.description}" end it 'has an explicit should message' do expect do expect([0,2]).to have_any_that { be_odd } end.to raise_error(RSpec::Expectations::ExpectationNotMetError, "expected [0, 2] to have any that be odd, but none were:\n" + " [0] (0): expected odd? to return true, got false\n" + " [1] (2): expected odd? to return true, got false") end it 'has an explicit should not message' do expect do expect([1,4,6]).not_to have_any_that { be_odd } end.to raise_error(RSpec::Expectations::ExpectationNotMetError, "expected [1, 4, 6] not to have any that be odd, but the following were:\n" + " [0] (1): expected odd? to return false, got true") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spec_combos-0.3.0 | spec/lib/spec_combos/any_matcher_spec.rb |
spec_combos-0.2.0 | spec/lib/spec_combos/any_matcher_spec.rb |