sum 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Capfile +3 -0
- data/MIT-LICENSE +18 -0
- data/README.markdown +69 -0
- data/Rakefile +56 -0
- data/config.ru +3 -0
- data/config/database.example.yml +10 -0
- data/config/deploy.example.rb +36 -0
- data/config/externals.yml +18 -0
- data/config/mail.example.yml +32 -0
- data/config/schedule.rb +20 -0
- data/db/migrate/001_users.rb +22 -0
- data/db/migrate/002_user_emails.rb +15 -0
- data/features/front_page.feature +15 -0
- data/features/read_email.feature +445 -0
- data/features/receive_email.feature +59 -0
- data/features/step_definitions/email.rb +52 -0
- data/features/step_definitions/given.rb +60 -0
- data/features/step_definitions/then.rb +36 -0
- data/features/step_definitions/when.rb +46 -0
- data/features/support/env.rb +38 -0
- data/features/support/helpers.rb +50 -0
- data/features/support/rspec.rb +11 -0
- data/features/support/webrat.rb +3 -0
- data/features/update_user.feature +83 -0
- data/gemspec.rb +45 -0
- data/lib/sum.rb +30 -0
- data/lib/sum/boot.rb +29 -0
- data/lib/sum/controller/cron.rb +12 -0
- data/lib/sum/controller/front.rb +6 -0
- data/lib/sum/controller/new.rb +15 -0
- data/lib/sum/helper/application.rb +8 -0
- data/lib/sum/helper/cron.rb +12 -0
- data/lib/sum/helper/new.rb +27 -0
- data/lib/sum/model/incoming_mail.rb +89 -0
- data/lib/sum/model/user.rb +298 -0
- data/lib/sum/model/user_email.rb +31 -0
- data/lib/sum/view/email.haml +70 -0
- data/lib/sum/view/field.haml +23 -0
- data/lib/sum/view/form.haml +13 -0
- data/lib/sum/view/front.haml +29 -0
- data/lib/sum/view/layout.haml +26 -0
- data/lib/sum/view/new.haml +5 -0
- data/lib/sum/view/success.haml +14 -0
- data/lib/sum/view/tos.haml +3 -0
- data/public/image/1.png +0 -0
- data/public/image/2.png +0 -0
- data/public/image/3.png +0 -0
- data/public/image/bg.png +0 -0
- data/public/image/bot.png +0 -0
- data/public/image/facebox/b.png +0 -0
- data/public/image/facebox/bl.png +0 -0
- data/public/image/facebox/br.png +0 -0
- data/public/image/facebox/closelabel.gif +0 -0
- data/public/image/facebox/loading.gif +0 -0
- data/public/image/facebox/tl.png +0 -0
- data/public/image/facebox/tr.png +0 -0
- data/public/image/favicon.png +0 -0
- data/public/image/field_off.png +0 -0
- data/public/image/field_on.png +0 -0
- data/public/image/ribbon.png +0 -0
- data/public/image/screenshot_receive.png +0 -0
- data/public/image/screenshot_send.png +0 -0
- data/public/image/submit.png +0 -0
- data/public/image/top.png +0 -0
- data/public/javascript/facebox.js +319 -0
- data/public/javascript/jquery-1.3.2.js +19 -0
- data/public/javascript/sum.js +13 -0
- data/public/style/facebox.css +95 -0
- data/public/style/ie.css +35 -0
- data/public/style/print.css +30 -0
- data/public/style/screen.css +256 -0
- data/public/style/sum.css +119 -0
- data/public/style/sum.less +159 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +59 -0
- data/spec/sum/model/incoming_mail_spec.rb +106 -0
- data/spec/sum/model/user_spec.rb +172 -0
- data/sum.gemspec +69 -0
- data/vendor/webrat/History.txt +358 -0
- data/vendor/webrat/MIT-LICENSE.txt +19 -0
- data/vendor/webrat/README.rdoc +85 -0
- data/vendor/webrat/Rakefile +200 -0
- data/vendor/webrat/install.rb +1 -0
- data/vendor/webrat/lib/webrat.rb +31 -0
- data/vendor/webrat/lib/webrat/core.rb +14 -0
- data/vendor/webrat/lib/webrat/core/configuration.rb +102 -0
- data/vendor/webrat/lib/webrat/core/elements/area.rb +31 -0
- data/vendor/webrat/lib/webrat/core/elements/element.rb +33 -0
- data/vendor/webrat/lib/webrat/core/elements/field.rb +409 -0
- data/vendor/webrat/lib/webrat/core/elements/form.rb +103 -0
- data/vendor/webrat/lib/webrat/core/elements/label.rb +31 -0
- data/vendor/webrat/lib/webrat/core/elements/link.rb +93 -0
- data/vendor/webrat/lib/webrat/core/elements/select_option.rb +35 -0
- data/vendor/webrat/lib/webrat/core/locators.rb +20 -0
- data/vendor/webrat/lib/webrat/core/locators/area_locator.rb +38 -0
- data/vendor/webrat/lib/webrat/core/locators/button_locator.rb +54 -0
- data/vendor/webrat/lib/webrat/core/locators/field_by_id_locator.rb +37 -0
- data/vendor/webrat/lib/webrat/core/locators/field_labeled_locator.rb +56 -0
- data/vendor/webrat/lib/webrat/core/locators/field_locator.rb +25 -0
- data/vendor/webrat/lib/webrat/core/locators/field_named_locator.rb +41 -0
- data/vendor/webrat/lib/webrat/core/locators/form_locator.rb +19 -0
- data/vendor/webrat/lib/webrat/core/locators/label_locator.rb +34 -0
- data/vendor/webrat/lib/webrat/core/locators/link_locator.rb +74 -0
- data/vendor/webrat/lib/webrat/core/locators/locator.rb +20 -0
- data/vendor/webrat/lib/webrat/core/locators/select_option_locator.rb +59 -0
- data/vendor/webrat/lib/webrat/core/logging.rb +24 -0
- data/vendor/webrat/lib/webrat/core/matchers.rb +4 -0
- data/vendor/webrat/lib/webrat/core/matchers/have_content.rb +73 -0
- data/vendor/webrat/lib/webrat/core/matchers/have_selector.rb +74 -0
- data/vendor/webrat/lib/webrat/core/matchers/have_tag.rb +21 -0
- data/vendor/webrat/lib/webrat/core/matchers/have_xpath.rb +147 -0
- data/vendor/webrat/lib/webrat/core/methods.rb +63 -0
- data/vendor/webrat/lib/webrat/core/mime.rb +29 -0
- data/vendor/webrat/lib/webrat/core/save_and_open_page.rb +48 -0
- data/vendor/webrat/lib/webrat/core/scope.rb +350 -0
- data/vendor/webrat/lib/webrat/core/session.rb +299 -0
- data/vendor/webrat/lib/webrat/core/xml.rb +115 -0
- data/vendor/webrat/lib/webrat/core/xml/hpricot.rb +19 -0
- data/vendor/webrat/lib/webrat/core/xml/nokogiri.rb +76 -0
- data/vendor/webrat/lib/webrat/core/xml/rexml.rb +24 -0
- data/vendor/webrat/lib/webrat/core_extensions/blank.rb +58 -0
- data/vendor/webrat/lib/webrat/core_extensions/deprecate.rb +8 -0
- data/vendor/webrat/lib/webrat/core_extensions/detect_mapped.rb +12 -0
- data/vendor/webrat/lib/webrat/core_extensions/meta_class.rb +6 -0
- data/vendor/webrat/lib/webrat/core_extensions/nil_to_param.rb +5 -0
- data/vendor/webrat/lib/webrat/core_extensions/tcp_socket.rb +27 -0
- data/vendor/webrat/lib/webrat/mechanize.rb +74 -0
- data/vendor/webrat/lib/webrat/merb.rb +9 -0
- data/vendor/webrat/lib/webrat/merb_multipart_support.rb +27 -0
- data/vendor/webrat/lib/webrat/merb_session.rb +82 -0
- data/vendor/webrat/lib/webrat/rack.rb +25 -0
- data/vendor/webrat/lib/webrat/rails.rb +106 -0
- data/vendor/webrat/lib/webrat/rspec-rails.rb +10 -0
- data/vendor/webrat/lib/webrat/selenium.rb +81 -0
- data/vendor/webrat/lib/webrat/selenium/application_server_factory.rb +40 -0
- data/vendor/webrat/lib/webrat/selenium/application_servers.rb +5 -0
- data/vendor/webrat/lib/webrat/selenium/application_servers/base.rb +46 -0
- data/vendor/webrat/lib/webrat/selenium/application_servers/external.rb +26 -0
- data/vendor/webrat/lib/webrat/selenium/application_servers/merb.rb +50 -0
- data/vendor/webrat/lib/webrat/selenium/application_servers/rails.rb +44 -0
- data/vendor/webrat/lib/webrat/selenium/application_servers/sinatra.rb +37 -0
- data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/button.js +19 -0
- data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/label.js +16 -0
- data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/webrat.js +5 -0
- data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/webratlink.js +12 -0
- data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/webratlinkwithin.js +15 -0
- data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/webratselectwithoption.js +5 -0
- data/vendor/webrat/lib/webrat/selenium/matchers.rb +4 -0
- data/vendor/webrat/lib/webrat/selenium/matchers/have_content.rb +66 -0
- data/vendor/webrat/lib/webrat/selenium/matchers/have_selector.rb +49 -0
- data/vendor/webrat/lib/webrat/selenium/matchers/have_tag.rb +72 -0
- data/vendor/webrat/lib/webrat/selenium/matchers/have_xpath.rb +45 -0
- data/vendor/webrat/lib/webrat/selenium/selenium_extensions.js +6 -0
- data/vendor/webrat/lib/webrat/selenium/selenium_rc_server.rb +84 -0
- data/vendor/webrat/lib/webrat/selenium/selenium_session.rb +248 -0
- data/vendor/webrat/lib/webrat/selenium/silence_stream.rb +18 -0
- data/vendor/webrat/lib/webrat/sinatra.rb +11 -0
- data/vendor/webrat/spec/fakes/test_session.rb +34 -0
- data/vendor/webrat/spec/integration/merb/Rakefile +35 -0
- data/vendor/webrat/spec/integration/merb/app/controllers/application.rb +2 -0
- data/vendor/webrat/spec/integration/merb/app/controllers/exceptions.rb +13 -0
- data/vendor/webrat/spec/integration/merb/app/controllers/testing.rb +27 -0
- data/vendor/webrat/spec/integration/merb/app/views/exceptions/not_acceptable.html.erb +63 -0
- data/vendor/webrat/spec/integration/merb/app/views/exceptions/not_found.html.erb +47 -0
- data/vendor/webrat/spec/integration/merb/app/views/layout/application.html.erb +12 -0
- data/vendor/webrat/spec/integration/merb/app/views/testing/show_form.html.erb +27 -0
- data/vendor/webrat/spec/integration/merb/app/views/testing/upload.html.erb +9 -0
- data/vendor/webrat/spec/integration/merb/config/environments/development.rb +15 -0
- data/vendor/webrat/spec/integration/merb/config/environments/rake.rb +11 -0
- data/vendor/webrat/spec/integration/merb/config/environments/test.rb +14 -0
- data/vendor/webrat/spec/integration/merb/config/init.rb +25 -0
- data/vendor/webrat/spec/integration/merb/config/rack.rb +11 -0
- data/vendor/webrat/spec/integration/merb/config/router.rb +34 -0
- data/vendor/webrat/spec/integration/merb/spec/spec.opts +1 -0
- data/vendor/webrat/spec/integration/merb/spec/spec_helper.rb +24 -0
- data/vendor/webrat/spec/integration/merb/spec/webrat_spec.rb +39 -0
- data/vendor/webrat/spec/integration/merb/tasks/merb.thor/app_script.rb +31 -0
- data/vendor/webrat/spec/integration/merb/tasks/merb.thor/common.rb +64 -0
- data/vendor/webrat/spec/integration/merb/tasks/merb.thor/gem_ext.rb +124 -0
- data/vendor/webrat/spec/integration/merb/tasks/merb.thor/main.thor +150 -0
- data/vendor/webrat/spec/integration/merb/tasks/merb.thor/ops.rb +93 -0
- data/vendor/webrat/spec/integration/merb/tasks/merb.thor/utils.rb +40 -0
- data/vendor/webrat/spec/integration/rack/Rakefile +5 -0
- data/vendor/webrat/spec/integration/rack/app.rb +73 -0
- data/vendor/webrat/spec/integration/rack/test/helper.rb +20 -0
- data/vendor/webrat/spec/integration/rack/test/webrat_rack_test.rb +62 -0
- data/vendor/webrat/spec/integration/rails/Rakefile +30 -0
- data/vendor/webrat/spec/integration/rails/app/controllers/application.rb +15 -0
- data/vendor/webrat/spec/integration/rails/app/controllers/buttons_controller.rb +7 -0
- data/vendor/webrat/spec/integration/rails/app/controllers/fields_controller.rb +4 -0
- data/vendor/webrat/spec/integration/rails/app/controllers/links_controller.rb +7 -0
- data/vendor/webrat/spec/integration/rails/app/controllers/webrat_controller.rb +43 -0
- data/vendor/webrat/spec/integration/rails/app/helpers/buttons_helper.rb +2 -0
- data/vendor/webrat/spec/integration/rails/app/helpers/fields_helper.rb +2 -0
- data/vendor/webrat/spec/integration/rails/app/helpers/links_helper.rb +2 -0
- data/vendor/webrat/spec/integration/rails/app/views/buttons/show.html.erb +11 -0
- data/vendor/webrat/spec/integration/rails/app/views/fields/show.html.erb +9 -0
- data/vendor/webrat/spec/integration/rails/app/views/links/show.html.erb +5 -0
- data/vendor/webrat/spec/integration/rails/app/views/webrat/before_redirect_form.html.erb +4 -0
- data/vendor/webrat/spec/integration/rails/app/views/webrat/buttons.html.erb +11 -0
- data/vendor/webrat/spec/integration/rails/app/views/webrat/form.html.erb +28 -0
- data/vendor/webrat/spec/integration/rails/config/boot.rb +109 -0
- data/vendor/webrat/spec/integration/rails/config/environment.rb +12 -0
- data/vendor/webrat/spec/integration/rails/config/environments/development.rb +17 -0
- data/vendor/webrat/spec/integration/rails/config/environments/selenium.rb +22 -0
- data/vendor/webrat/spec/integration/rails/config/environments/test.rb +22 -0
- data/vendor/webrat/spec/integration/rails/config/initializers/inflections.rb +10 -0
- data/vendor/webrat/spec/integration/rails/config/initializers/mime_types.rb +5 -0
- data/vendor/webrat/spec/integration/rails/config/initializers/new_rails_defaults.rb +17 -0
- data/vendor/webrat/spec/integration/rails/config/locales/en.yml +5 -0
- data/vendor/webrat/spec/integration/rails/config/routes.rb +18 -0
- data/vendor/webrat/spec/integration/rails/public/404.html +30 -0
- data/vendor/webrat/spec/integration/rails/public/422.html +30 -0
- data/vendor/webrat/spec/integration/rails/public/500.html +33 -0
- data/vendor/webrat/spec/integration/rails/script/about +4 -0
- data/vendor/webrat/spec/integration/rails/script/console +3 -0
- data/vendor/webrat/spec/integration/rails/script/dbconsole +3 -0
- data/vendor/webrat/spec/integration/rails/script/destroy +3 -0
- data/vendor/webrat/spec/integration/rails/script/generate +3 -0
- data/vendor/webrat/spec/integration/rails/script/performance/benchmarker +3 -0
- data/vendor/webrat/spec/integration/rails/script/performance/profiler +3 -0
- data/vendor/webrat/spec/integration/rails/script/performance/request +3 -0
- data/vendor/webrat/spec/integration/rails/script/plugin +3 -0
- data/vendor/webrat/spec/integration/rails/script/process/inspector +3 -0
- data/vendor/webrat/spec/integration/rails/script/process/reaper +3 -0
- data/vendor/webrat/spec/integration/rails/script/process/spawner +3 -0
- data/vendor/webrat/spec/integration/rails/script/runner +3 -0
- data/vendor/webrat/spec/integration/rails/script/server +3 -0
- data/vendor/webrat/spec/integration/rails/test/integration/button_click_test.rb +80 -0
- data/vendor/webrat/spec/integration/rails/test/integration/fill_in_test.rb +24 -0
- data/vendor/webrat/spec/integration/rails/test/integration/link_click_test.rb +27 -0
- data/vendor/webrat/spec/integration/rails/test/integration/webrat_test.rb +97 -0
- data/vendor/webrat/spec/integration/rails/test/test_helper.rb +25 -0
- data/vendor/webrat/spec/integration/sinatra/Rakefile +5 -0
- data/vendor/webrat/spec/integration/sinatra/classic_app.rb +64 -0
- data/vendor/webrat/spec/integration/sinatra/modular_app.rb +16 -0
- data/vendor/webrat/spec/integration/sinatra/test/classic_app_test.rb +37 -0
- data/vendor/webrat/spec/integration/sinatra/test/modular_app_test.rb +18 -0
- data/vendor/webrat/spec/integration/sinatra/test/test_helper.rb +16 -0
- data/vendor/webrat/spec/private/core/configuration_spec.rb +116 -0
- data/vendor/webrat/spec/private/core/field_spec.rb +85 -0
- data/vendor/webrat/spec/private/core/link_spec.rb +24 -0
- data/vendor/webrat/spec/private/core/logging_spec.rb +10 -0
- data/vendor/webrat/spec/private/core/session_spec.rb +195 -0
- data/vendor/webrat/spec/private/mechanize/mechanize_session_spec.rb +81 -0
- data/vendor/webrat/spec/private/merb/attaches_file_spec.rb +93 -0
- data/vendor/webrat/spec/private/merb/merb_session_spec.rb +61 -0
- data/vendor/webrat/spec/private/nokogiri_spec.rb +77 -0
- data/vendor/webrat/spec/private/rails/attaches_file_spec.rb +81 -0
- data/vendor/webrat/spec/private/rails/rails_session_spec.rb +112 -0
- data/vendor/webrat/spec/private/selenium/application_servers/rails_spec.rb +26 -0
- data/vendor/webrat/spec/public/basic_auth_spec.rb +24 -0
- data/vendor/webrat/spec/public/check_spec.rb +191 -0
- data/vendor/webrat/spec/public/choose_spec.rb +118 -0
- data/vendor/webrat/spec/public/click_area_spec.rb +106 -0
- data/vendor/webrat/spec/public/click_button_spec.rb +496 -0
- data/vendor/webrat/spec/public/click_link_spec.rb +511 -0
- data/vendor/webrat/spec/public/fill_in_spec.rb +209 -0
- data/vendor/webrat/spec/public/locators/field_by_xpath_spec.rb +19 -0
- data/vendor/webrat/spec/public/locators/field_labeled_spec.rb +172 -0
- data/vendor/webrat/spec/public/locators/field_with_id_spec.rb +16 -0
- data/vendor/webrat/spec/public/matchers/contain_spec.rb +114 -0
- data/vendor/webrat/spec/public/matchers/have_selector_spec.rb +142 -0
- data/vendor/webrat/spec/public/matchers/have_tag_spec.rb +39 -0
- data/vendor/webrat/spec/public/matchers/have_xpath_spec.rb +136 -0
- data/vendor/webrat/spec/public/reload_spec.rb +10 -0
- data/vendor/webrat/spec/public/save_and_open_spec.rb +70 -0
- data/vendor/webrat/spec/public/select_date_spec.rb +112 -0
- data/vendor/webrat/spec/public/select_datetime_spec.rb +137 -0
- data/vendor/webrat/spec/public/select_spec.rb +249 -0
- data/vendor/webrat/spec/public/select_time_spec.rb +100 -0
- data/vendor/webrat/spec/public/selenium/application_server_factory_spec.rb +49 -0
- data/vendor/webrat/spec/public/selenium/application_servers/external_spec.rb +12 -0
- data/vendor/webrat/spec/public/selenium/selenium_session_spec.rb +37 -0
- data/vendor/webrat/spec/public/set_hidden_field_spec.rb +5 -0
- data/vendor/webrat/spec/public/submit_form_spec.rb +5 -0
- data/vendor/webrat/spec/public/visit_spec.rb +58 -0
- data/vendor/webrat/spec/public/within_spec.rb +177 -0
- data/vendor/webrat/spec/rcov.opts +1 -0
- data/vendor/webrat/spec/spec.opts +2 -0
- data/vendor/webrat/spec/spec_helper.rb +50 -0
- metadata +474 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2007 Bryan Helmkamp, Seth Fitzsimmons
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
@@ -0,0 +1,85 @@
|
|
1
|
+
= Webrat - Ruby Acceptance Testing for Web applications
|
2
|
+
|
3
|
+
- http://gitrdoc.com/brynary/webrat
|
4
|
+
- http://groups.google.com/group/webrat
|
5
|
+
- http://webrat.lighthouseapp.com/
|
6
|
+
- http://github.com/brynary/webrat
|
7
|
+
- #webrat on Freenode
|
8
|
+
|
9
|
+
== Description
|
10
|
+
|
11
|
+
Webrat lets you quickly write expressive and robust acceptance tests for a Ruby
|
12
|
+
web application.
|
13
|
+
|
14
|
+
== Features
|
15
|
+
|
16
|
+
* Browser Simulator for expressive, high level acceptance testing without the
|
17
|
+
performance hit and browser dependency of Selenium or Watir (See Webrat::Session)
|
18
|
+
* Use the same API for Browser Simulator and real Selenium tests using
|
19
|
+
Webrat::Selenium when necessary (eg. for testing AJAX interactions)
|
20
|
+
* Supports multiple Ruby web frameworks: Rails, Merb and Sinatra
|
21
|
+
* Supports popular test frameworks: RSpec, Cucumber, Test::Unit and Shoulda
|
22
|
+
* Webrat::Matchers API for verifying rendered HTML using CSS, XPath, etc.
|
23
|
+
|
24
|
+
== Example
|
25
|
+
|
26
|
+
class SignupTest < ActionController::IntegrationTest
|
27
|
+
|
28
|
+
def test_trial_account_sign_up
|
29
|
+
visit home_path
|
30
|
+
click_link "Sign up"
|
31
|
+
fill_in "Email", :with => "good@example.com"
|
32
|
+
select "Free account"
|
33
|
+
click_button "Register"
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
Behind the scenes, Webrat will ensure:
|
39
|
+
|
40
|
+
* If a link, form field or button is missing, the test will fail.
|
41
|
+
* If a URL is invalid, the test will fail.
|
42
|
+
* If a page load or form submission is unsuccessful, the test will fail.
|
43
|
+
|
44
|
+
== Installing Nokogiri
|
45
|
+
|
46
|
+
Users of Debian Linux (e.g. Ubuntu) need to run:
|
47
|
+
|
48
|
+
sudo apt-get install libxslt1-dev libxml2-dev.
|
49
|
+
|
50
|
+
Otherwise the Nokogiri gem, which Webrat depends on, won't install properly.
|
51
|
+
|
52
|
+
== Install for Rails
|
53
|
+
|
54
|
+
To install the latest release as a gem:
|
55
|
+
|
56
|
+
sudo gem install webrat
|
57
|
+
|
58
|
+
To install the latest code as a plugin: (_Note:_ This may be less stable than using a released version)
|
59
|
+
|
60
|
+
script/plugin install git://github.com/brynary/webrat.git
|
61
|
+
|
62
|
+
In your test_helper.rb or env.rb (for Cucumber) add:
|
63
|
+
|
64
|
+
require "webrat"
|
65
|
+
|
66
|
+
Webrat.configure do |config|
|
67
|
+
config.mode = :rails
|
68
|
+
end
|
69
|
+
|
70
|
+
== Install with Merb
|
71
|
+
|
72
|
+
Merb 1.0 has built-in, seamless Webrat support. Just start using
|
73
|
+
methods from Webrat::Session in your specs.
|
74
|
+
|
75
|
+
== Authors
|
76
|
+
|
77
|
+
- Maintained by {Bryan Helmkamp}[mailto:bryan@brynary.com]
|
78
|
+
- Original code written by {Seth Fitzsimmons}[mailto:seth@mojodna.net]
|
79
|
+
- Initial development was sponsored by EastMedia[http://www.eastmedia.com]
|
80
|
+
- Many other contributors. See attributions in History.txt
|
81
|
+
|
82
|
+
== License
|
83
|
+
|
84
|
+
Copyright (c) 2007-2008 Bryan Helmkamp, Seth Fitzsimmons.
|
85
|
+
See MIT-LICENSE.txt in this directory.
|
@@ -0,0 +1,200 @@
|
|
1
|
+
# require 'rubygems'
|
2
|
+
require "rake/gempackagetask"
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
require "rake/clean"
|
5
|
+
gem "rspec", "1.2.6"
|
6
|
+
require 'spec'
|
7
|
+
require 'spec/rake/spectask'
|
8
|
+
require 'spec/rake/verify_rcov'
|
9
|
+
require File.expand_path('./lib/webrat.rb')
|
10
|
+
|
11
|
+
##############################################################################
|
12
|
+
# Package && release
|
13
|
+
##############################################################################
|
14
|
+
spec = Gem::Specification.new do |s|
|
15
|
+
s.name = "webrat"
|
16
|
+
s.version = Webrat::VERSION
|
17
|
+
s.platform = Gem::Platform::RUBY
|
18
|
+
s.author = "Bryan Helmkamp"
|
19
|
+
s.email = "bryan" + "@" + "brynary.com"
|
20
|
+
s.homepage = "http://github.com/brynary/webrat"
|
21
|
+
s.summary = "Webrat. Ruby Acceptance Testing for Web applications"
|
22
|
+
s.bindir = "bin"
|
23
|
+
s.description = s.summary
|
24
|
+
s.require_path = "lib"
|
25
|
+
s.files = %w(History.txt install.rb MIT-LICENSE.txt README.rdoc Rakefile) + Dir["lib/**/*"] + Dir["vendor/**/*"]
|
26
|
+
|
27
|
+
# rdoc
|
28
|
+
s.has_rdoc = true
|
29
|
+
s.extra_rdoc_files = %w(README.rdoc MIT-LICENSE.txt)
|
30
|
+
|
31
|
+
# Dependencies
|
32
|
+
s.add_dependency "nokogiri", ">= 1.2.0"
|
33
|
+
|
34
|
+
s.rubyforge_project = "webrat"
|
35
|
+
end
|
36
|
+
|
37
|
+
Rake::GemPackageTask.new(spec) do |package|
|
38
|
+
package.gem_spec = spec
|
39
|
+
end
|
40
|
+
|
41
|
+
desc 'Show information about the gem.'
|
42
|
+
task :debug_gem do
|
43
|
+
puts spec.to_ruby
|
44
|
+
end
|
45
|
+
|
46
|
+
CLEAN.include ["pkg", "*.gem", "doc", "ri", "coverage"]
|
47
|
+
|
48
|
+
desc "Upload rdoc to brynary.com"
|
49
|
+
task :publish_rdoc => :docs do
|
50
|
+
sh "scp -r doc/ brynary.com:/apps/uploads/webrat"
|
51
|
+
end
|
52
|
+
|
53
|
+
desc "Run API and Core specs"
|
54
|
+
Spec::Rake::SpecTask.new do |t|
|
55
|
+
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
|
56
|
+
t.spec_files = FileList['spec/public/**/*_spec.rb'] + FileList['spec/private/**/*_spec.rb']
|
57
|
+
end
|
58
|
+
|
59
|
+
desc "Run all specs in spec directory with RCov"
|
60
|
+
Spec::Rake::SpecTask.new(:rcov) do |t|
|
61
|
+
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
|
62
|
+
t.spec_files = FileList['spec/public/**/*_spec.rb'] + FileList['spec/private/**/*_spec.rb']
|
63
|
+
t.rcov = true
|
64
|
+
t.rcov_opts = lambda do
|
65
|
+
IO.readlines(File.dirname(__FILE__) + "/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
RCov::VerifyTask.new(:verify_rcov => :rcov) do |t|
|
70
|
+
t.threshold = 96.2 # Make sure you have rcov 0.7 or higher!
|
71
|
+
end
|
72
|
+
|
73
|
+
desc 'Install the package as a gem.'
|
74
|
+
task :install_gem => [:clean, :package] do
|
75
|
+
gem_filename = Dir['pkg/*.gem'].first
|
76
|
+
sh "sudo gem install --no-rdoc --no-ri --local #{gem_filename}"
|
77
|
+
end
|
78
|
+
|
79
|
+
desc "Delete generated RDoc"
|
80
|
+
task :clobber_docs do
|
81
|
+
FileUtils.rm_rf("doc")
|
82
|
+
end
|
83
|
+
|
84
|
+
desc "Generate RDoc"
|
85
|
+
task :docs => :clobber_docs do
|
86
|
+
system "hanna --title 'Webrat #{Webrat::VERSION} API Documentation'"
|
87
|
+
end
|
88
|
+
|
89
|
+
desc "Run everything against multiruby"
|
90
|
+
task :multiruby do
|
91
|
+
result = system "multiruby -S rake spec"
|
92
|
+
raise "Multiruby tests failed" unless result
|
93
|
+
result = system "jruby -S rake spec"
|
94
|
+
raise "JRuby tests failed" unless result
|
95
|
+
|
96
|
+
Dir.chdir "spec/integration/rails" do
|
97
|
+
result = system "multiruby -S rake test_unit:rails"
|
98
|
+
raise "Rails integration tests failed" unless result
|
99
|
+
|
100
|
+
result = system "jruby -S rake test_unit:rails"
|
101
|
+
raise "Rails integration tests failed" unless result
|
102
|
+
end
|
103
|
+
|
104
|
+
Dir.chdir "spec/integration/merb" do
|
105
|
+
result = system "multiruby -S rake spec"
|
106
|
+
raise "Merb integration tests failed" unless result
|
107
|
+
|
108
|
+
result = system "jruby -S rake spec"
|
109
|
+
raise "Rails integration tests failed" unless result
|
110
|
+
end
|
111
|
+
|
112
|
+
Dir.chdir "spec/integration/sinatra" do
|
113
|
+
result = system "multiruby -S rake test"
|
114
|
+
raise "Sinatra integration tests failed" unless result
|
115
|
+
|
116
|
+
result = system "jruby -S rake test"
|
117
|
+
raise "Sinatra integration tests failed" unless result
|
118
|
+
end
|
119
|
+
|
120
|
+
Dir.chdir "spec/integration/rack" do
|
121
|
+
result = system "multiruby -S rake test"
|
122
|
+
raise "Rack integration tests failed" unless result
|
123
|
+
|
124
|
+
result = system "jruby -S rake test"
|
125
|
+
raise "Rack integration tests failed" unless result
|
126
|
+
end
|
127
|
+
|
128
|
+
puts
|
129
|
+
puts "Multiruby OK!"
|
130
|
+
end
|
131
|
+
|
132
|
+
desc "Run each spec in isolation to test for dependency issues"
|
133
|
+
task :spec_deps do
|
134
|
+
Dir["spec/**/*_spec.rb"].each do |test|
|
135
|
+
if !system("spec #{test} &> /dev/null")
|
136
|
+
puts "Dependency Issues: #{test}"
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
task :prepare do
|
142
|
+
system "ln -s ../../../../.. ./spec/integration/rails/vendor/plugins/webrat"
|
143
|
+
end
|
144
|
+
|
145
|
+
namespace :spec do
|
146
|
+
desc "Run the integration specs"
|
147
|
+
task :integration => ["integration:rails", "integration:merb", "integration:sinatra", "integration:rack"]
|
148
|
+
|
149
|
+
namespace :integration do
|
150
|
+
desc "Run the Rails integration specs"
|
151
|
+
task :rails => ['rails:webrat'] #,'rails:selenium'] currently not running selenium as it doesn't pass.
|
152
|
+
|
153
|
+
namespace :rails do
|
154
|
+
task :selenium do
|
155
|
+
Dir.chdir "spec/integration/rails" do
|
156
|
+
result = system "rake test_unit:selenium"
|
157
|
+
raise "Rails integration tests failed" unless result
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
task :webrat do
|
162
|
+
Dir.chdir "spec/integration/rails" do
|
163
|
+
result = system "rake test_unit:rails"
|
164
|
+
raise "Rails integration tests failed" unless result
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
desc "Run the Merb integration specs"
|
170
|
+
task :merb do
|
171
|
+
Dir.chdir "spec/integration/merb" do
|
172
|
+
result = system "rake spec"
|
173
|
+
raise "Merb integration tests failed" unless result
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
desc "Run the Sinatra integration specs"
|
178
|
+
task :sinatra do
|
179
|
+
Dir.chdir "spec/integration/sinatra" do
|
180
|
+
result = system "rake test"
|
181
|
+
raise "Sinatra integration tests failed" unless result
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
desc "Run the Sinatra integration specs"
|
186
|
+
task :rack do
|
187
|
+
Dir.chdir "spec/integration/rack" do
|
188
|
+
result = system "rake test"
|
189
|
+
raise "Rack integration tests failed" unless result
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
task :default => :spec
|
196
|
+
|
197
|
+
desc 'Removes trailing whitespace'
|
198
|
+
task :whitespace do
|
199
|
+
sh %{find . -name '*.rb' -exec sed -i '' 's/ *$//g' {} \\;}
|
200
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
puts IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__)))
|
4
|
+
|
5
|
+
module Webrat
|
6
|
+
# The common base class for all exceptions raised by Webrat.
|
7
|
+
class WebratError < StandardError
|
8
|
+
end
|
9
|
+
|
10
|
+
VERSION = '0.4.4'
|
11
|
+
|
12
|
+
def self.require_xml
|
13
|
+
if on_java?
|
14
|
+
gem "nokogiri", ">= 1.2.4"
|
15
|
+
else
|
16
|
+
gem "nokogiri", ">= 1.0.6"
|
17
|
+
end
|
18
|
+
|
19
|
+
require "nokogiri"
|
20
|
+
require "webrat/core/xml/nokogiri"
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.on_java?
|
24
|
+
RUBY_PLATFORM =~ /java/
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
Webrat.require_xml
|
30
|
+
|
31
|
+
require "webrat/core"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "webrat/core/configuration"
|
2
|
+
require "webrat/core/xml"
|
3
|
+
require "webrat/core/xml/nokogiri"
|
4
|
+
require "webrat/core/logging"
|
5
|
+
require "webrat/core/elements/form"
|
6
|
+
require "webrat/core/scope"
|
7
|
+
require "webrat/core/elements/link"
|
8
|
+
require "webrat/core/elements/area"
|
9
|
+
require "webrat/core/elements/label"
|
10
|
+
require "webrat/core/elements/select_option"
|
11
|
+
require "webrat/core/session"
|
12
|
+
require "webrat/core/methods"
|
13
|
+
require "webrat/core/matchers"
|
14
|
+
require "webrat/core/save_and_open_page"
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require "webrat/core_extensions/deprecate"
|
2
|
+
|
3
|
+
module Webrat
|
4
|
+
|
5
|
+
# Configures Webrat. If this is not done, Webrat will be created
|
6
|
+
# with all of the default settings.
|
7
|
+
def self.configure(configuration = Webrat.configuration)
|
8
|
+
yield configuration if block_given?
|
9
|
+
@@configuration = configuration
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.configuration # :nodoc:
|
13
|
+
@@configuration ||= Webrat::Configuration.new
|
14
|
+
end
|
15
|
+
|
16
|
+
# Webrat can be configured using the Webrat.configure method. For example:
|
17
|
+
#
|
18
|
+
# Webrat.configure do |config|
|
19
|
+
# config.parse_with_nokogiri = false
|
20
|
+
# end
|
21
|
+
class Configuration
|
22
|
+
|
23
|
+
# Should XHTML be parsed with Nokogiri? Defaults to true, except on JRuby. When false, Hpricot and REXML are used
|
24
|
+
attr_writer :parse_with_nokogiri
|
25
|
+
|
26
|
+
# Webrat's mode, set automatically when requiring webrat/rails, webrat/merb, etc.
|
27
|
+
attr_reader :mode # :nodoc:
|
28
|
+
|
29
|
+
# Save and open pages with error status codes (500-599) in a browser? Defualts to true.
|
30
|
+
attr_writer :open_error_files
|
31
|
+
|
32
|
+
# Which rails environment should the selenium tests be run in? Defaults to selenium.
|
33
|
+
attr_accessor :application_environment
|
34
|
+
webrat_deprecate :selenium_environment, :application_environment
|
35
|
+
webrat_deprecate :selenium_environment=, :application_environment=
|
36
|
+
|
37
|
+
# Which port is the application running on for selenium testing? Defaults to 3001.
|
38
|
+
attr_accessor :application_port
|
39
|
+
webrat_deprecate :selenium_port, :application_port
|
40
|
+
webrat_deprecate :selenium_port=, :application_port=
|
41
|
+
|
42
|
+
# Which underlying app framework we're testing with selenium
|
43
|
+
attr_accessor :application_framework
|
44
|
+
|
45
|
+
# Which server the application is running on for selenium testing? Defaults to localhost
|
46
|
+
attr_accessor :application_address
|
47
|
+
|
48
|
+
# Which server Selenium server is running on. Defaults to nil(server starts in webrat process and runs locally)
|
49
|
+
attr_accessor :selenium_server_address
|
50
|
+
|
51
|
+
# Which server Selenium port is running on. Defaults to 4444
|
52
|
+
attr_accessor :selenium_server_port
|
53
|
+
|
54
|
+
# Set the key that Selenium uses to determine the browser running. Default *firefox
|
55
|
+
attr_accessor :selenium_browser_key
|
56
|
+
|
57
|
+
# Set the timeout for waiting for the browser process to start
|
58
|
+
attr_accessor :selenium_browser_startup_timeout
|
59
|
+
|
60
|
+
# How many redirects to the same URL should be halted as an infinite redirect
|
61
|
+
# loop? Defaults to 10
|
62
|
+
attr_accessor :infinite_redirect_limit
|
63
|
+
|
64
|
+
def initialize # :nodoc:
|
65
|
+
self.open_error_files = true
|
66
|
+
self.parse_with_nokogiri = true
|
67
|
+
self.application_environment = :test
|
68
|
+
self.application_port = 3001
|
69
|
+
self.application_address = 'localhost'
|
70
|
+
self.application_framework = :rails
|
71
|
+
self.selenium_server_port = 4444
|
72
|
+
self.infinite_redirect_limit = 10
|
73
|
+
self.selenium_browser_key = '*firefox'
|
74
|
+
self.selenium_browser_startup_timeout = 5
|
75
|
+
end
|
76
|
+
|
77
|
+
def parse_with_nokogiri? #:nodoc:
|
78
|
+
@parse_with_nokogiri ? true : false
|
79
|
+
end
|
80
|
+
|
81
|
+
def open_error_files? #:nodoc:
|
82
|
+
@open_error_files ? true : false
|
83
|
+
end
|
84
|
+
|
85
|
+
# Allows setting of webrat's mode, valid modes are:
|
86
|
+
# :rails, :selenium, :rack, :sinatra, :mechanize, :merb
|
87
|
+
def mode=(mode)
|
88
|
+
@mode = mode.to_sym
|
89
|
+
|
90
|
+
# This is a temporary hack to support backwards compatibility
|
91
|
+
# with Merb 1.0.8 until it's updated to use the new Webrat.configure
|
92
|
+
# syntax
|
93
|
+
if @mode == :merb
|
94
|
+
require("webrat/merb_session")
|
95
|
+
else
|
96
|
+
require("webrat/#{mode}")
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|