aslakhellesoy-webrat 0.3.2.2 → 0.4.4.1
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 +158 -19
- data/Rakefile +36 -11
- data/lib/webrat.rb +8 -11
- data/lib/webrat/core/configuration.rb +67 -25
- data/lib/webrat/core/elements/area.rb +7 -7
- data/lib/webrat/core/elements/element.rb +11 -11
- data/lib/webrat/core/elements/field.rb +70 -51
- data/lib/webrat/core/elements/form.rb +17 -17
- data/lib/webrat/core/elements/label.rb +8 -8
- data/lib/webrat/core/elements/link.rb +13 -11
- data/lib/webrat/core/elements/select_option.rb +9 -9
- data/lib/webrat/core/locators.rb +2 -2
- data/lib/webrat/core/locators/area_locator.rb +10 -10
- data/lib/webrat/core/locators/button_locator.rb +13 -13
- data/lib/webrat/core/locators/field_by_id_locator.rb +8 -8
- data/lib/webrat/core/locators/field_labeled_locator.rb +19 -13
- data/lib/webrat/core/locators/field_locator.rb +7 -7
- data/lib/webrat/core/locators/field_named_locator.rb +10 -10
- data/lib/webrat/core/locators/form_locator.rb +6 -6
- data/lib/webrat/core/locators/label_locator.rb +9 -9
- data/lib/webrat/core/locators/link_locator.rb +12 -12
- data/lib/webrat/core/locators/locator.rb +5 -5
- data/lib/webrat/core/locators/select_option_locator.rb +11 -11
- data/lib/webrat/core/logging.rb +7 -4
- data/lib/webrat/core/matchers/have_content.rb +19 -15
- data/lib/webrat/core/matchers/have_selector.rb +44 -22
- data/lib/webrat/core/matchers/have_tag.rb +11 -61
- data/lib/webrat/core/matchers/have_xpath.rb +89 -35
- data/lib/webrat/core/methods.rb +13 -11
- data/lib/webrat/core/mime.rb +3 -3
- data/lib/webrat/core/save_and_open_page.rb +9 -9
- data/lib/webrat/core/scope.rb +82 -62
- data/lib/webrat/core/session.rb +61 -18
- data/lib/webrat/core/xml.rb +16 -16
- data/lib/webrat/core/xml/hpricot.rb +3 -3
- data/lib/webrat/core/xml/nokogiri.rb +14 -14
- data/lib/webrat/core/xml/rexml.rb +3 -3
- data/lib/webrat/core_extensions/blank.rb +1 -1
- data/lib/webrat/core_extensions/deprecate.rb +1 -1
- data/lib/webrat/core_extensions/detect_mapped.rb +4 -4
- data/lib/webrat/core_extensions/meta_class.rb +1 -1
- data/lib/webrat/core_extensions/tcp_socket.rb +27 -0
- data/lib/webrat/mechanize.rb +9 -9
- data/lib/webrat/merb.rb +5 -61
- data/lib/webrat/merb_session.rb +67 -0
- data/lib/webrat/rack.rb +45 -14
- data/lib/webrat/rails.rb +31 -11
- data/lib/webrat/rspec-rails.rb +2 -2
- data/lib/webrat/selenium.rb +27 -39
- 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 +44 -0
- data/lib/webrat/selenium/application_servers/external.rb +24 -0
- data/lib/webrat/selenium/application_servers/merb.rb +48 -0
- data/lib/webrat/selenium/application_servers/rails.rb +42 -0
- data/lib/webrat/selenium/application_servers/sinatra.rb +35 -0
- data/lib/webrat/selenium/location_strategy_javascript/button.js +14 -7
- data/lib/webrat/selenium/location_strategy_javascript/label.js +1 -2
- data/lib/webrat/selenium/location_strategy_javascript/webratlink.js +4 -1
- data/lib/webrat/selenium/matchers.rb +4 -108
- 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_rc_server.rb +84 -0
- data/lib/webrat/selenium/selenium_session.rb +86 -68
- data/lib/webrat/selenium/silence_stream.rb +18 -0
- metadata +21 -16
- data/lib/webrat/core_extensions/hash_with_indifferent_access.rb +0 -131
- data/lib/webrat/sinatra.rb +0 -29
@@ -0,0 +1,18 @@
|
|
1
|
+
module Webrat
|
2
|
+
module Selenium
|
3
|
+
module SilenceStream
|
4
|
+
# active_support already defines silence_stream, no need to do that again if it's already present.
|
5
|
+
# http://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/kernel/reporting.rb
|
6
|
+
unless Kernel.respond_to?(:silence_stream)
|
7
|
+
def silence_stream(stream)
|
8
|
+
old_stream = stream.dup
|
9
|
+
stream.reopen(RUBY_PLATFORM =~ /mswin/ ? 'NUL:' : '/dev/null')
|
10
|
+
stream.sync = true
|
11
|
+
yield
|
12
|
+
ensure
|
13
|
+
stream.reopen(old_stream)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aslakhellesoy-webrat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Helmkamp
|
@@ -9,17 +9,18 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-06-14 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nokogiri
|
17
|
+
type: :runtime
|
17
18
|
version_requirement:
|
18
19
|
version_requirements: !ruby/object:Gem::Requirement
|
19
20
|
requirements:
|
20
21
|
- - ">="
|
21
22
|
- !ruby/object:Gem::Version
|
22
|
-
version: 1.
|
23
|
+
version: 1.2.0
|
23
24
|
version:
|
24
25
|
description: Webrat. Ruby Acceptance Testing for Web applications
|
25
26
|
email: bryan@brynary.com
|
@@ -36,10 +37,7 @@ files:
|
|
36
37
|
- MIT-LICENSE.txt
|
37
38
|
- README.rdoc
|
38
39
|
- Rakefile
|
39
|
-
- lib/webrat
|
40
|
-
- lib/webrat/core
|
41
40
|
- lib/webrat/core/configuration.rb
|
42
|
-
- lib/webrat/core/elements
|
43
41
|
- lib/webrat/core/elements/area.rb
|
44
42
|
- lib/webrat/core/elements/element.rb
|
45
43
|
- lib/webrat/core/elements/field.rb
|
@@ -47,7 +45,6 @@ files:
|
|
47
45
|
- lib/webrat/core/elements/label.rb
|
48
46
|
- lib/webrat/core/elements/link.rb
|
49
47
|
- lib/webrat/core/elements/select_option.rb
|
50
|
-
- lib/webrat/core/locators
|
51
48
|
- lib/webrat/core/locators/area_locator.rb
|
52
49
|
- lib/webrat/core/locators/button_locator.rb
|
53
50
|
- lib/webrat/core/locators/field_by_id_locator.rb
|
@@ -61,7 +58,6 @@ files:
|
|
61
58
|
- lib/webrat/core/locators/select_option_locator.rb
|
62
59
|
- lib/webrat/core/locators.rb
|
63
60
|
- lib/webrat/core/logging.rb
|
64
|
-
- lib/webrat/core/matchers
|
65
61
|
- lib/webrat/core/matchers/have_content.rb
|
66
62
|
- lib/webrat/core/matchers/have_selector.rb
|
67
63
|
- lib/webrat/core/matchers/have_tag.rb
|
@@ -72,40 +68,49 @@ files:
|
|
72
68
|
- lib/webrat/core/save_and_open_page.rb
|
73
69
|
- lib/webrat/core/scope.rb
|
74
70
|
- lib/webrat/core/session.rb
|
75
|
-
- lib/webrat/core/xml
|
76
71
|
- lib/webrat/core/xml/hpricot.rb
|
77
72
|
- lib/webrat/core/xml/nokogiri.rb
|
78
73
|
- lib/webrat/core/xml/rexml.rb
|
79
74
|
- lib/webrat/core/xml.rb
|
80
75
|
- lib/webrat/core.rb
|
81
|
-
- lib/webrat/core_extensions
|
82
76
|
- lib/webrat/core_extensions/blank.rb
|
83
77
|
- lib/webrat/core_extensions/deprecate.rb
|
84
78
|
- lib/webrat/core_extensions/detect_mapped.rb
|
85
|
-
- lib/webrat/core_extensions/hash_with_indifferent_access.rb
|
86
79
|
- lib/webrat/core_extensions/meta_class.rb
|
87
80
|
- lib/webrat/core_extensions/nil_to_param.rb
|
81
|
+
- lib/webrat/core_extensions/tcp_socket.rb
|
88
82
|
- lib/webrat/mechanize.rb
|
89
83
|
- lib/webrat/merb.rb
|
84
|
+
- lib/webrat/merb_session.rb
|
90
85
|
- lib/webrat/rack.rb
|
91
86
|
- lib/webrat/rails.rb
|
92
87
|
- lib/webrat/rspec-rails.rb
|
93
|
-
- lib/webrat/selenium
|
94
|
-
- lib/webrat/selenium/
|
88
|
+
- lib/webrat/selenium/application_server_factory.rb
|
89
|
+
- lib/webrat/selenium/application_servers/base.rb
|
90
|
+
- lib/webrat/selenium/application_servers/external.rb
|
91
|
+
- lib/webrat/selenium/application_servers/merb.rb
|
92
|
+
- lib/webrat/selenium/application_servers/rails.rb
|
93
|
+
- lib/webrat/selenium/application_servers/sinatra.rb
|
94
|
+
- lib/webrat/selenium/application_servers.rb
|
95
95
|
- lib/webrat/selenium/location_strategy_javascript/button.js
|
96
96
|
- lib/webrat/selenium/location_strategy_javascript/label.js
|
97
97
|
- lib/webrat/selenium/location_strategy_javascript/webrat.js
|
98
98
|
- lib/webrat/selenium/location_strategy_javascript/webratlink.js
|
99
99
|
- lib/webrat/selenium/location_strategy_javascript/webratlinkwithin.js
|
100
100
|
- lib/webrat/selenium/location_strategy_javascript/webratselectwithoption.js
|
101
|
+
- lib/webrat/selenium/matchers/have_content.rb
|
102
|
+
- lib/webrat/selenium/matchers/have_selector.rb
|
103
|
+
- lib/webrat/selenium/matchers/have_tag.rb
|
104
|
+
- lib/webrat/selenium/matchers/have_xpath.rb
|
101
105
|
- lib/webrat/selenium/matchers.rb
|
102
106
|
- lib/webrat/selenium/selenium_extensions.js
|
107
|
+
- lib/webrat/selenium/selenium_rc_server.rb
|
103
108
|
- lib/webrat/selenium/selenium_session.rb
|
109
|
+
- lib/webrat/selenium/silence_stream.rb
|
104
110
|
- lib/webrat/selenium.rb
|
105
|
-
- lib/webrat/sinatra.rb
|
106
111
|
- lib/webrat.rb
|
107
112
|
- vendor/selenium-server.jar
|
108
|
-
has_rdoc:
|
113
|
+
has_rdoc: false
|
109
114
|
homepage: http://github.com/brynary/webrat
|
110
115
|
post_install_message:
|
111
116
|
rdoc_options: []
|
@@ -129,7 +134,7 @@ requirements: []
|
|
129
134
|
rubyforge_project: webrat
|
130
135
|
rubygems_version: 1.2.0
|
131
136
|
signing_key:
|
132
|
-
specification_version:
|
137
|
+
specification_version: 3
|
133
138
|
summary: Webrat. Ruby Acceptance Testing for Web applications
|
134
139
|
test_files: []
|
135
140
|
|
@@ -1,131 +0,0 @@
|
|
1
|
-
# This class has dubious semantics and we only have it so that
|
2
|
-
# people can write params[:key] instead of params['key']
|
3
|
-
# and they get the same value for both keys.
|
4
|
-
class HashWithIndifferentAccess < Hash #:nodoc:
|
5
|
-
def initialize(constructor = {})
|
6
|
-
if constructor.is_a?(Hash)
|
7
|
-
super()
|
8
|
-
update(constructor)
|
9
|
-
else
|
10
|
-
super(constructor)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def default(key = nil)
|
15
|
-
if key.is_a?(Symbol) && include?(key = key.to_s)
|
16
|
-
self[key]
|
17
|
-
else
|
18
|
-
super
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
alias_method :regular_writer, :[]= unless method_defined?(:regular_writer)
|
23
|
-
alias_method :regular_update, :update unless method_defined?(:regular_update)
|
24
|
-
|
25
|
-
#
|
26
|
-
# Assigns a new value to the hash.
|
27
|
-
#
|
28
|
-
# Example:
|
29
|
-
#
|
30
|
-
# hash = HashWithIndifferentAccess.new
|
31
|
-
# hash[:key] = "value"
|
32
|
-
#
|
33
|
-
def []=(key, value)
|
34
|
-
regular_writer(convert_key(key), convert_value(value))
|
35
|
-
end
|
36
|
-
|
37
|
-
#
|
38
|
-
# Updates the instantized hash with values from the second.
|
39
|
-
#
|
40
|
-
# Example:
|
41
|
-
#
|
42
|
-
# >> hash_1 = HashWithIndifferentAccess.new
|
43
|
-
# => {}
|
44
|
-
#
|
45
|
-
# >> hash_1[:key] = "value"
|
46
|
-
# => "value"
|
47
|
-
#
|
48
|
-
# >> hash_2 = HashWithIndifferentAccess.new
|
49
|
-
# => {}
|
50
|
-
#
|
51
|
-
# >> hash_2[:key] = "New Value!"
|
52
|
-
# => "New Value!"
|
53
|
-
#
|
54
|
-
# >> hash_1.update(hash_2)
|
55
|
-
# => {"key"=>"New Value!"}
|
56
|
-
#
|
57
|
-
def update(other_hash)
|
58
|
-
other_hash.each_pair { |key, value| regular_writer(convert_key(key), convert_value(value)) }
|
59
|
-
self
|
60
|
-
end
|
61
|
-
|
62
|
-
alias_method :merge!, :update
|
63
|
-
|
64
|
-
# Checks the hash for a key matching the argument passed in
|
65
|
-
def key?(key)
|
66
|
-
super(convert_key(key))
|
67
|
-
end
|
68
|
-
|
69
|
-
alias_method :include?, :key?
|
70
|
-
alias_method :has_key?, :key?
|
71
|
-
alias_method :member?, :key?
|
72
|
-
|
73
|
-
# Fetches the value for the specified key, same as doing hash[key]
|
74
|
-
def fetch(key, *extras)
|
75
|
-
super(convert_key(key), *extras)
|
76
|
-
end
|
77
|
-
|
78
|
-
# Returns an array of the values at the specified indicies.
|
79
|
-
def values_at(*indices)
|
80
|
-
indices.collect {|key| self[convert_key(key)]}
|
81
|
-
end
|
82
|
-
|
83
|
-
# Returns an exact copy of the hash.
|
84
|
-
def dup
|
85
|
-
HashWithIndifferentAccess.new(self)
|
86
|
-
end
|
87
|
-
|
88
|
-
# Merges the instantized and the specified hashes together, giving precedence to the values from the second hash
|
89
|
-
# Does not overwrite the existing hash.
|
90
|
-
def merge(hash)
|
91
|
-
self.dup.update(hash)
|
92
|
-
end
|
93
|
-
|
94
|
-
# Removes a specified key from the hash.
|
95
|
-
def delete(key)
|
96
|
-
super(convert_key(key))
|
97
|
-
end
|
98
|
-
|
99
|
-
def stringify_keys!; self end
|
100
|
-
def symbolize_keys!; self end
|
101
|
-
def to_options!; self end
|
102
|
-
|
103
|
-
# Convert to a Hash with String keys.
|
104
|
-
def to_hash
|
105
|
-
Hash.new(default).merge(self)
|
106
|
-
end
|
107
|
-
|
108
|
-
protected
|
109
|
-
def convert_key(key)
|
110
|
-
key.kind_of?(Symbol) ? key.to_s : key
|
111
|
-
end
|
112
|
-
|
113
|
-
def convert_value(value)
|
114
|
-
case value
|
115
|
-
when Hash
|
116
|
-
value.with_indifferent_access
|
117
|
-
when Array
|
118
|
-
value.collect { |e| e.is_a?(Hash) ? e.with_indifferent_access : e }
|
119
|
-
else
|
120
|
-
value
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
class Hash #:nodoc:
|
126
|
-
def with_indifferent_access
|
127
|
-
hash = HashWithIndifferentAccess.new(self)
|
128
|
-
hash.default = self.default
|
129
|
-
hash
|
130
|
-
end
|
131
|
-
end
|
data/lib/webrat/sinatra.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'webrat/rack'
|
2
|
-
require 'sinatra'
|
3
|
-
require 'sinatra/test/methods'
|
4
|
-
|
5
|
-
class Sinatra::Application
|
6
|
-
# Override this to prevent Sinatra from barfing on the options passed from RSpec
|
7
|
-
def self.load_default_options_from_command_line!
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
disable :run
|
12
|
-
disable :reload
|
13
|
-
|
14
|
-
module Webrat
|
15
|
-
class SinatraSession < RackSession #:nodoc:
|
16
|
-
include Sinatra::Test::Methods
|
17
|
-
|
18
|
-
attr_reader :request, :response
|
19
|
-
|
20
|
-
%w(get head post put delete).each do |verb|
|
21
|
-
define_method(verb) do |*args| # (path, data, headers = nil)
|
22
|
-
path, data, headers = *args
|
23
|
-
data = data.inject({}) {|data, (key,value)| data[key] = Rack::Utils.unescape(value); data }
|
24
|
-
params = data.merge(:env => headers || {})
|
25
|
-
self.__send__("#{verb}_it", path, params)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|