ruby on rails - How to do integration tests without controllers? -


i've done integration (aka "feature") tests rspec , capybara, i'm building complex piece of functionality combines various ruby classes , rails models , there no controller or ui involved really.

i'd perform series of tests touches these various classes , models make sure work expected.

this doesn't seem unit testing these tests require multiple objects work together.

it doesn't seem traditional rails "integration" tests, since i'm not navigating ui or hitting controllers.

so these , how can build , organize them in rails app?

you're not limited rails' 'out of box' set of folders or test types. can add additional folders , organise them want. if you're getting started , don't have many, i'd put them in spec/objects or spec/poros (plain old ruby objects) , test them there. number of them grows, you'll want break them folders - decide on convention makes sense, , follow it. once go beyond standard set of stuff rails gives you, there's no right or wrong answers per se - it's "do makes sense".

as type of tests are, i'd still call them integration tests. while they're not testing integration of whole rails stack, they're testing integration between several objects. wether or not means put them in spec/integration_tests folder or not - wouldn't.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -