dbrady-webrat 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +325 -0
- data/MIT-LICENSE.txt +19 -0
- data/README.rdoc +85 -0
- data/Rakefile +156 -0
- data/install.rb +1 -0
- 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 +92 -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 +80 -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 +241 -0
- data/lib/webrat/sinatra.rb +53 -0
- data/vendor/selenium-server.jar +0 -0
- metadata +141 -0
@@ -0,0 +1,53 @@
|
|
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
|
+
@cookies = []
|
16
|
+
end
|
17
|
+
|
18
|
+
%w(get head post put delete).each do |verb|
|
19
|
+
class_eval <<-RUBY
|
20
|
+
def #{verb}(path, data, headers = {})
|
21
|
+
params = data.inject({}) do |data, (key,value)|
|
22
|
+
data[key] = Rack::Utils.unescape(value)
|
23
|
+
data
|
24
|
+
end
|
25
|
+
headers["HTTP_HOST"] = "www.example.com"
|
26
|
+
headers["HTTP_COOKIE"] = @cookies.join(',')
|
27
|
+
@browser.#{verb}(path, params, headers)
|
28
|
+
set_cookies
|
29
|
+
end
|
30
|
+
RUBY
|
31
|
+
end
|
32
|
+
|
33
|
+
def response_body
|
34
|
+
@browser.body
|
35
|
+
end
|
36
|
+
|
37
|
+
def response_code
|
38
|
+
@browser.status
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def set_cookies
|
44
|
+
if set_cookie = @browser.response.headers['Set-Cookie']
|
45
|
+
@cookies.unshift set_cookie
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def response
|
50
|
+
@browser.response
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dbrady-webrat
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Max Murphy
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-04-15 21:11:07.095333 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: nokogiri
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.2.0
|
24
|
+
version:
|
25
|
+
description: Webrat. Ruby Acceptance Testing for Web applications
|
26
|
+
email: mmurphy@elctech.com
|
27
|
+
executables: []
|
28
|
+
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- README.rdoc
|
33
|
+
- MIT-LICENSE.txt
|
34
|
+
files:
|
35
|
+
- History.txt
|
36
|
+
- install.rb
|
37
|
+
- MIT-LICENSE.txt
|
38
|
+
- README.rdoc
|
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
|
114
|
+
has_rdoc: true
|
115
|
+
homepage: http://github.com/mmurphy/webrat
|
116
|
+
post_install_message:
|
117
|
+
rdoc_options: []
|
118
|
+
|
119
|
+
require_paths:
|
120
|
+
- lib
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: "0"
|
126
|
+
version:
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: "0"
|
132
|
+
version:
|
133
|
+
requirements: []
|
134
|
+
|
135
|
+
rubyforge_project: webrat
|
136
|
+
rubygems_version: 1.2.0
|
137
|
+
signing_key:
|
138
|
+
specification_version: 2
|
139
|
+
summary: Webrat. Ruby Acceptance Testing for Web applications
|
140
|
+
test_files: []
|
141
|
+
|