Last active
August 3, 2022 14:31
-
-
Save ahmad19/cb9ee0f859499d7a00bafd8a4e0309dc to your computer and use it in GitHub Desktop.
RSpec matchers cheatsheet
This file contains hidden or 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
# To match only few attributes of an object | |
# have_attributes | |
expect(person).to have_attributes(:name => "Jim", :age => 32) | |
# To match attributes of a collection | |
expect(notes) | |
.to match_array([ | |
have_attributes( | |
notable_id: talent.id, | |
title: 'resume.pdf' | |
), | |
have_attributes( | |
notable_id: talent.id, | |
title: 'company_prospects.xlsx' | |
) | |
]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment