This repository was archived by the owner on Nov 16, 2018. It is now read-only.
forked from cucumber/cucumber-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Sinatra
bobby edited this page Aug 13, 2010
·
33 revisions
You can use Cucumber with Sinatra and Webrat!
Just make sure you have a features/support/env.rb file with the following:
# NOTE: This must come before the require 'webrat', otherwise
# sinatra will look in the wrong place for its views.
require File.dirname(__FILE__) + '/../../your_sinatra_app'
# RSpec matchers
require 'spec/expectations'
# Webrat
require 'webrat'
Webrat.configure do |config|
config.mode = :sinatra
end
World do
session = Webrat::SinatraSession.new
session.extend(Webrat::Matchers)
session.extend(Webrat::HaveTagMatcher)
session
end
You can also use Cucumber with Sinatra using Sinatra’s built-in testing setup and Test Harness_. Make sure you have the following setup in your features/support/env.rb.
require File.dirname(__FILE__) + "/../../your_sinatra_app"
# RSpec matchers
require 'spec/expectations'
require 'spec/interop/test'
require 'sinatra/test'
Test::Unit::TestCase.send :include, Sinatra::Test
World do
Sinatra::TestHarness.new(Sinatra::Application)
end