...silence some specific warnings. Add this to your initializers, or require it in your tests: silenced = [ /Not considered a useful test/, /use: should(_not)? have_sent_email/, ] # list of warnings...

...Listening on localhost:36309, CTRL+C to stop If you are running parallel tests with thin, this will clutter you output. Disable thin logging with these lines: # e.g. in features/support/thin.rb...

Thin::Logging.silent = true Note that this disables all logging in tests. Instead, you also might set a different logger with Thin::Logging.logger = . See Thin::Logging for details...

...they are wrapping the same native DOM elements: $('body') == $('body') // false In order to test if two jQuery objects refer to the same native DOM elements, use is:

Jasmine equality matcher for jQuery See here for a custom Jasmine matcher that tests if two jQuery objects are equal...

PostgreSQL supports the SQL OVERLAPS operator. You can use it to test if two date ranges overlap: => SELECT ('2001-02-16'::date, '2001-12-21'::date) OVERLAPS...

...date, '2002-10-30'::date); overlaps -------- false Also compare our card Test if two date ranges overlap in Ruby or Rails...

When testing Ruby code that prints something to the terminal, you can test that output. Since RSpec 3.0 there is a very convenient way to do that. Anything that writes...

...print) can be captured like this: expect { something }.to output("hello\n").to_stdout Testing stderr works in a similar fashion: expect { something }.to output("something went wrogn\n").to...

makandra dev

...if you make any error in programming. E.g. a simple typo would make the test above green. The block will catch the Spec:: exception and the test will be happy...

makandra dev
mixedcontentexamples.com

The pages […] allow you to see different types of mixed content and test how they behave in your browser. The "Secure" pages are referencing assets with HTTPS, the "Non-Secure...

...same behavior with both Secure pages and the Secure HTTP page for a given test; the behavior will change on the Non-Secure HTTPS page. Also see Testing HTTPS with...

...linking from HTTPS to HTTPS. Fixes Tunnel links through a non-HTTPS page (but test the effect because HTTP referers survive a 301 redirect) There's a new tag you...

makandra dev
github.com

...a transformable example of katapult's features Development Add katapult update script Speed up tests (now running in about 9 min) Improve development workflow (see README) No bundler issues in...

...tests any more

When you are scrolling up to investigate a test failure it is super annoying when the terminal scrolls back down whenever the running test outputs another line. Luckily you can...

stackoverflow.com

If you want to have routes that are only available in tests (e.g. for testing obscure redirects), you can use the with_routing helper -- but that one destroys existing routes...

...may break a specs that require them to work. To keep both "regular" and test routes, do this: class MyApplicationController < ActionController::Base def show render text: 'Welcome to my application...

bark.metacasa.net

Unfortunately, by default plugin tests are pretty bland. They use the plain unit test suite supplied by Ruby, and not any of the extended Rails test framework. This will leave...

...our plugin’s test classes with no access to fixtures, database.yml configuration, or any of those nice class auto-loading features...

...the following command open a database console for the development environment: rails dbconsole -p test You need to write this instead: rails dbconsole test -p

.../home/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/capistrano-3.14.1/lib/capistrano/tasks/deploy.rake:90:in `block (5 levels) in <top (required)>' 11: from /home/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/sshkit-1.9.0/lib/sshkit/backends/abstract.rb:50:in `test' 10: from /home/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/sshkit-1.9.0/lib/sshkit/backends/abstract.rb:137:in `create_command_and_execute' 9: from /home/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/sshkit-1.9.0/lib/sshkit/backends/abstract.rb:137:in `tap...

github.com

capybara-lockstep can help you with flaky end-to-end tests: This Ruby gem synchronizes Capybara commands with client-side JavaScript and AJAX requests. This greatly improves the stability of...

...a full-stack integration test suite, even if that suite has timing issues...

justinfrench.com

If you’re testing the behavior of deprecated code in your Ruby project, the warning messages littered throughout your spec output is incredibly noisy. You could silence all warnings with...

...an important warning in one of your dependencies. It’s tempting to remove the tests altogether (the code will be burned soon too, right?), but I figured out something a...

...headless chrome via Selenium. This might be useful for debugging issues with flaky integration tests or slow page simulations. page.driver.browser.network_conditions = {offline: false, latency: 5, download_throughput: 2 * 1024, upload...

...from you Rails timezone settings / system timezone. I usually have this use case in tests. Example Time.parse('2020-08-09 00:00') will return different results e.g...

In Ruby you can communicate between processes with sockets. This might be helpful in tests that validate parallel executions or custom finalization logic after the garbage collector. Here is an...

In case your integration tests crash with a message like below, try to upgrade Capybara to a newer version (3.35.3 was good enough). You might encounter this issue when you...

...s only minor changes but when installing major upgrades it's a good idea. Test your system after the upgrade! If you want back for some reason, you'll have...

# visit page.driver.last_request.env['HTTP_REFERER'] # old visit page.driver.request.env['HTTP_REFERER'] # new # or for javascript tests: page.execute_script('window.history.back()') end undefined method locate for #Capybara::Session (NoMethodError) Use page.find instead of...

...now wrapped by a html document skeleton. Use page.text instead. (e.g. when you are testing correct JSON which is in fact not wrapped by a html sceleton) An element can...

...REVISION', 'utf-8').trim() } catch(_error) { // okay, probably in dev mode } environment.loaders.prepend('fa-font', { test: /fa-.*\.(woff2|woff|eot|svg|ttf)$/, use: [{ loader: 'file-loader', options: { name: '[path][name]-[hash...

To start a workflow manually it must have a trigger called workflow_dispatch: --- name: Tests on: push: branches: - master pull_request: branches: - master workflow_dispatch: branches: - master In the Actions...