Sha256: 0245de14cd53321b9059f581365633fb480247d52989106c0f02865ca768dd33

Contents?: true

Size: 530 Bytes

Versions: 1

Compression:

Stored size: 530 Bytes

Contents

require_relative 'spec_helper'

describe "matcher_only" do
  describe "when the argument is a matcher" do
    it "delegates to the matcher" do
      expect {
        expect(1).to matcher_only(eq 2)
      }.to fail_matching(/expected: 2.*got: 1/m)
    end
  end

  describe "when the argument is not a matcher" do
    it "raises a syntax error when the matcher is evaluated" do
      expect {
        expect(1).to matcher_only(2)
      }.to raise_error SyntaxError, "expected a matcher as an argument but got: 2"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-change_to_now-1.2.0 spec/rspec/matchers/matcher_only_spec.rb