capybara-mechanize 1.0.0 → 1.0.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/README.mdown
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
Capybara-mechanize
|
2
2
|
==================
|
3
3
|
|
4
|
+
[](https://travis-ci.org/jeroenvandijk/capybara-mechanize)
|
5
|
+
|
4
6
|
This gems makes it possible to use Capybara for (partially) remote testing. It inherits most functionality from the RackTest driver and only uses [Mechanize](https://github.com/sparklemotion/mechanize) for remote requests.
|
5
7
|
|
6
8
|
It is currently in use to test the integration between a Rails application and Twitter authorization and sharing.
|
@@ -63,8 +63,12 @@ class Capybara::Mechanize::Browser < Capybara::RackTest::Browser
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
def find(selector)
|
67
|
-
|
66
|
+
def find(format, selector)
|
67
|
+
if format==:css
|
68
|
+
dom.css(selector, Capybara::RackTest::CSSHandlers.new)
|
69
|
+
else
|
70
|
+
dom.xpath(selector)
|
71
|
+
end.map { |node| Capybara::Mechanize::Node.new(self, node) }
|
68
72
|
end
|
69
73
|
|
70
74
|
attr_reader :agent
|
@@ -13,14 +13,14 @@ describe Capybara::Mechanize::Driver, 'local' do
|
|
13
13
|
it 'should keep headers on link clicks' do
|
14
14
|
driver = Capybara::RackTest::Driver.new(TestApp, :headers => {'HTTP_FOO' => 'foobar'})
|
15
15
|
driver.visit('/header_links')
|
16
|
-
driver.
|
16
|
+
driver.find_xpath('.//a').first.click
|
17
17
|
driver.html.should include('foobar')
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'should keep headers on form submit' do
|
21
21
|
driver = Capybara::RackTest::Driver.new(TestApp, :headers => {'HTTP_FOO' => 'foobar'})
|
22
22
|
driver.visit('/header_links')
|
23
|
-
driver.
|
23
|
+
driver.find_xpath('.//input').first.click
|
24
24
|
driver.html.should include('foobar')
|
25
25
|
end
|
26
26
|
|
@@ -179,9 +179,6 @@ describe Capybara::Mechanize::Driver, 'local' do
|
|
179
179
|
end
|
180
180
|
|
181
181
|
it "should raise a useful error for sites that return a 404, because it is probably a misconfiguration" do
|
182
|
-
# Note that this test fails when it is run on a system with a crappy
|
183
|
-
# ISP, like Time Warner, that redirects bad DNS calls to their own
|
184
|
-
# search results to make a little more dough.
|
185
182
|
expect {
|
186
183
|
driver.visit("http://iamreallysurethatthisdoesntexist.com/canttouchthis")
|
187
184
|
}.to raise_error(%r{Received the following error for a GET request to http://iamreallysurethatthisdoesntexist.com/canttouchthis:})
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara-mechanize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mechanize
|
@@ -98,4 +98,3 @@ signing_key:
|
|
98
98
|
specification_version: 3
|
99
99
|
summary: RackTest driver for Capybara with remote request support
|
100
100
|
test_files: []
|
101
|
-
has_rdoc:
|