https://github.com/ndp/assert_fixtures
https://github.com/ndp/assert_fixtures
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ndp/assert_fixtures
- Owner: ndp
- Created: 2015-04-25T21:10:46.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-04-25T21:11:45.000Z (about 11 years ago)
- Last Synced: 2025-07-01T16:58:01.565Z (12 months ago)
- Language: Ruby
- Size: 97.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.textile
Awesome Lists containing this project
README
h1. Assert Fixtures Test Helpers
Convenience methods to assert that you ended with with specific fixture data.
This solves the problem where you end up with a list of objects and want to
make sure they correspond to certain fixtures. This generally involves looping
through them and using map() and making sure each one matches. If you don't
care about the order, you end up having to sort in some way first so that you
can traverse reasonably. It's not awful, but it'a cumbersome.
h2. Fixture Helpers
This uses method_missing to provide additional functions for each of your
fixtures:
h3. assert_list_of_N
This asserts that the lists are the same size and have the same items. Any
difference is reported.
Example:
assert_list_of_candy_bars [:almond_joys], CandyBar.find_nutty()
assert_list_of_candy_bars [:almond_joys, :m_and_ms], CandyBar.find_nutty()
h3. assert_set_of_N
This asserts that the lists are the same size and have the same items, but order
is ignored.
Example:
assert_set_of_candy_bars [:almond_joys], CandyBar.find_nutty()
assert_set_of_candy_bars [:almond_joys, :m_and_ms], CandyBar.find_nutty()