Test::Unit::TestCase
# File tests/drivers/mock/url_for_test.rb, line 24 def app Sinatra::Application end
# File tests/drivers/mock/url_for_test.rb, line 28 def test_it_works_for_root verify_url_for("/", "/") end
# File tests/drivers/mock/url_for_test.rb, line 32 def test_it_works_for_root_absolute verify_url_for("/", "http://example.org/", :full) end
# File tests/drivers/mock/url_for_test.rb, line 40 def test_it_works_when_given_absolute verify_url_for("http://test.com", "http://test.com") end
# File tests/drivers/mock/url_for_test.rb, line 44 def test_it_works_when_not_at_root_context verify_url_for("/", "context/", :path_only, {}, {"SCRIPT_NAME" => "context"}) end
# File tests/drivers/mock/url_for_test.rb, line 36 def test_it_works_with_spaces verify_url_for("/url with spaces", "/url%20with%20spaces") end
# File tests/drivers/mock/url_for_test.rb, line 48 def verify_url_for(url, expected_url, mode=:path_only, params={}, rack_env={}) # generate a unique url for each test test_url = "/url_for_test/#{expected_url.hash}/#{Time.now.to_i}" # Create our sinatra test endpoint self.class.create_test_url_content(test_url, url, mode) # verify the generated url matches what we expect get test_url, params, rack_env last_response.body.should == expected_url end
Generated with the Darkfish Rdoc Generator 2.