mmurphy-webrat 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/webrat.rb +34 -0
- data/lib/webrat/core.rb +14 -0
- data/lib/webrat/core/configuration.rb +98 -0
- data/lib/webrat/core/elements/area.rb +31 -0
- data/lib/webrat/core/elements/element.rb +33 -0
- data/lib/webrat/core/elements/field.rb +403 -0
- data/lib/webrat/core/elements/form.rb +103 -0
- data/lib/webrat/core/elements/label.rb +31 -0
- data/lib/webrat/core/elements/link.rb +90 -0
- data/lib/webrat/core/elements/select_option.rb +35 -0
- data/lib/webrat/core/locators.rb +20 -0
- data/lib/webrat/core/locators/area_locator.rb +38 -0
- data/lib/webrat/core/locators/button_locator.rb +54 -0
- data/lib/webrat/core/locators/field_by_id_locator.rb +37 -0
- data/lib/webrat/core/locators/field_labeled_locator.rb +56 -0
- data/lib/webrat/core/locators/field_locator.rb +25 -0
- data/lib/webrat/core/locators/field_named_locator.rb +41 -0
- data/lib/webrat/core/locators/form_locator.rb +19 -0
- data/lib/webrat/core/locators/label_locator.rb +34 -0
- data/lib/webrat/core/locators/link_locator.rb +66 -0
- data/lib/webrat/core/locators/locator.rb +20 -0
- data/lib/webrat/core/locators/select_option_locator.rb +59 -0
- data/lib/webrat/core/logging.rb +21 -0
- data/lib/webrat/core/matchers.rb +4 -0
- data/lib/webrat/core/matchers/have_content.rb +73 -0
- data/lib/webrat/core/matchers/have_selector.rb +74 -0
- data/lib/webrat/core/matchers/have_tag.rb +21 -0
- data/lib/webrat/core/matchers/have_xpath.rb +147 -0
- data/lib/webrat/core/methods.rb +61 -0
- data/lib/webrat/core/mime.rb +29 -0
- data/lib/webrat/core/save_and_open_page.rb +50 -0
- data/lib/webrat/core/scope.rb +350 -0
- data/lib/webrat/core/session.rb +281 -0
- data/lib/webrat/core/xml.rb +115 -0
- data/lib/webrat/core/xml/hpricot.rb +19 -0
- data/lib/webrat/core/xml/nokogiri.rb +76 -0
- data/lib/webrat/core/xml/rexml.rb +24 -0
- data/lib/webrat/core_extensions/blank.rb +58 -0
- data/lib/webrat/core_extensions/deprecate.rb +8 -0
- data/lib/webrat/core_extensions/detect_mapped.rb +12 -0
- data/lib/webrat/core_extensions/meta_class.rb +6 -0
- data/lib/webrat/core_extensions/nil_to_param.rb +5 -0
- data/lib/webrat/mechanize.rb +74 -0
- data/lib/webrat/merb.rb +9 -0
- data/lib/webrat/merb_session.rb +65 -0
- data/lib/webrat/rack.rb +24 -0
- data/lib/webrat/rails.rb +105 -0
- data/lib/webrat/rspec-rails.rb +13 -0
- data/lib/webrat/selenium.rb +154 -0
- data/lib/webrat/selenium/location_strategy_javascript/button.js +12 -0
- data/lib/webrat/selenium/location_strategy_javascript/label.js +16 -0
- data/lib/webrat/selenium/location_strategy_javascript/webrat.js +5 -0
- data/lib/webrat/selenium/location_strategy_javascript/webratlink.js +9 -0
- data/lib/webrat/selenium/location_strategy_javascript/webratlinkwithin.js +15 -0
- data/lib/webrat/selenium/location_strategy_javascript/webratselectwithoption.js +5 -0
- data/lib/webrat/selenium/matchers.rb +4 -0
- data/lib/webrat/selenium/matchers/have_content.rb +66 -0
- data/lib/webrat/selenium/matchers/have_selector.rb +49 -0
- data/lib/webrat/selenium/matchers/have_tag.rb +72 -0
- data/lib/webrat/selenium/matchers/have_xpath.rb +45 -0
- data/lib/webrat/selenium/selenium_extensions.js +6 -0
- data/lib/webrat/selenium/selenium_session.rb +247 -0
- data/lib/webrat/sinatra.rb +44 -0
- data/vendor/selenium-server.jar +0 -0
- metadata +76 -2
@@ -0,0 +1,44 @@
|
|
1
|
+
require "webrat/rack"
|
2
|
+
require "sinatra/test"
|
3
|
+
|
4
|
+
module Webrat
|
5
|
+
class SinatraSession < RackSession
|
6
|
+
include Sinatra::Test
|
7
|
+
|
8
|
+
attr_reader :request, :response
|
9
|
+
|
10
|
+
def initialize(context = nil)
|
11
|
+
super(context)
|
12
|
+
|
13
|
+
app = context.respond_to?(:app) ? context.app : Sinatra::Application
|
14
|
+
@browser = Sinatra::TestHarness.new(app)
|
15
|
+
end
|
16
|
+
|
17
|
+
%w(get head post put delete).each do |verb|
|
18
|
+
class_eval <<-RUBY
|
19
|
+
def #{verb}(path, data, headers = {})
|
20
|
+
params = data.inject({}) do |data, (key,value)|
|
21
|
+
data[key] = Rack::Utils.unescape(value)
|
22
|
+
data
|
23
|
+
end
|
24
|
+
headers["HTTP_HOST"] = "www.example.com"
|
25
|
+
@browser.#{verb}(path, params, headers)
|
26
|
+
end
|
27
|
+
RUBY
|
28
|
+
end
|
29
|
+
|
30
|
+
def response_body
|
31
|
+
@browser.body
|
32
|
+
end
|
33
|
+
|
34
|
+
def response_code
|
35
|
+
@browser.status
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def response
|
41
|
+
@browser.response
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mmurphy-webrat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Murphy
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-03-23 13:
|
12
|
+
date: 2009-03-23 13:55:42.934158 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -37,6 +37,80 @@ files:
|
|
37
37
|
- MIT-LICENSE.txt
|
38
38
|
- README.rdoc
|
39
39
|
- Rakefile
|
40
|
+
- lib/webrat
|
41
|
+
- lib/webrat/core
|
42
|
+
- lib/webrat/core/configuration.rb
|
43
|
+
- lib/webrat/core/elements
|
44
|
+
- lib/webrat/core/elements/area.rb
|
45
|
+
- lib/webrat/core/elements/element.rb
|
46
|
+
- lib/webrat/core/elements/field.rb
|
47
|
+
- lib/webrat/core/elements/form.rb
|
48
|
+
- lib/webrat/core/elements/label.rb
|
49
|
+
- lib/webrat/core/elements/link.rb
|
50
|
+
- lib/webrat/core/elements/select_option.rb
|
51
|
+
- lib/webrat/core/locators
|
52
|
+
- lib/webrat/core/locators/area_locator.rb
|
53
|
+
- lib/webrat/core/locators/button_locator.rb
|
54
|
+
- lib/webrat/core/locators/field_by_id_locator.rb
|
55
|
+
- lib/webrat/core/locators/field_labeled_locator.rb
|
56
|
+
- lib/webrat/core/locators/field_locator.rb
|
57
|
+
- lib/webrat/core/locators/field_named_locator.rb
|
58
|
+
- lib/webrat/core/locators/form_locator.rb
|
59
|
+
- lib/webrat/core/locators/label_locator.rb
|
60
|
+
- lib/webrat/core/locators/link_locator.rb
|
61
|
+
- lib/webrat/core/locators/locator.rb
|
62
|
+
- lib/webrat/core/locators/select_option_locator.rb
|
63
|
+
- lib/webrat/core/locators.rb
|
64
|
+
- lib/webrat/core/logging.rb
|
65
|
+
- lib/webrat/core/matchers
|
66
|
+
- lib/webrat/core/matchers/have_content.rb
|
67
|
+
- lib/webrat/core/matchers/have_selector.rb
|
68
|
+
- lib/webrat/core/matchers/have_tag.rb
|
69
|
+
- lib/webrat/core/matchers/have_xpath.rb
|
70
|
+
- lib/webrat/core/matchers.rb
|
71
|
+
- lib/webrat/core/methods.rb
|
72
|
+
- lib/webrat/core/mime.rb
|
73
|
+
- lib/webrat/core/save_and_open_page.rb
|
74
|
+
- lib/webrat/core/scope.rb
|
75
|
+
- lib/webrat/core/session.rb
|
76
|
+
- lib/webrat/core/xml
|
77
|
+
- lib/webrat/core/xml/hpricot.rb
|
78
|
+
- lib/webrat/core/xml/nokogiri.rb
|
79
|
+
- lib/webrat/core/xml/rexml.rb
|
80
|
+
- lib/webrat/core/xml.rb
|
81
|
+
- lib/webrat/core.rb
|
82
|
+
- lib/webrat/core_extensions
|
83
|
+
- lib/webrat/core_extensions/blank.rb
|
84
|
+
- lib/webrat/core_extensions/deprecate.rb
|
85
|
+
- lib/webrat/core_extensions/detect_mapped.rb
|
86
|
+
- lib/webrat/core_extensions/meta_class.rb
|
87
|
+
- lib/webrat/core_extensions/nil_to_param.rb
|
88
|
+
- lib/webrat/mechanize.rb
|
89
|
+
- lib/webrat/merb.rb
|
90
|
+
- lib/webrat/merb_session.rb
|
91
|
+
- lib/webrat/rack.rb
|
92
|
+
- lib/webrat/rails.rb
|
93
|
+
- lib/webrat/rspec-rails.rb
|
94
|
+
- lib/webrat/selenium
|
95
|
+
- lib/webrat/selenium/location_strategy_javascript
|
96
|
+
- lib/webrat/selenium/location_strategy_javascript/button.js
|
97
|
+
- lib/webrat/selenium/location_strategy_javascript/label.js
|
98
|
+
- lib/webrat/selenium/location_strategy_javascript/webrat.js
|
99
|
+
- lib/webrat/selenium/location_strategy_javascript/webratlink.js
|
100
|
+
- lib/webrat/selenium/location_strategy_javascript/webratlinkwithin.js
|
101
|
+
- lib/webrat/selenium/location_strategy_javascript/webratselectwithoption.js
|
102
|
+
- lib/webrat/selenium/matchers
|
103
|
+
- lib/webrat/selenium/matchers/have_content.rb
|
104
|
+
- lib/webrat/selenium/matchers/have_selector.rb
|
105
|
+
- lib/webrat/selenium/matchers/have_tag.rb
|
106
|
+
- lib/webrat/selenium/matchers/have_xpath.rb
|
107
|
+
- lib/webrat/selenium/matchers.rb
|
108
|
+
- lib/webrat/selenium/selenium_extensions.js
|
109
|
+
- lib/webrat/selenium/selenium_session.rb
|
110
|
+
- lib/webrat/selenium.rb
|
111
|
+
- lib/webrat/sinatra.rb
|
112
|
+
- lib/webrat.rb
|
113
|
+
- vendor/selenium-server.jar
|
40
114
|
has_rdoc: true
|
41
115
|
homepage: http://github.com/mmurphy/webrat
|
42
116
|
post_install_message:
|