Running the Awesome window manager within Gnome
...it up to switch between Awesome and regular Gnome on login. Here is how: (Tested on Fedora 15 / Ubuntu 11.10/12.04/14.04 with Gnome 3, and Ubuntu 10.10 with Gnome...
Capybara steps to match stuff within any selector
...behavior to be impractical, but it is by design. In order to perform a test or action in all matching elements, do not use within but prefer the attached "inside...
Force SSH client to use password authentication instead of public key
To test if you can connect to a host using password authentication and explicitly deny public key authentication: ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no user@host This also works...
Force Google Chrome to run in English on Linux
...en”. They reappear when Chrome gets updated. This may help you running your Selenium tests using the Chrome driver on applications that choose the language from what the browser sends...
ActiveSupport::StringInquirer
Wrapping a string in this class gives you a prettier way to test for equality...
Playing audio in a browser
...skinned, and which work for both Flash and HTML5 audio playback. Some products I tested are: jPlayer : Free. Provides a thin Javascript layer over the mess that is HTML5 audio...
Why preloading associations "randomly" uses joined tables or multiple queries
...Mysql::Error: Column 'created_at' in order clause is ambiguous Unless you have a test covering this particular case, you won't notice this until after you deployed.
Setup (and secure) an SSH server on Ubuntu
...Don't forget to restart after editing the sshd_config: sudo service ssh restart (Tested on Ubuntu...
Synchronize a Selenium-controlled browser with Capybara
...a button on a Selenium-controlled browser, the call will return control to your test before the next page is loaded. This can lead to concurrency issues when a Cucumber...
plus2/whereuat - GitHub
Adds a slide out panel to your Rails application that directs clients to test stories that have been marked as 'delivered' in Pivotal Tracker...
Traversing the DOM tree with jQuery
...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...
Check that a Range covers an element in both Ruby 1.9 and 1.8.7
...the min and max values, the range is iterated over from min until the test value is found (or max) [...] Ruby 1.9 introduces a new method Range#cover? that implements...
Closures in Ruby
...I *think* it is, based on experiment. There's no authoritative answer other than testing the CRuby implementation, because there's no real spec -- so there may be other differences...
Use the back button in Cucumber
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']
Match strings in a given order with Cucumber and Capybara
Augsburg Berlin Beta Group """ The step ignores all HTML tags and only tests on plain text...
Reload the page in your Cucumber features
...visit url_for(request.params) end For a step that distinguishes between drivers (Selenium, Rack::Test, Culerity), check n4k3d.com...
The WordCount Simulation
So this is the simulation that I use in my Agile Testing class, as well as in other contexts where I want to teach lessons about increasing Agility. The mechanics...
Run a rake task in all environments
power-rake db:migrate VERSION=20100913132321 By default the environments development, test, cucumber and performance are considered. The script will not run rake on a production or...
Strip carriage returns in submitted textareas
class Note does 'strip_carriage_returns', :prose, :code end Here is the test that goes with it: describe Note do describe 'before_validation' do it_should_run_callbacks...
Fix a spec that only runs when called directly
...only runs when it is called directly, but not as part of the whole test suite, make sure the filename is foo_spec.rb instead of just foo.rb...
Airbrake notification in Rake tasks
...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...
rspec_candy is now a gem
...formerly known as "spec_candy.rb") is now available as a gem. It works, it is tested and there will be updates. Usage Add rspec_candy to your Gemfile. Add require 'rspec...
MySQL replication how-to
...example SOURCE the_dump.sql in the MySQL shell) Set up an SSH tunnel Manually, for testing purposes: ssh -L 3307:localhost:3306 10.50.0.101 This maps the local port 3307 to port...
Cucumber Webrat steps
Most of these will not work in newer projects because these use the Capybara/Rack::Test combo in lieu of Webrat. Find input fields Then /^there should be a "([^"]+)" field$/ do...