blog.buildbettersoftware.com

Mornings can be rough. To make them a little easier, leave yourself a failing test if your work isn’t finished. When you come back to the project, it makes...

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

makandra dev
brunildo.org

The pages listed here contain tests and experiments about features, possibilities, browsers’ bugs concerning CSS. That is, over 200 experiments...

github.com

...implement sending an error notification if the data (in the db) is too old. Testing: If you use sidekiq_retries_exhausted (unit test): https://stackoverflow.com/questions/33930199/rspec-sidekiq-how-to-test-within-sidekiq-retries-exhausted-block-with-another If you use the...

...global option (manual test): # Use this worker to test if the exception notifier for sidekiq works as expected and the retries total duration fits. # Example: TestWorker.perform_async('foo', 'bar')

This note describes a Cucumber step definition that lets you test whether or not a CSS selector is present on the site: Then I should see an element "#sign_in...

robots.thoughtbot.com

One of many useful techniques when your test suite needs to talk to a remote API...

wiki.qemu.org

...x86_64 -cdrom filename.iso If you prepared a USB pen drive and want to test it, run it like this (/dev/sdx being your device name; you may need to sudo...

...to config/initializers.rb. In the same initializer, type a line: Undebug.trace_message('foobar') Now run tests or whatever you need to do to to trigger that message. The console output should...

makandra dev

In order to go back one page in your Cucumber tests, you can use the following step definition for Capybara: When(/^I go back$/) do visit page.driver.request.env['HTTP_REFERER']

...scrollbars ? '==' : '!=' scroll_height.should.send(comparison, offset_height) end This should respect padding. However, I have not tested if margins have an effect on it...

willmore.eu

The linked site hosts a simple test. It shows two images with narrow vertical/horizontal lines. The more they resemble each other, the more Retina your display is...

...the usual notification rules, i.e. you won't get anything in the development or test environments. Obiously, this only works with tasks that actually depend on :environment...

makandracards.com

...so it should be a drop-in replacement for all your projects. For Rack::Test the step no longer uses XPath so you should be able to understand it when...

...you need additional form fields (like tax IDs) to bill customers in another language. Tests Tests should continue to use the base language you had before starting localization. Don't...

...rewrite all tests and don't test every screens with every language unless repeatedly broken translations becomes a pain point. Do test non-trivial language-specific customizations like the parsing...

RSpec 1 (Rails 2) With the most recent spec_candy.rb helpers you can say: User.stub_any_instance(:foo => :bar) user = User.new...

In most of our applications, users have their first and last name stored in separate columns. However, specifying them separately...

makandra dev
github.com

So you can easily add new roles to a user model and start testing without adding new traits by yourself. Note: If you not provide a second argument to...

makandracards.com

Updated the card with our current best practice (shared app code and specs via symlinks).

Sometimes you need to look at the filter chain in specs. You can do it like that on Rails 2...

In the tradition of our PostgreSQL cheat sheet for MySQL lamers, here is a cheat sheet for Jasmine when you...

makandra dev

.../public/assets-test/', '/tmp/', ] } 2. Report all existing offenses and exclude them initially Add an RSpec test, which runs ESLint (also during a full RSpec test run), e.g. in spec/eslint_spec.rb: require 'open3...

expect(status.success?).to eq(true), failure_message end end Run the test or simply run yarn run eslint . from your console to check all files. Now you...

makandra dev

...pack is application.js): = image_pack_tag('media/application/images/logo.png') Deployment Follow Configuring Webpacker deployments with Capistrano. Tests In your cucumber test, you will want to regenerate your assets before each test suite...

...run. Since this is a bit slow, especially when using multiple processes with parallel_test, read this card. jQuery If you still require jQuery, add it to your webpacker project...

github.com

...servers. It spins up when you run your feature specs, so that you can test your purchase flow without hitting Stripe’s servers or making any external HTTP requests.

...ve also had tests actually hitting the testing sandbox of Stripe, which worked OK most of the time (can be flakey...

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