Rails has the handy controller method send_file which lets us download files easily. We can decide whether the file...

selenium.dev

...Chrome for Testing if none is found on the system. I worked around this behavior by setting the path to the binary in the selenium initializer Capybara.register_driver :selenium do...

...should see the following ([\w]+) table:?$/ do |name, expected_table| name = name.underscore table_element = begin element_at("table\##{name}") rescue Webrat::NotFoundError begin element_at("table.#{name}") rescue element_at...

If you want to move a complete commit from one repository to another (and you don't want to add...

github.com

...spawns another process to run a browser, it will inherit the environment and also believe it lives in that zone. To do so, run the following code before your test...

Added: State machine can now use the :prefix-option to avoid name collision if you define multiple state machines on...

...a "add new user" forms. Chrome developers say this is by design as they believe it encourages users to store more complex passwords. Recommended fix for Chrome and Firefox

Capybara allows you to select DOM elements, e.g. by using field, find_field(...) or field_labeled(...): role_select = field_labeled...

github.com

When a method has keyword arguments, Ruby offers implicit conversion of a Hash argument into keyword arguments. This conversion is...

On your local system that only hosts non-critical development data and only you have access to, you can store...

...new value (be aware that you should use a secure and salted hash) or better call the the_user_to_log_out.reset_remember_token! method that does the things for you.

...to work as expected Good Then the crontab -l output will look like this: # Begin Whenever generated tasks for: some-app_staging 34 23 * * * /bin/bash -l -c 'cd /var/www/some-app_staging/releases/20201215171150 && RAILS...

...value, that can not be replaced by Whenever (the release folder changes every deploy): # Begin Whenever generated tasks for: /var/www/some-app_staging/releases/20201215171150 34 23 * * * /bin/bash -l -c 'cd /var/www/some-app_staging/releases/20201215171150 && RAILS_ENV=staging...

Use option:checked to find the currently selected option: select.querySelector('option:checked') Yes, :checked, not :selected. This is the same...

Note that you should disable the Java plug-in in your browsers after installation. Ubuntu >= 12.04 Java 11

If you want to see how long your database queries actually take, you need to disable MySQL's query cache...

Spreewald's patiently repeats the given block again and again until it either passes or times out.

Imagine you want to write a cucumber test for a user-to-user chat. To do this, you need the...

makandra dev

If you need to run a program on a remote machine (e.g. to your office PC) with a graphical UI...

Usually you add errors to :base in ActiveRecord, in case no appropriate attribute could be used to add the error...

You can tell npm to install a package globally with npm -g install @puppeteer/browsers. However, it seems that its not...

makandra dev

This is an awesome gadget in your toolbox, even if your test coverage is great. gem install ruby-debug (Ruby...

web.archive.org

When flagging a spec that will be implemented later as pending, include a failing spec body or RSpec 3 will...

docs.ruby-lang.org

The sprintf method has a reference by name format option: sprintf("% d : % f", { :foo => 1, :bar => 2 }) # => 1 : 2.000000

...it will be fixed, I guess it will be for Rails 4 only. The best workaround right now is to lock your version of rack at version...