Created
September 9, 2010 14:20
-
-
Save dominictarr/571920 to your computer and use it in GitHub Desktop.
get started testing sinatra with capybara
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sinatra/base' | |
class Hello < Sinatra::Base | |
get '/' do | |
"hello world" | |
end | |
end | |
Hello.run! if __FILE__ == $0 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
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
get started with Capybara testing sinatra (or anyone other rack app) pronto!