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

makandra dev

Fix missing require for Fileutils in the dump load command (#145) Document PARALLEL_TEST_PROCESSORS

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

...authorized users only 3. Using the same storage folder for multiple Rails environments or test processes This one affects your developers. If an image with ID 4 always ends up...

...as public/system/images/4.jpg, multiple Rails environments (e.g. development and test) will randomly see and overwrite each other's files. See Always store your Paperclip attachments in a separate folder per 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...

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

...can structure specs with nested example groups, let, subject and before/after hooks, and share tests between similar classes with shared example groups. You can explain the trade-off between DRY...

...extracted into shared helpers instead of copied. You can explain what mocking is, use test doubles to take control of a collaborator, and name a case where a mocked test...

getpostman.com

Talking with APIs makes more fun using Postman. As an alternative you can also use command line tools like cURL...

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

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

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

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')

I recently encountered the error above when I was running selenium tests. Thanks to a post on stackoverflow I found out that clearing all files in tmp/cache in my project...