-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9ca2939
commit 07ec14c
Showing
20 changed files
with
1,759 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
== 0.2.0 / 2008-04-04 | ||
|
||
* 4 Major enhancements | ||
|
||
* Add save_and_open_page to aid in debugging | ||
* Add radio button support via #chooses method | ||
* Add basic support for Rails-generated JavaScript link tags | ||
* Add support for checkboxes (Patches from Kyle Hargraves and Jarkko Laine) | ||
* Add support for textarea fields (Patch from Sacha Schlegel) | ||
|
||
* 8 Minor enhancements | ||
|
||
* Added reloads method to reload the page (Patch from Kamal Fariz Mahyuddi) | ||
* Prevent making a request if clicking on local anchor link (Patch from Kamal Fariz Mahyuddi) | ||
* Added clicks_link_within(selector, link_text), allowing restricting link search | ||
to within a given css selector (Path from Luke Melia) | ||
* Allow specifying the input name/label when doing a select (Patch from David Chelimsky) | ||
* Raise a specific exception if the developer tries to manipulate form elements before loading a page (Patch from James Deville) | ||
* Add support for alternate POST, PUT and DELETE link clicking (Patch from Kyle Hargraves) | ||
* Change clicks_link to find the shortest matching link (Patch from Luke Melia) | ||
* Improve matching for labels in potentially ambiguous cases | ||
|
||
* 7 Bug fixes | ||
|
||
* Fix incorrect serializing of collection inputs, i.e. name contains [] (Patch from Kamal Fariz Mahyuddi) | ||
* Serialize empty text field values just like browsers (Patch from Kamal Fariz Mahyuddi) | ||
* Quick fix to avoid @dom not initialized warnings (Patch from Kamal Fariz Mahyuddi) | ||
* Docfix: bad reference to #select method in README (Patch from Luke Melia) | ||
* Ensure Rails-style checkboxes work properly (checkboxes followed by a hidden input with the same name) | ||
* Fix Edge Rails (a.k.a. 2.0 RC) compatibility (Patch from David Chelimsky) | ||
* Support param hashes nested more than one level (Patch from David Chelimsky) | ||
|
||
== 0.1.0 / 2007-11-28 | ||
|
||
* 1 major enhancement | ||
* Birthday! | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2007 Bryan Helmkamp, Seth Fitzsimmons | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
History.txt | ||
MIT-LICENSE.txt | ||
Manifest.txt | ||
README.txt | ||
Rakefile | ||
TODO.txt | ||
init.rb | ||
install.rb | ||
lib/webrat.rb | ||
lib/webrat/rails_extensions.rb | ||
lib/webrat/session.rb | ||
test/checks_test.rb | ||
test/chooses_test.rb | ||
test/clicks_button_test.rb | ||
test/clicks_link_test.rb | ||
test/fills_in_test.rb | ||
test/helper.rb | ||
test/reloads_test.rb | ||
test/selects_test.rb | ||
test/visits_test.rb |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
= Webrat - Ruby Acceptance Testing for Web applications | ||
|
||
http://rubyforge.org/projects/webrat | ||
http://github.com/brynary/webrat | ||
|
||
* mailto:bryan@brynary.com | ||
* mailto:seth@mojodna.net | ||
|
||
== DESCRIPTION: | ||
|
||
Webrat lets you quickly write robust and thorough acceptance tests for a Ruby | ||
web application. By leveraging the DOM, it can run tests similarly to an | ||
in-browser testing solution without the associated performance hit (and | ||
browser dependency). The result is tests that are less fragile and more | ||
effective at verifying that the app will respond properly to users. | ||
|
||
When comparing Webrat with an in-browser testing solution like Watir or | ||
Selenium, the primary consideration should be how much JavaScript the | ||
application uses. In-browser testing is currently the only way to test JS, and | ||
that may make it a requirement for your project. If JavaScript is not central | ||
to your application, Webrat is a simpler, effective solution that will let you | ||
run your tests much faster and more frequently. (Benchmarks forthcoming.) | ||
|
||
Initial development was sponsored by EastMedia (http://www.eastmedia.com). | ||
|
||
== SYNOPSIS: | ||
|
||
def test_sign_up | ||
visits "/" | ||
clicks_link "Sign up" | ||
fills_in "Email", :with => "good@example.com" | ||
selects "Free account" | ||
clicks_button "Register" | ||
... | ||
end | ||
|
||
Behind the scenes, this will perform the following work: | ||
|
||
1. Verify that loading the home page is successful | ||
2. Verify that a "Sign up" link exists on the home page | ||
3. Verify that loading the URL pointed to by the "Sign up" link leads to a | ||
successful page | ||
4. Verify that there is an "Email" input field on the Sign Up page | ||
5. Verify that there is an select field on the Sign Up page with an option for | ||
"Free account" | ||
6. Verify that there is a "Register" submit button on the page | ||
7. Verify that submitting the Sign Up form with the values "good@example.com" | ||
and "Free account" leads to a successful page | ||
|
||
Take special note of the things _not_ specified in that test, that might cause | ||
tests to break unnecessarily as your application evolves: | ||
|
||
* The input field IDs or names (e.g. "user_email" or "user[email]"), which | ||
could change if you rename a model | ||
* The ID of the form element (Webrat can do a good job of guessing, even if | ||
there are multiple forms on the page.) | ||
* The URLs of links followed | ||
* The URL the form submission should be sent to, which could change if you | ||
adjust your routes or controllers | ||
* The HTTP method for the login request | ||
|
||
A test written with Webrat can handle these changes smoothly. | ||
|
||
== REQUIREMENTS: | ||
|
||
* Rails >= 1.2.6 | ||
* Hpricot >= 0.6 | ||
* Rails integration tests in Test::Unit _or_ | ||
* RSpec stories (using an RSpec version >= revision 2997) | ||
|
||
== INSTALL: | ||
|
||
In your stories/helper.rb: | ||
|
||
require "webrat" | ||
|
||
You could also unpack the gem into vendor/plugins. | ||
|
||
== HISTORY: | ||
|
||
See CHANGELOG in this directory. | ||
|
||
== LICENSE: | ||
|
||
Copyright (c) 2007 Bryan Helmkamp, Seth Fitzsimmons. | ||
See MIT-LICENSE in this directory. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require 'rubygems' | ||
require 'hoe' | ||
require './lib/webrat.rb' | ||
|
||
Hoe.new('webrat', Webrat::VERSION) do |p| | ||
p.rubyforge_name = 'webrat' | ||
p.summary = 'Ruby Acceptance Testing for Web applications' | ||
|
||
p.developer "Bryan Helmkamp", "bryan@brynary.com" | ||
p.developer "Seth Fitzsimmons", "seth@mojodna.net" | ||
|
||
# require "rubygems"; require "ruby-debug"; Debugger.start; debugger | ||
|
||
p.description = p.paragraphs_of('README.txt', 4..6).join("\n\n") | ||
p.url = p.paragraphs_of('README.txt', 1).first.split("\n").first.strip | ||
p.changes = p.paragraphs_of('History.txt', 0..3).join("\n\n") | ||
|
||
p.extra_deps << ["hpricot", ">= 0.6"] | ||
|
||
p.remote_rdoc_dir = '' # Release to root | ||
p.test_globs = ['test/**/*_test.rb'] | ||
end | ||
|
||
desc "Upload rdoc to brynary.com" | ||
task :publish_rdoc => :docs do | ||
sh "scp -r doc/ brynary.com:/apps/uploads/webrat" | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Full support for multiple forms on a page | ||
Track the current form based on the location of the last manipulated input, use this as a default for clicks_button | ||
Make current_url work with redirections | ||
Support for a hash mapping page names to page URLs |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
if RAILS_ENV == "test" | ||
require File.join(File.dirname(__FILE__), "lib", "webrat") | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
puts IO.read(File.join(File.dirname(__FILE__), 'README')) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require File.join(File.dirname(__FILE__), "webrat", "rails_extensions") | ||
require File.join(File.dirname(__FILE__), "webrat", "session") | ||
|
||
class Webrat | ||
VERSION = '0.2.0' | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module ActionController | ||
module Integration | ||
|
||
class Session | ||
|
||
unless instance_methods.include?("put_via_redirect") | ||
# Waiting for http://dev.rubyonrails.org/ticket/10497 to be committed. | ||
def put_via_redirect(path, parameters = {}, headers = {}) | ||
put path, parameters, headers | ||
follow_redirect! while redirect? | ||
status | ||
end | ||
end | ||
|
||
unless instance_methods.include?("delete_via_redirect") | ||
# Waiting for http://dev.rubyonrails.org/ticket/10497 to be committed. | ||
def delete_via_redirect(path, parameters = {}, headers = {}) | ||
delete path, parameters, headers | ||
follow_redirect! while redirect? | ||
status | ||
end | ||
end | ||
|
||
end | ||
|
||
end | ||
end |
Oops, something went wrong.