Created
January 6, 2014 20:07
-
-
Save ThijsWouters/8288990 to your computer and use it in GitHub Desktop.
Descriptions of matchers with an array of strings.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rspec' | |
describe 'Matcher description' do | |
it 'returns the correct description' do | |
[ | |
[be(['foo']), 'equal "foo"'], | |
[be_a(['foo']), 'be a kind of "foo"'], | |
[be_an_instance_of(['foo']), 'be an instance of ["foo"]'], | |
[be_within(['foo']), 'be within ["foo"] of '], | |
[contain_exactly(['foo']), 'contain exactly ["foo"]'], | |
[cover(['foo']), 'cover ["foo"]'], | |
[end_with(['foo']), 'end with "foo"'], | |
[eq(['foo']), 'eq ["foo"]'], | |
[eql(['foo']), 'eql "foo"'], | |
[equal(['foo']), 'equal "foo"'], | |
[exist(['foo']), 'exist ["foo"]'], | |
[include(['foo']), 'include ["foo"]'], | |
[match(['foo']), 'match ["foo"]'], | |
[match_array(['foo']), 'contain exactly "foo"'], | |
[raise_error(['foo']), 'raise ["foo"]'], | |
[respond_to(['foo']), 'respond to #["foo"]'], | |
[start_with(['foo']), 'start with "foo"'], | |
[throw_symbol(['foo']), 'throw ["foo"]'], | |
[yield_with_args(['foo']), 'yield with args(["foo"])'], | |
[yield_successive_args(['foo']), 'yield successive args(["foo"])'], | |
[yield_with_args(['foo']), 'yield with args(["foo"])'], | |
].each do |matcher, expected_description| | |
expect(matcher.description).to eq(expected_description) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment