Sha256: 6a25b5d6a318a35f9829d08442e25a940bc527bd6a730f623c3119aca7936299
Contents?: true
Size: 1.69 KB
Versions: 4
Compression:
Stored size: 1.69 KB
Contents
h1. test-unit-capybara "Web site":http://test-unit.rubyforge.org/#test-unit-capybara h2. Description test-unit-capybara is a Capybara adapter for test-unit 2. You can get "Capybara":https://rubygems.org/gems/capybara integrated Test::Unit::TestCase. It also provides useful assertions for Capybara. h2. Install <pre> % sudo gem install test-unit-capybara </pre> h2. Usage <pre> require 'test/unit/capybara' class MyRackApplication def call(env) html = <<-HTML <html> <head> <title>Welcome! - my site</title> </head> <body> <h1>Welcome!</h1> <div class="header"> <p>No navigation.</p> </div> </body> </html> HTML [200, {"Content-Type" => "text/html"}, [html]] end end class TestMyRackApplication < Test::Unit::TestCase include Capybara::DSL def setup Capybara.app = MyRackApplication.new end def test_title visit("/") within("h1") do assert_equal("Welcome!", text) end end def test_no_sidebar visit("/") within("body") do assert_not_find(".sidebar") end end def test_header_content visit("/") within(".header") do find("ol.navi") # This fails with the following message: # # <"ol.navi">(:css) expected to find a element in # <<div class="header"> # <p>No navigation.</p> # </div>> # # This messages shows the current context. You don't need to # entire HTML. You just see the current context moved by "within". # It helps you debug a problem without save_and_open_page. end end end </pre> h2. License LGPLv2.1 or later. (Kouhei Sutou has a right to change the license including contributed patches.) h2. Authors * Kouhei Sutou
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
test-unit-capybara-1.0.4 | README.textile |
test-unit-capybara-1.0.3 | README.textile |
test-unit-capybara-1.0.2 | README.textile |
test-unit-capybara-1.0.1 | README.textile |