Capybara drivers will usually delete all cookies after each scenario. If you need to lose cookie data in the middle...

When you need to find out in which kind of spec you are during run-time, it's definitely possible...

Sometimes you need a piece of code to do something different for specs than for features. If you don't...

When your site is on HTTPS and you are linking or redirecting to a HTTP site, the browser will not...

We have often felt the pain where our models need to serve too many masters. E.g. we are adding a...

In the following example the method update_offices_people_count won't be called when office_id changes, because it...

We ran into trouble when adding additional compute units to our railscomplete Hosting environment lately. VM-instances on the new...

Rails gives you migrations to change your database schema with simple commands like add_column or update. Unfortunately these commands...

In specs, the session never persists but is always a new object for each request. Data put into the session...

Note: This technique is confusing and slows down your test suite. Copy the attached code to features/support. This gets you...

The User-Agent HTTP header identifies the client and is sent by "regular" browsers, search engine crawlers, or other web...

When a controller action redirects to an external URL (like http://somehost.com/some/path) you will find that this is hard...

Unfortunately, Capybara does not offer a switch to disable cookies in your test browser. However, you can work around that...

To set a cookie in your test browser for cucumber tests, you need to know which driver you are using...

The following code doesn't work like expected: page.find(css_selector).find(other_css_selector) The second .find will search...

opensoul.org

Great presentation about writing Javascript like you write everything else: Well-structured and tested. JavaScript is no longer a toy...

Consider this class: class Foo private def test puts "Hello" end end While you can say create a block to...

web.archive.org

TL;DR: You should generally use #size to count associated records. size Counts already loaded elements If the association is...

calc() lets you mix CSS units. Ever wanted to give an element "the container's width minus 20px on each...

Safari & Chrome Use $x() in your console: $x('//span') # selects all span elements Firefox There's an add-on.

JavaScript has no built-in functions to compare two objects or arrays for equality of their contained values.

github.com

MongoMapper is a MongoDB adapter for Ruby. We've forked it so it works for Rails 2.3.x applications running...

If you open a pop-up window [1] in your Selenium tests and you want to close it, you can...

gist.github.com

Rails 2.3.16+ on Ruby 1.9 causes warnings like this: .../gems/activesupport-2.3.17/lib/active_support/core_ext/string/output_safety.rb:22: warning: regexp match /.../n against to UTF-8 string...