Okay I’m bored of this. I need to talk about it. I love to use Ruby, RSpec, Cucumber and Rails to do test-driven development, but my tools for running tests are just infuriatingly dumb. Here’s what I want: When a test fails, it should be kept on a list until it has been seen to …
Tag Archives: rspec
Using Capybara with RSpec Outside Cucumber
If you want to try using Capybara for browser automation on it’s own, here’s a simple script to get you started: require ‘rubygems’ require ‘capybara’ require ‘capybara/dsl’ Capybara.default_driver = :selenium Capybara.app_host = “http://www.google.com” require “rspec/expectations” class Google include Capybara include RSpec::Matchers def search_for(text) visit “/” fill_in “q”, :with => text click_button “Search” end def ensure_results_contain(expected_text) …
Continue reading “Using Capybara with RSpec Outside Cucumber”
Behaviour-Driving Routes in Rails with RSpec
One thing that isn’t documented very well for RSpec is how to test your routes. I came across an old post on the rspec mailing list which described a great way to do this: describe TasksController “routing” do it “should route POST request for /tasks to the ‘create’ action” do params_from(:post, “/tasks”).should == {:controller =>; …
Continue reading “Behaviour-Driving Routes in Rails with RSpec”