Skip to content

Instantly share code, notes, and snippets.

@dominictarr
Created September 9, 2010 14:20
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dominictarr/571920 to your computer and use it in GitHub Desktop.
Save dominictarr/571920 to your computer and use it in GitHub Desktop.
get started testing sinatra with capybara
require 'rubygems'
require 'sinatra/base'
class Hello < Sinatra::Base
get '/' do
"hello world"
end
end
Hello.run! if __FILE__ == $0
require 'test/unit'
require 'capybara'
require 'capybara/dsl'
require 'hello_sinatra'
class TestHello < Test::Unit::TestCase
include Capybara
def setup
Capybara.app = Hello
end
def test_hello
visit '/'
assert_equal "hello world", page.body
end
end
@dominictarr
Copy link
Author

get started with Capybara testing sinatra (or anyone other rack app) pronto!

@dominictarr
Copy link
Author

is this comment just on old commit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment