Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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