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...

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
github.com

...page is a collection of common markdown XSS payloads which is handy for writing tests. Producing arbitrary links: [Basic](javascript:alert('Basic')) [Local Storage](javascript:alert(JSON.stringify(localStorage))) [CaseInsensitive](JaVaScRiPt...

...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...

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

...data to a new schema. If you have different versions, you always need to test all different version if required. With FactoryBot this should be traits. The JSON Schema files...

betterspecs.org

betterspecs.org is a documentation on how to write better RSpec tests. Note that there are also other approaches like The Self-Contained Test, which is complementary to the dry-approches...

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...

makandra dev

...fix" this in multiple ways: Update your drivers on your machine with RAILS_ENV=test rake webdrivers:chromedriver:update Ignore the driver update-URL in your VCR configuration

tableconvert.com

...table ("rotate" it by 90 degree). The tool can be handy if you have tests with large markdown tables for testing contents of a flat json structure or csv.

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...

api.jquery.com

...of matched elements to those that match the selector or pass the function's test. jQuery has a select method, but it has nothing to do with navigating the DOM...

...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

...in your mailer: # production.rb: Rails.application.configure do config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = smtp_settings end # test_mailer.rb def test_mail mail(to: 'mail@example.com', subject: 'Subject').delivery_method.settings.merge!(smtp_settings) end Configuring SMTP with...

...a Google account These is an example configuration you can use to test if mail delivery works in your application: smtp_settings { address: 'smtp.gmail.com', domain: 'smtp.gmail.com', port: 587,

...and change the stored environment: RAILS_ENV=development rails db:environment:set For parallel tests: rake parallel:rake[db:environment:set] Then re-run your command. Or, if you are...

Sometimes you just want to have a small web server that serves files to test something. Serve the current directory On Ruby 1.9.2+ you can do the following ("." for current...

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...

TL;DR Debugging problems with javascript errors in cucumber tests is sometimes easier in the browser. Run the test, stop at the problematic point (with Then pause from Spreewald...

...You can force Capybara to match exactly what you are typing (which makes your tests better anyways) with match: :prefer_exact: name = 'Name' value = 'Bettertest Cucumberbatch' fill_in(field, with...

...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...

...gem will show a default of 30 records per page. If you want to test pagination in a Cucumber feature, you don't want to create 31 records just for...