Skip to content

Instantly share code, notes, and snippets.

@tooky
Created February 5, 2009 10:42
Show Gist options
  • Save tooky/58647 to your computer and use it in GitHub Desktop.
Save tooky/58647 to your computer and use it in GitHub Desktop.
Sinatra + Cucumber + Webrat
require 'spec/expectations'
require 'webrat'
Webrat.configure do |config|
config.mode = :sinatra
end
World do
Webrat::SinatraSession.new
end
require 'sinatra'
get '/' do
"Hello, world!"
end
Given /^I am viewing "(.+)"$/ do |url|
visit(url)
end
Then /^I should see "(.+)"$/ do |text|
response_body.should =~ Regexp.new(Regexp.escape(text))
end
Feature: view pages
Scenario: Home page
Given I am viewing "/"
Then I should see "Hello, world!"
require 'rubygems'
require 'cucumber/rake/task'
Cucumber::Rake::Task.new(:features) do |t|
t.cucumber_opts = "--format pretty"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment