davidtrogers-webrat 0.4.4.2 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -1
- data/Gemfile +19 -0
- data/History.txt +99 -9
- data/Rakefile +141 -207
- data/Thorfile +118 -0
- data/lib/webrat.rb +10 -23
- data/lib/webrat/{mechanize.rb → adapters/mechanize.rb} +6 -2
- data/lib/webrat/adapters/merb.rb +11 -0
- data/lib/webrat/adapters/rack.rb +25 -0
- data/lib/webrat/{rails.rb → adapters/rails.rb} +5 -37
- data/lib/webrat/adapters/sinatra.rb +9 -0
- data/lib/webrat/core.rb +0 -1
- data/lib/webrat/core/configuration.rb +22 -18
- data/lib/webrat/core/elements/area.rb +2 -2
- data/lib/webrat/core/elements/element.rb +3 -3
- data/lib/webrat/core/elements/field.rb +113 -31
- data/lib/webrat/core/elements/form.rb +4 -4
- data/lib/webrat/core/elements/label.rb +4 -4
- data/lib/webrat/core/elements/link.rb +8 -7
- data/lib/webrat/core/elements/select_option.rb +15 -2
- data/lib/webrat/core/locators.rb +1 -1
- data/lib/webrat/core/locators/area_locator.rb +3 -3
- data/lib/webrat/core/locators/button_locator.rb +6 -6
- data/lib/webrat/core/locators/field_by_id_locator.rb +3 -3
- data/lib/webrat/core/locators/field_labeled_locator.rb +2 -2
- data/lib/webrat/core/locators/field_named_locator.rb +3 -3
- data/lib/webrat/core/locators/form_locator.rb +1 -1
- data/lib/webrat/core/locators/label_locator.rb +2 -2
- data/lib/webrat/core/locators/link_locator.rb +16 -8
- data/lib/webrat/core/locators/select_option_locator.rb +5 -5
- data/lib/webrat/core/logging.rb +4 -5
- data/lib/webrat/core/matchers/have_content.rb +3 -8
- data/lib/webrat/core/matchers/have_xpath.rb +3 -28
- data/lib/webrat/core/methods.rb +5 -4
- data/lib/webrat/core/mime.rb +11 -22
- data/lib/webrat/core/save_and_open_page.rb +7 -29
- data/lib/webrat/core/scope.rb +17 -2
- data/lib/webrat/core/session.rb +31 -19
- data/lib/webrat/core/xml.rb +41 -84
- data/lib/webrat/integrations/merb.rb +10 -0
- data/lib/webrat/integrations/rails.rb +25 -0
- data/lib/webrat/integrations/rspec-rails.rb +11 -0
- data/lib/webrat/integrations/selenium.rb +11 -0
- data/lib/webrat/rspec-rails.rb +2 -13
- data/lib/webrat/selenium.rb +0 -11
- data/lib/webrat/selenium/application_server_factory.rb +40 -0
- data/lib/webrat/selenium/application_servers.rb +5 -0
- data/lib/webrat/selenium/application_servers/base.rb +46 -0
- data/lib/webrat/selenium/application_servers/external.rb +26 -0
- data/lib/webrat/selenium/application_servers/merb.rb +50 -0
- data/lib/webrat/selenium/application_servers/rails.rb +44 -0
- data/lib/webrat/selenium/application_servers/sinatra.rb +37 -0
- data/lib/webrat/selenium/location_strategy_javascript/label.js +30 -3
- data/lib/webrat/selenium/location_strategy_javascript/webrat.js +1 -0
- data/lib/webrat/selenium/location_strategy_javascript/webratlink.js +24 -4
- data/lib/webrat/selenium/matchers/have_content.rb +22 -10
- data/lib/webrat/selenium/matchers/have_selector.rb +8 -0
- data/lib/webrat/selenium/matchers/have_xpath.rb +8 -0
- data/lib/webrat/selenium/selenium_rc_server.rb +8 -6
- data/lib/webrat/selenium/selenium_session.rb +43 -14
- data/lib/webrat/selenium/silence_stream.rb +2 -2
- data/spec/fakes/{test_session.rb → test_adapter.rb} +4 -5
- data/spec/integration/mechanize/Rakefile +7 -0
- data/spec/integration/mechanize/config.ru +2 -0
- data/spec/integration/mechanize/sample_app.rb +20 -0
- data/spec/integration/mechanize/spec/mechanize_spec.rb +22 -0
- data/spec/integration/mechanize/spec/spec_helper.rb +29 -0
- data/spec/integration/merb/app/controllers/testing.rb +9 -0
- data/spec/integration/merb/app/views/testing/upload.html.erb +9 -0
- data/spec/integration/merb/config/router.rb +1 -0
- data/spec/integration/merb/spec/spec_helper.rb +2 -0
- data/spec/integration/merb/spec/webrat_spec.rb +7 -0
- data/spec/integration/rack/app.rb +89 -0
- data/spec/integration/rack/test/helper.rb +21 -0
- data/spec/integration/rack/test/webrat_rack_test.rb +57 -51
- data/spec/integration/rails/app/controllers/{application.rb → application_controller.rb} +0 -0
- data/spec/integration/rails/app/controllers/webrat_controller.rb +16 -9
- data/spec/integration/rails/app/views/buttons/show.html.erb +0 -2
- data/spec/integration/rails/app/views/links/show.html.erb +2 -1
- data/spec/integration/rails/app/views/webrat/buttons.html.erb +0 -2
- data/spec/integration/rails/app/views/webrat/within.html.erb +3 -0
- data/spec/integration/rails/config/environment.rb +1 -1
- data/spec/integration/rails/config/routes.rb +2 -0
- data/spec/integration/rails/test/integration/button_click_test.rb +12 -26
- data/spec/integration/rails/test/integration/fill_in_test.rb +1 -1
- data/spec/integration/rails/test/integration/link_click_test.rb +8 -2
- data/spec/integration/rails/test/integration/webrat_test.rb +53 -5
- data/spec/integration/rails/test/test_helper.rb +7 -5
- data/spec/integration/sinatra/test/test_helper.rb +3 -2
- data/spec/private/core/configuration_spec.rb +8 -27
- data/spec/private/core/field_spec.rb +14 -16
- data/spec/private/core/link_spec.rb +1 -1
- data/spec/private/core/session_spec.rb +23 -26
- data/spec/private/mechanize/{mechanize_session_spec.rb → mechanize_adapter_spec.rb} +4 -12
- data/spec/private/nokogiri_spec.rb +2 -2
- data/spec/private/rails/{rails_session_spec.rb → rails_adapter_spec.rb} +11 -42
- data/spec/private/selenium/application_servers/rails_spec.rb +26 -0
- data/spec/public/basic_auth_spec.rb +13 -2
- data/spec/public/click_button_spec.rb +10 -12
- data/spec/public/click_link_spec.rb +21 -0
- data/spec/public/fill_in_spec.rb +15 -0
- data/spec/public/matchers/contain_spec.rb +12 -19
- data/spec/public/matchers/have_selector_spec.rb +6 -2
- data/spec/public/matchers/have_xpath_spec.rb +3 -3
- data/spec/public/save_and_open_spec.rb +15 -17
- data/spec/public/select_spec.rb +232 -26
- data/spec/public/selenium/application_server_factory_spec.rb +49 -0
- data/spec/public/selenium/application_servers/external_spec.rb +12 -0
- data/spec/public/selenium/selenium_session_spec.rb +37 -0
- data/spec/spec_helper.rb +5 -1
- data/vendor/selenium-server.jar +0 -0
- metadata +119 -69
- data/.dotest/0001 +0 -34
- data/.dotest/0002 +0 -34
- data/.dotest/binary +0 -1
- data/.dotest/final-commit +0 -1
- data/.dotest/head-name +0 -1
- data/.dotest/info +0 -5
- data/.dotest/keep +0 -1
- data/.dotest/last +0 -1
- data/.dotest/msg +0 -0
- data/.dotest/msg-clean +0 -0
- data/.dotest/next +0 -1
- data/.dotest/onto +0 -1
- data/.dotest/orig-head +0 -1
- data/.dotest/patch +0 -29
- data/.dotest/sign +0 -1
- data/.dotest/utf8 +0 -1
- data/.dotest/whitespace +0 -1
- data/VERSION +0 -1
- data/lib/webrat/core/xml/hpricot.rb +0 -19
- data/lib/webrat/core/xml/nokogiri.rb +0 -76
- data/lib/webrat/core/xml/rexml.rb +0 -24
- data/lib/webrat/merb_session.rb +0 -65
- data/lib/webrat/rack.rb +0 -24
- data/lib/webrat/rack_test.rb +0 -32
- data/lib/webrat/selenium/application_server.rb +0 -73
- data/lib/webrat/selenium/merb_application_server.rb +0 -48
- data/lib/webrat/selenium/rails_application_server.rb +0 -42
- data/lib/webrat/selenium/sinatra_application_server.rb +0 -35
- data/lib/webrat/sinatra.rb +0 -44
- data/spec/integration/rack/rack_app.rb +0 -16
- data/spec/integration/rack/test/test_helper.rb +0 -20
- data/spec/private/core/logging_spec.rb +0 -10
- data/spec/private/merb/merb_session_spec.rb +0 -42
data/.gitignore
CHANGED
data/Gemfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
clear_sources
|
2
|
+
source 'http://gemcutter.org'
|
3
|
+
|
4
|
+
disable_system_gems
|
5
|
+
|
6
|
+
gem "git", "1.2.5"
|
7
|
+
gem "rake", "0.8.7"
|
8
|
+
gem "rspec", "1.2.9"
|
9
|
+
gem "diff-lcs", "1.1.2"
|
10
|
+
gem "rack", "1.0.1"
|
11
|
+
gem "nokogiri", "1.4.0"
|
12
|
+
gem "merb-core", "1.0.15"
|
13
|
+
gem "selenium-client", "1.2.17"
|
14
|
+
gem "mechanize", "0.9.3"
|
15
|
+
gem "rails", "2.3.4"
|
16
|
+
gem "launchy", "0.3.3"
|
17
|
+
gem "rack-test", "0.5.2"
|
18
|
+
gem "sinatra", "0.9.4"
|
19
|
+
gem "mongrel", "1.1.5"
|
data/History.txt
CHANGED
@@ -1,11 +1,95 @@
|
|
1
|
-
|
1
|
+
* Minor enhancements
|
2
|
+
|
3
|
+
* Added application_port_for_selenium to webrat configuration. The use case is when you want to test through a web server sitting in front of your application server. (Luke Melia)
|
4
|
+
|
5
|
+
== 0.7.0 / 2010-01-17
|
2
6
|
|
3
7
|
* Major enhancements
|
4
8
|
|
9
|
+
* Upgrade bundled Selenium server JAR to 2.0a1 (Henry Poydar and Jake Scruggs)
|
10
|
+
|
11
|
+
* Minor enhancements
|
12
|
+
|
13
|
+
* Save and open page directory specified via configuration, defaults to tmp dir otherwise current dir (Noah Davis)
|
14
|
+
|
15
|
+
* Bug fixes
|
16
|
+
|
17
|
+
* Added missing dependency "rack-test" to gemspec (LH #339) (Noah Davis)
|
18
|
+
* Removed save_and_open_page's rewriting of static asset paths before saving (was not actually working) (Noah Davis)
|
19
|
+
* Make "should contain" ignore extra whitespace when doing string comparisons (Noah Davis)
|
20
|
+
* Make selenium matchers handle negative match more consistently with positive match (Luke Melia)
|
21
|
+
|
22
|
+
== 0.6.0 / 2009-11-28
|
23
|
+
|
24
|
+
REMOVED: Support for Hpricot + REXML as an alternative to Nokogiri.
|
25
|
+
|
26
|
+
Hpricot and REXML were difficult to work with, REXML is terribly slow,
|
27
|
+
and Nokogiri is recommended even by the author of Hpricot (_why). Now
|
28
|
+
that Nokogiri works on JRuby, Webrat is going to use it as its sole
|
29
|
+
XML backend.
|
30
|
+
|
31
|
+
CHANGED: Due to a reorganization, if you're currently requiring "webrat/rspec-rails",
|
32
|
+
please change your code to require "webrat/integrations/rspec-rails"
|
33
|
+
|
34
|
+
* Minor enhancements
|
35
|
+
|
36
|
+
* Support Rails 2.3.4 JavaScript form authenticity tokens in simulated mode (Jonathan Weiss)
|
37
|
+
* When a timeout occurs in wait_for, include the HTML from Selenium in the exception
|
38
|
+
* Update the Merb support to be based directly on Rack (Simon Rozet)
|
39
|
+
* Support multiple select fields (Kieran P)
|
40
|
+
* When locating select options, always match against text, not HTML
|
41
|
+
|
42
|
+
* Bug fixes
|
43
|
+
|
44
|
+
* Remove newlines from HTTP Basic authentication credentials (Michael Klett)
|
45
|
+
* Require nokogiri form rspec-rails.rb (David Chelimsky)
|
46
|
+
* Fix logger issue when running inside Cucumber (Damian Janowski)
|
47
|
+
* Fix various issues related to submitting values with HTML entities (Kieran P)
|
48
|
+
* Call #to_i on the :count option in matchers (Michael Christenson II)
|
49
|
+
* Fix bug where multiline param values were getting truncated
|
50
|
+
|
51
|
+
== 0.5.3 / 2009-08-27
|
52
|
+
|
53
|
+
* Minor enhancements
|
54
|
+
|
55
|
+
* Remove unnecessary requires which are to the wrong paths on Edge Rails
|
56
|
+
|
57
|
+
== 0.5.1 / 2009-08-18
|
58
|
+
|
59
|
+
* Minor enhancements
|
60
|
+
|
61
|
+
* Base Webrat::MIME on Rack::Mime (Simon Rozet)
|
62
|
+
* Support file uploads in Rack mode (Simon Rozet)
|
63
|
+
|
64
|
+
* Bug fixes
|
65
|
+
|
66
|
+
* Fix bug in Webrat::Methods preventing Selenium mode from working [#277]
|
67
|
+
|
68
|
+
== 0.5.0 / 2009-08-12
|
69
|
+
|
70
|
+
* Major enhancements
|
71
|
+
|
72
|
+
* Depreacate :rack_test and :sinatra in favor of :rack, which uses Rack::Test (Simon Rozet)
|
73
|
+
|
74
|
+
* Minor enhancements
|
75
|
+
|
76
|
+
* Don't require rubygems at runtime (Simon Rozet)
|
77
|
+
|
78
|
+
== 0.4.5 / 2009-08-10
|
79
|
+
|
80
|
+
* Major enhancements
|
81
|
+
|
82
|
+
* Ruby 1.9 compatibility (Michael Fellinger, Jakub Kuźma)
|
5
83
|
* Improve performance (~2x) on JRuby by supporting Nokogiri
|
84
|
+
* Added support for external app servers in selenium mode (basically don't start one) (Mike Gaffney)
|
85
|
+
* Added support for uploading files for Merb (Ryan Carver)
|
6
86
|
|
7
87
|
* Minor enhancements
|
8
88
|
|
89
|
+
* Upgrade to selenium-client to 1.2.16 (Brian Landau)
|
90
|
+
* Upgrade selenium-server.jar to 1.0.1 (Brian Landau)
|
91
|
+
* Make redirect detection work in the face of rational maths (like when ruby-units is active) (Piers Cawley)
|
92
|
+
* Use Launchy to handle opening pages in the browser with cross-platform compatibility (Bryan Helmkamp)
|
9
93
|
* Added support for field_labeled_locators ending in non word characters
|
10
94
|
lh 148 (Zach Dennis)
|
11
95
|
* Filled in tests on click link lh 195 (diabolo)
|
@@ -19,15 +103,21 @@
|
|
19
103
|
* Adding fix for have_selector and have_xpath in descendent blocks lh234 (Thomas Jack)
|
20
104
|
* Adding fix for fields with labels with special characters (Thomas Jack, Mike Gaffney, Bryan Hemlkamp)
|
21
105
|
* Deprecated current_page lh50 (Mike Gaffney)
|
106
|
+
* Fixed issue with redirects and multiple hosts lh168 (Mutwin Kraus)
|
107
|
+
|
108
|
+
* Bug fixes
|
109
|
+
|
110
|
+
* Wait for application servers socket on 0.0.0.0 instead of the application_address
|
111
|
+
* Translate CSS and image paths with single quotes in save_and_open_page (Erin Staniland)
|
22
112
|
|
23
113
|
== 0.4.4 / 2009-04-06
|
24
114
|
|
25
115
|
* Major enhancements
|
26
116
|
|
27
117
|
* Make selenium process management code more robust and informative
|
28
|
-
|
118
|
+
|
29
119
|
* Minor enhancements
|
30
|
-
|
120
|
+
|
31
121
|
* Add support for Rails javascript post links (Mark Menard)
|
32
122
|
* Upgrade selenium-client dependency to 1.2.14, and update for new waiting
|
33
123
|
API (Balint Erdi)
|
@@ -38,7 +128,7 @@
|
|
38
128
|
* Don't create a new instance of WWW::Mechanize for each request
|
39
129
|
(Mark Menard)
|
40
130
|
* Select fields with duplicate selected options sent an incorrect value (Noah Davis)
|
41
|
-
|
131
|
+
|
42
132
|
== 0.4.3 / 2009-03-17
|
43
133
|
|
44
134
|
* Minor enhancements
|
@@ -48,7 +138,7 @@
|
|
48
138
|
* Initial Merb and Sinatra compatibility for Selenium mode (Corey Donohoe)
|
49
139
|
* When faced with a label with no for attribute, that contains a hidden field
|
50
140
|
and another field, as can be the case in Rails 2.3's checkbox view,
|
51
|
-
webrat now locates the non-hidden field. (Luke Melia)
|
141
|
+
webrat now locates the non-hidden field. (Luke Melia)
|
52
142
|
* Add application_framework config for Selenium mode to determine how to
|
53
143
|
start and stop the app server (Corey Donohoe)
|
54
144
|
|
@@ -64,7 +154,7 @@
|
|
64
154
|
attributes in a hash and :count and :content options. See
|
65
155
|
have_selector_spec.rb for more.
|
66
156
|
* Add the same functionality mentioned above to have_xpath
|
67
|
-
|
157
|
+
|
68
158
|
* Minor enhancements
|
69
159
|
|
70
160
|
* Squeeze extra whitespace out of failures messages from contain
|
@@ -91,7 +181,7 @@
|
|
91
181
|
redirected to (Adam Greene)
|
92
182
|
* Recognize input tags with type button (Lena Herrmann)
|
93
183
|
* Add uncheck method to Selenium mode (Lee Bankewitz)
|
94
|
-
|
184
|
+
|
95
185
|
* Bug fixes
|
96
186
|
|
97
187
|
* Make requests to a Rails app using a full URL instead of a relative path. This change
|
@@ -102,7 +192,7 @@
|
|
102
192
|
to behave correctly (Noah Davis)
|
103
193
|
* Switch to using selenium.click instead of .check when checking a checkbox
|
104
194
|
(Noah Davis)
|
105
|
-
* Create tmp/pids directory if directory does not exist. (Amos King and Mike Gaffney)
|
195
|
+
* Create tmp/pids directory if directory does not exist. (Amos King and Mike Gaffney)
|
106
196
|
* Setup deprecated writers for the selenium_environment= and selenium_port= config
|
107
197
|
* Ensure the previous pages params aren't passed through redirect (Daniel Lucraft and
|
108
198
|
Bryan Helmkamp)
|
@@ -178,7 +268,7 @@
|
|
178
268
|
* Added save_and_open_screengrab for Selenium mode (Luke Melia)
|
179
269
|
|
180
270
|
* Bug fixes
|
181
|
-
|
271
|
+
|
182
272
|
* field_labeled should disregard labels without matching fields (Kyle Hargraves)
|
183
273
|
* Fixed bug where Scope was creating a new DOM rather than re-using the existing DOM.
|
184
274
|
[#105] (Zach Dennis)
|
data/Rakefile
CHANGED
@@ -1,211 +1,145 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
|
1
|
+
require "rubygems"
|
2
|
+
|
4
3
|
begin
|
5
|
-
require '
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "webrat"
|
8
|
-
#gem.executables = "steamer"
|
9
|
-
gem.summary = %Q{modified version of webrat}
|
10
|
-
gem.email = "david.t.rogers@gmail.com"
|
11
|
-
gem.homepage = "http://github.com/davidtrogers/webrat"
|
12
|
-
gem.authors = ["brynary"]
|
13
|
-
# gem.version = "#{version}.#{Time.now.to_i}"
|
14
|
-
gem.rdoc_options = ["--inline-source", "--charset=UTF-8"]
|
15
|
-
gem.require_paths = ["lib"]
|
16
|
-
gem.rubygems_version = %q{1.3.3}
|
17
|
-
gem.add_dependency "activerecord"
|
18
|
-
# puts "version: #{version}.#{Time.now.to_i}"
|
19
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
20
|
-
# if s.respond_to? :specification_version then
|
21
|
-
# current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
22
|
-
# s.specification_version = 2
|
23
|
-
# if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
24
|
-
# else
|
25
|
-
# end
|
26
|
-
# else
|
27
|
-
# end
|
28
|
-
end
|
29
|
-
|
4
|
+
require 'spec/rake/spectask'
|
30
5
|
rescue LoadError
|
31
|
-
|
6
|
+
desc "Run specs"
|
7
|
+
task(:spec) { $stderr.puts '`gem install rspec` to run specs' }
|
8
|
+
else
|
9
|
+
desc "Run API and Core specs"
|
10
|
+
Spec::Rake::SpecTask.new do |t|
|
11
|
+
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
|
12
|
+
t.spec_files = FileList['spec/public/**/*_spec.rb'] + FileList['spec/private/**/*_spec.rb']
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "Run all specs in spec directory with RCov"
|
16
|
+
Spec::Rake::SpecTask.new(:rcov) do |t|
|
17
|
+
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
|
18
|
+
t.spec_files = FileList['spec/public/**/*_spec.rb'] + FileList['spec/private/**/*_spec.rb']
|
19
|
+
t.rcov = true
|
20
|
+
t.rcov_opts = lambda do
|
21
|
+
IO.readlines(File.dirname(__FILE__) + "/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "Run everything against multiruby"
|
27
|
+
task :multiruby do
|
28
|
+
result = system "multiruby -S rake spec"
|
29
|
+
raise "Multiruby tests failed" unless result
|
30
|
+
result = system "jruby -S rake spec"
|
31
|
+
raise "JRuby tests failed" unless result
|
32
|
+
|
33
|
+
Dir.chdir "spec/integration/rails" do
|
34
|
+
result = system "multiruby -S rake test_unit:rails"
|
35
|
+
raise "Rails integration tests failed" unless result
|
36
|
+
|
37
|
+
result = system "jruby -S rake test_unit:rails"
|
38
|
+
raise "Rails integration tests failed" unless result
|
39
|
+
end
|
40
|
+
|
41
|
+
Dir.chdir "spec/integration/merb" do
|
42
|
+
result = system "multiruby -S rake spec"
|
43
|
+
raise "Merb integration tests failed" unless result
|
44
|
+
|
45
|
+
result = system "jruby -S rake spec"
|
46
|
+
raise "Rails integration tests failed" unless result
|
47
|
+
end
|
48
|
+
|
49
|
+
Dir.chdir "spec/integration/sinatra" do
|
50
|
+
result = system "multiruby -S rake test"
|
51
|
+
raise "Sinatra integration tests failed" unless result
|
52
|
+
|
53
|
+
result = system "jruby -S rake test"
|
54
|
+
raise "Sinatra integration tests failed" unless result
|
55
|
+
end
|
56
|
+
|
57
|
+
Dir.chdir "spec/integration/rack" do
|
58
|
+
result = system "multiruby -S rake test"
|
59
|
+
raise "Rack integration tests failed" unless result
|
60
|
+
|
61
|
+
result = system "jruby -S rake test"
|
62
|
+
raise "Rack integration tests failed" unless result
|
63
|
+
end
|
64
|
+
|
65
|
+
puts
|
66
|
+
puts "Multiruby OK!"
|
67
|
+
end
|
68
|
+
|
69
|
+
desc "Run each spec in isolation to test for dependency issues"
|
70
|
+
task :spec_deps do
|
71
|
+
Dir["spec/**/*_spec.rb"].each do |test|
|
72
|
+
if !system("spec #{test} &> /dev/null")
|
73
|
+
puts "Dependency Issues: #{test}"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
namespace :spec do
|
79
|
+
desc "Run the integration specs"
|
80
|
+
task :integration => [
|
81
|
+
"integration:rack",
|
82
|
+
"integration:sinatra",
|
83
|
+
"integration:merb",
|
84
|
+
"integration:mechanize",
|
85
|
+
"integration:rails:webrat",
|
86
|
+
"integration:rails:selenium",
|
87
|
+
]
|
88
|
+
|
89
|
+
namespace :integration do
|
90
|
+
namespace :rails do
|
91
|
+
task :selenium do
|
92
|
+
Dir.chdir "spec/integration/rails" do
|
93
|
+
result = system "rake test_unit:selenium"
|
94
|
+
raise "Rails integration tests failed" unless result
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
task :webrat do
|
99
|
+
Dir.chdir "spec/integration/rails" do
|
100
|
+
result = system "rake test_unit:rails"
|
101
|
+
raise "Rails integration tests failed" unless result
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
desc "Run the Merb integration specs"
|
107
|
+
task :merb do
|
108
|
+
Dir.chdir "spec/integration/merb" do
|
109
|
+
result = system "rake spec"
|
110
|
+
raise "Merb integration tests failed" unless result
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
desc "Run the Sinatra integration specs"
|
115
|
+
task :sinatra do
|
116
|
+
Dir.chdir "spec/integration/sinatra" do
|
117
|
+
result = system "rake test"
|
118
|
+
raise "Sinatra integration tests failed" unless result
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
desc "Run the Sinatra integration specs"
|
123
|
+
task :rack do
|
124
|
+
Dir.chdir "spec/integration/rack" do
|
125
|
+
result = system "rake test"
|
126
|
+
raise "Rack integration tests failed" unless result
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
desc "Run the Mechanize integration specs"
|
131
|
+
task :mechanize do
|
132
|
+
Dir.chdir "spec/integration/mechanize" do
|
133
|
+
result = system "rake spec"
|
134
|
+
raise "Mechanize integration tests failed" unless result
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
desc 'Removes trailing whitespace'
|
141
|
+
task :whitespace do
|
142
|
+
sh %{find . -name '*.rb' -exec sed -i '' 's/ *$//g' {} \\;}
|
32
143
|
end
|
33
144
|
|
34
|
-
|
35
|
-
# require "rake/gempackagetask"
|
36
|
-
# require 'rake/rdoctask'
|
37
|
-
# require "rake/clean"
|
38
|
-
# require 'spec'
|
39
|
-
# require 'spec/rake/spectask'
|
40
|
-
# require 'spec/rake/verify_rcov'
|
41
|
-
# require File.expand_path('./lib/webrat.rb')
|
42
|
-
|
43
|
-
##############################################################################
|
44
|
-
# Package && release
|
45
|
-
##############################################################################
|
46
|
-
# spec = Gem::Specification.new do |s|
|
47
|
-
# s.name = "webrat"
|
48
|
-
# s.version = "#{Webrat::VERSION}.0.#{Time.now.to_i}"
|
49
|
-
# s.platform = Gem::Platform::RUBY
|
50
|
-
# s.author = "Bryan Helmkamp"
|
51
|
-
# s.email = "bryan" + "@" + "brynary.com"
|
52
|
-
# s.homepage = "http://github.com/brynary/webrat"
|
53
|
-
# s.summary = "Webrat. Ruby Acceptance Testing for Web applications"
|
54
|
-
# s.bindir = "bin"
|
55
|
-
# s.description = s.summary
|
56
|
-
# s.require_path = "lib"
|
57
|
-
# s.files = %w(History.txt install.rb MIT-LICENSE.txt README.rdoc Rakefile) + Dir["lib/**/*"] + Dir["vendor/**/*"]
|
58
|
-
#
|
59
|
-
# # rdoc
|
60
|
-
# s.has_rdoc = true
|
61
|
-
# s.extra_rdoc_files = %w(README.rdoc MIT-LICENSE.txt)
|
62
|
-
#
|
63
|
-
# # Dependencies
|
64
|
-
# s.add_dependency "nokogiri", ">= 1.2.0"
|
65
|
-
#
|
66
|
-
# s.rubyforge_project = "webrat"
|
67
|
-
# end
|
68
|
-
# #
|
69
|
-
#
|
70
|
-
# begin
|
71
|
-
# require 'jeweler'
|
72
|
-
# Jeweler::Tasks.new do |gemspec|
|
73
|
-
# gemspec.name = "webrat"
|
74
|
-
# gemspec.summary = "webrat rocks the house"
|
75
|
-
# gemspec.email = "david.t.rogers@gmail.com"
|
76
|
-
# gemspec.homepage = "http://github.com/davidtrogers/webrat"
|
77
|
-
# gemspec.description = "TODO"
|
78
|
-
# gemspec.authors = ["Dave Rogers"]
|
79
|
-
# gemspec.add_dependency "nokogiri", ">= 1.2.0"
|
80
|
-
# #
|
81
|
-
# # s.rubyforge_project = "webrat"
|
82
|
-
# end
|
83
|
-
# rescue LoadError
|
84
|
-
# puts "Webrat not available."
|
85
|
-
# end
|
86
|
-
#
|
87
|
-
#
|
88
|
-
# desc "Generate a gemspec file"
|
89
|
-
# task :gemspec do
|
90
|
-
# File.open("#{spec.name}.gemspec", 'w') do |f|
|
91
|
-
# f.write spec.to_yaml
|
92
|
-
# end
|
93
|
-
# end
|
94
|
-
#
|
95
|
-
# Rake::GemPackageTask.new(spec) do |package|
|
96
|
-
# package.gem_spec = spec
|
97
|
-
# end
|
98
|
-
#
|
99
|
-
# desc 'Show information about the gem.'
|
100
|
-
# task :debug_gem do
|
101
|
-
# puts spec.to_ruby
|
102
|
-
# end
|
103
|
-
#
|
104
|
-
# CLEAN.include ["pkg", "*.gem", "doc", "ri", "coverage"]
|
105
|
-
#
|
106
|
-
# desc "Upload rdoc to brynary.com"
|
107
|
-
# task :publish_rdoc => :docs do
|
108
|
-
# sh "scp -r doc/ brynary.com:/apps/uploads/webrat"
|
109
|
-
# end
|
110
|
-
#
|
111
|
-
# desc "Run API and Core specs"
|
112
|
-
# Spec::Rake::SpecTask.new do |t|
|
113
|
-
# t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
|
114
|
-
# t.spec_files = FileList['spec/public/**/*_spec.rb'] + FileList['spec/private/**/*_spec.rb']
|
115
|
-
# end
|
116
|
-
#
|
117
|
-
# desc "Run all specs in spec directory with RCov"
|
118
|
-
# Spec::Rake::SpecTask.new(:rcov) do |t|
|
119
|
-
# t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
|
120
|
-
# t.spec_files = FileList['spec/public/**/*_spec.rb'] + FileList['spec/private/**/*_spec.rb']
|
121
|
-
# t.rcov = true
|
122
|
-
# t.rcov_opts = lambda do
|
123
|
-
# IO.readlines(File.dirname(__FILE__) + "/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
|
124
|
-
# end
|
125
|
-
# end
|
126
|
-
#
|
127
|
-
# RCov::VerifyTask.new(:verify_rcov => :rcov) do |t|
|
128
|
-
# t.threshold = 96.2 # Make sure you have rcov 0.7 or higher!
|
129
|
-
# end
|
130
|
-
#
|
131
|
-
# desc 'Install the package as a gem.'
|
132
|
-
# task :install_gem => [:clean, :package] do
|
133
|
-
# gem_filename = Dir['pkg/*.gem'].first
|
134
|
-
# sh "sudo gem install --no-rdoc --no-ri --local #{gem_filename}"
|
135
|
-
# end
|
136
|
-
#
|
137
|
-
# desc "Delete generated RDoc"
|
138
|
-
# task :clobber_docs do
|
139
|
-
# FileUtils.rm_rf("doc")
|
140
|
-
# end
|
141
|
-
#
|
142
|
-
# desc "Generate RDoc"
|
143
|
-
# task :docs => :clobber_docs do
|
144
|
-
# system "hanna --title 'Webrat #{Webrat::VERSION} API Documentation'"
|
145
|
-
# end
|
146
|
-
#
|
147
|
-
# desc "Run specs using jruby"
|
148
|
-
# task "spec:jruby" do
|
149
|
-
# result = system "jruby -S rake spec"
|
150
|
-
# raise "JRuby tests failed" unless result
|
151
|
-
# end
|
152
|
-
#
|
153
|
-
# desc "Run each spec in isolation to test for dependency issues"
|
154
|
-
# task :spec_deps do
|
155
|
-
# Dir["spec/**/*_spec.rb"].each do |test|
|
156
|
-
# if !system("spec #{test} &> /dev/null")
|
157
|
-
# puts "Dependency Issues: #{test}"
|
158
|
-
# end
|
159
|
-
# end
|
160
|
-
# end
|
161
|
-
#
|
162
|
-
# task :prepare do
|
163
|
-
# system "ln -s ../../../../.. ./spec/integration/rails/vendor/plugins/webrat"
|
164
|
-
# end
|
165
|
-
#
|
166
|
-
# namespace :spec do
|
167
|
-
# desc "Run the integration specs"
|
168
|
-
# task :integration => ["integration:rails", "integration:merb", "integration:sinatra"]
|
169
|
-
#
|
170
|
-
# namespace :integration do
|
171
|
-
# desc "Run the Rails integration specs"
|
172
|
-
# task :rails => ['rails:webrat'] #,'rails:selenium'] currently not running selenium as it doesn't pass.
|
173
|
-
#
|
174
|
-
# namespace :rails do
|
175
|
-
# task :selenium do
|
176
|
-
# Dir.chdir "spec/integration/rails" do
|
177
|
-
# result = system "rake test_unit:selenium"
|
178
|
-
# raise "Rails integration tests failed" unless result
|
179
|
-
# end
|
180
|
-
# end
|
181
|
-
#
|
182
|
-
# task :webrat do
|
183
|
-
# Dir.chdir "spec/integration/rails" do
|
184
|
-
# result = system "rake test_unit:rails"
|
185
|
-
# raise "Rails integration tests failed" unless result
|
186
|
-
# end
|
187
|
-
# end
|
188
|
-
# end
|
189
|
-
#
|
190
|
-
# desc "Run the Merb integration specs"
|
191
|
-
# task :merb do
|
192
|
-
# Dir.chdir "spec/integration/merb" do
|
193
|
-
# result = system "rake spec"
|
194
|
-
# raise "Merb integration tests failed" unless result
|
195
|
-
# end
|
196
|
-
# end
|
197
|
-
#
|
198
|
-
# desc "Run the Sinatra integration specs"
|
199
|
-
# task :sinatra do
|
200
|
-
# Dir.chdir "spec/integration/sinatra" do
|
201
|
-
# result = system "rake test"
|
202
|
-
# raise "Sinatra tntegration tests failed" unless result
|
203
|
-
# end
|
204
|
-
# end
|
205
|
-
# end
|
206
|
-
# end
|
207
|
-
#
|
208
|
-
# task :default => :spec
|
209
|
-
#
|
210
|
-
# task :precommit => ["spec", "spec:jruby", "spec:integration"]
|
211
|
-
#
|
145
|
+
task :default => :spec
|