One of my assert_selects is driving me up the wall. Its failing and of course its telling me what it expected but Id like to see what was actually there on that page when it rendered to track down this bug.
Ive already tried using my browser and the app is behaving as it should but thats using development data.
Is there a command i can use to print the html to console or my test log?
To run a Minitest test, the only setup you really need is to require the autorun file at the beginning of a test file: require 'minitest/autorun' . This is good if you'd like to keep the code small. A better way to get started with Minitest is to have Bundler create a template project for you.
You also have access to three instance variables in your functional tests: @controller – The controller processing the request. @request – The request. @response – The response.
Or we can run a single test file by passing the bin/rails test command the filename containing the test cases. This will run all test methods from the test case. You can also run a particular test method from the test case by providing the -n or --name flag and the test's method name.
Integration. Don't try to test all the combinations in integration tests. That's what unit tests are for. Just test happy-paths or most common cases.
Just do
puts @response.body
right before the problematic assertion and you should see the thing.
Webrat does this very thing with the command save_and_open_page
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With