capybara-mechanize 0.2.7 → 0.3.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,25 +1,20 @@
1
+ require 'capybara/rack_test/driver'
1
2
  require 'mechanize'
2
3
 
3
- class Capybara::Driver::Mechanize < Capybara::Driver::RackTest
4
+ class Capybara::Mechanize::Browser < Capybara::RackTest::Browser
4
5
  extend Forwardable
5
6
 
6
7
  def_delegator :agent, :scheme_handlers
7
8
  def_delegator :agent, :scheme_handlers=
8
9
 
9
- def initialize(app = nil)
10
+ def initialize(app, options)
10
11
  @agent = ::Mechanize.new
11
12
  @agent.redirect_ok = false
12
-
13
- if app
14
- # Delegate the RackApp to the RackTest driver
15
- super(app)
16
- elsif !Capybara.app_host
17
- raise ArgumentError, "You have to set at least Capybara.app_host or Capybara.app"
18
- end
13
+
14
+ super
19
15
  end
20
16
 
21
- def reset!
22
- @agent.cookie_jar.clear!
17
+ def reset_host!
23
18
  @last_remote_host = nil
24
19
  @last_request_remote = nil
25
20
  super
@@ -29,43 +24,98 @@ class Capybara::Driver::Mechanize < Capybara::Driver::RackTest
29
24
  last_request_remote? ? remote_response.current_url : super
30
25
  end
31
26
 
32
- def response
27
+ def last_response
33
28
  last_request_remote? ? remote_response : super
34
29
  end
35
30
 
31
+ def follow_redirects!
32
+ 5.times do
33
+ follow_redirect! if last_response.redirect?
34
+ end
35
+ raise Capybara::InfiniteRedirectError, "redirected more than 5 times, check for infinite redirects." if last_response.redirect?
36
+ end
37
+
36
38
  # TODO see how this can be cleaned up
37
39
  def follow_redirect!
38
- unless response.redirect?
40
+ unless last_response.redirect?
39
41
  raise "Last response was not a redirect. Cannot follow_redirect!"
40
42
  end
41
-
43
+
42
44
  location = if last_request_remote?
43
45
  remote_response.page.response['Location']
44
46
  else
45
- response['Location']
47
+ last_response['Location']
46
48
  end
47
49
 
48
50
  get(location)
49
51
  end
50
52
 
51
- def get(url, params = {}, headers = {})
52
- if remote?(url)
53
- process_remote_request(:get, url, params)
53
+
54
+ def process(method, path, *options)
55
+ reset_cache!
56
+ process_without_redirect(method, path, *options)
57
+ follow_redirects!
58
+ end
59
+
60
+ def process_without_redirect(method, path, *options)
61
+ if remote?(path)
62
+ process_remote_request(method, path, *options)
54
63
  else
55
64
  register_local_request
56
- super
65
+
66
+
67
+ path = determine_path(path)
68
+
69
+ attributes, headers = *options
70
+ attributes ||= {}
71
+ headers ||= {}
72
+
73
+ reset_cache!
74
+ send("racktest_#{method}", path, attributes, env.merge(headers))
57
75
  end
58
76
  end
77
+
78
+ # TODO path Capybara to move this into its own method
79
+ def determine_path(path)
80
+ new_uri = URI.parse(path)
81
+ current_uri = URI.parse(current_url)
59
82
 
60
- def post(url, params = {}, headers = {})
61
- if remote?(url)
62
- process_remote_request(:post, url, post_data(params), headers)
63
- else
64
- register_local_request
65
- super
83
+ if new_uri.host
84
+ @current_host = new_uri.scheme + '://' + new_uri.host
66
85
  end
86
+
87
+ if new_uri.relative?
88
+ path = request_path + path if path.start_with?('?')
89
+
90
+ unless path.start_with?('/')
91
+ folders = request_path.split('/')
92
+ path = (folders[0, folders.size - 1] << path).join('/')
93
+ end
94
+ path = current_host + path
95
+ end
96
+ path
97
+ end
98
+
99
+ alias :racktest_get :get
100
+ def get(path, attributes = {})
101
+ process_without_redirect(:get, path, attributes)
67
102
  end
68
103
 
104
+ alias :racktest_post :post
105
+ def post(path, attributes = {}, headers = {})
106
+ process_without_redirect(:post, path, post_data(attributes), headers)
107
+ end
108
+
109
+ alias :racktest_put :put
110
+ def put(method, path, attributes = {}, headers = {})
111
+ process_without_redirect(:put, path, attributes, headers)
112
+ end
113
+
114
+ alias :racktest_delete :delete
115
+ def delete(method, path, attributes = {}, headers = {})
116
+ process_without_redirect(:delete, path, attributes, headers)
117
+ end
118
+
69
119
  def post_data(params)
70
120
  params.inject({}) do |memo, param|
71
121
  case param
@@ -84,42 +134,22 @@ class Capybara::Driver::Mechanize < Capybara::Driver::RackTest
84
134
  end
85
135
  end
86
136
 
87
- def put(url, params = {}, headers = {})
88
- if remote?(url)
89
- process_remote_request(:put, url)
90
- else
91
- register_local_request
92
- super
93
- end
94
- end
95
-
96
- def delete(url, params = {}, headers = {})
97
- if remote?(url)
98
- process_remote_request(:delete, url, params, headers)
99
- else
100
- register_local_request
101
- super
102
- end
103
- end
104
-
105
137
  def remote?(url)
106
- if !Capybara.app_host.nil?
138
+ if Capybara.app_host
107
139
  true
108
- elsif Capybara.default_host.nil?
109
- false
110
140
  else
111
141
  host = URI.parse(url).host
112
142
 
113
- if host.nil? && last_request_remote?
114
- true
143
+ if host.nil?
144
+ last_request_remote?
115
145
  else
116
- !(host.nil? || host.include?(Capybara.default_host))
146
+ !Capybara::Mechanize.local_hosts.include?(host)
117
147
  end
118
148
  end
119
149
  end
120
-
150
+
121
151
  attr_reader :agent
122
-
152
+
123
153
  private
124
154
 
125
155
  def last_request_remote?
@@ -130,11 +160,11 @@ class Capybara::Driver::Mechanize < Capybara::Driver::RackTest
130
160
  @last_remote_host = nil
131
161
  @last_request_remote = false
132
162
  end
133
-
163
+
134
164
  def process_remote_request(method, url, *options)
135
165
  if remote?(url)
136
166
  remote_uri = URI.parse(url)
137
-
167
+
138
168
  if remote_uri.host.nil?
139
169
  remote_host = @last_remote_host || Capybara.app_host || Capybara.default_host
140
170
  url = File.join(remote_host, url)
@@ -143,13 +173,16 @@ class Capybara::Driver::Mechanize < Capybara::Driver::RackTest
143
173
  @last_remote_host = "#{remote_uri.host}:#{remote_uri.port}"
144
174
  end
145
175
 
146
- reset_cache
147
- @agent.send *( [method, url] + options)
148
-
176
+ reset_cache!
177
+ begin
178
+ @agent.send *( [method, url] + options)
179
+ rescue => e
180
+ raise "Received the following error for a #{method.to_s.upcase} request to #{url}: '#{e.message}'"
181
+ end
149
182
  @last_request_remote = true
150
183
  end
151
184
  end
152
-
185
+
153
186
  def remote_response
154
187
  ResponseProxy.new(@agent.current_page) if @agent.current_page
155
188
  end
@@ -175,11 +208,11 @@ class Capybara::Driver::Mechanize < Capybara::Driver::RackTest
175
208
  headers["content-type"].gsub!(';charset=utf-8', '') if headers["content-type"]
176
209
  headers
177
210
  end
178
-
211
+
179
212
  def status
180
213
  page.code.to_i
181
214
  end
182
-
215
+
183
216
  def redirect?
184
217
  [301, 302].include?(status)
185
218
  end
@@ -187,3 +220,4 @@ class Capybara::Driver::Mechanize < Capybara::Driver::RackTest
187
220
  end
188
221
 
189
222
  end
223
+
@@ -0,0 +1,21 @@
1
+ require 'capybara/mechanize/browser'
2
+
3
+ class Capybara::Mechanize::Driver < Capybara::RackTest::Driver
4
+
5
+ def initialize(app = nil, options = {})
6
+ if !app && !Capybara.app_host
7
+ raise ArgumentError, "You have to set at least Capybara.app_host or Capybara.app"
8
+ end
9
+
10
+ @app, @options = app, options
11
+ end
12
+
13
+ def remote?(url)
14
+ browser.remote?(url)
15
+ end
16
+
17
+ def browser
18
+ @browser ||= Capybara::Mechanize::Browser.new(app, options)
19
+ end
20
+
21
+ end
@@ -1,11 +1,24 @@
1
1
  require 'capybara'
2
2
 
3
- module Capybara
4
- module Driver
5
- autoload :Mechanize, 'capybara/driver/mechanize_driver'
3
+ module Capybara::Mechanize
4
+ class << self
5
+
6
+ # Host that should be considered local (includes default_host)
7
+ def local_hosts
8
+ @local_hosts ||= begin
9
+ default_host = URI.parse(Capybara.default_host || "").host || Capybara.default_host
10
+ [default_host].compact
11
+ end
12
+ end
13
+
14
+ def local_hosts=(hosts)
15
+ @local_hosts = hosts
16
+ end
6
17
  end
7
18
  end
8
19
 
20
+ require 'capybara/mechanize/driver'
21
+
9
22
  Capybara.register_driver :mechanize do |app|
10
- Capybara::Driver::Mechanize.new(app)
23
+ Capybara::Mechanize::Driver.new(app)
11
24
  end
@@ -8,7 +8,7 @@ class ExtendedTestApp < TestApp#< Sinatra::Base
8
8
  end
9
9
 
10
10
  get '/host' do
11
- "current host is #{request.host}:#{request.port}, method get"
11
+ "Current host is #{request.scheme}://#{request.host}:#{request.port}, method get"
12
12
  end
13
13
 
14
14
  get '/form_with_relative_action_to_host' do
@@ -22,12 +22,7 @@ class ExtendedTestApp < TestApp#< Sinatra::Base
22
22
  end
23
23
 
24
24
  post '/host' do
25
- "current host is #{request.host}:#{request.port}, method post"
25
+ "Current host is #{request.scheme}://#{request.host}:#{request.port}, method post"
26
26
  end
27
27
  end
28
28
 
29
- if __FILE__ == $0
30
- Rack::Handler::Mongrel.run ExtendedTestApp, :Port => 8070
31
- end
32
-
33
-
File without changes
data/spec/README.mdown ADDED
@@ -0,0 +1,76 @@
1
+ Capybara-mechanize
2
+ ==================
3
+
4
+ This gems makes it possible to use Capybara for (partially) remote testing. It inherits most functionality from the RackTest driver and only uses [Mechanize](http://github.com/tenderlove/mechanize) for remote requests.
5
+
6
+ It is currently in use to test the integration between a Rails application and Twitter authorization and sharing.
7
+
8
+ This gem is a [Capybara](http://github.com/jnicklas/capybara) extension. I have been inspired by the Capybara driver and some earlier efforts for a Mechanize driver.
9
+
10
+ Thanks to [Pinkelstar](http://www.pinkelstar.com) for giving me the time and the need to develop this gem.
11
+
12
+ ### Installation
13
+
14
+ gem install capybara-mechanize
15
+
16
+ ### Usage without Cucumber
17
+
18
+ require 'capybara/mechanize'
19
+
20
+ ### Usage with Cucumber and tags
21
+
22
+ A @mechanize tag is added to your hooks when you add the following line to your env.rb
23
+
24
+ require 'capybara/mechanize/cucumber'
25
+
26
+ The following scenario will then be using the Mechanize driver
27
+
28
+ @mechanize
29
+ Scenario: do something remote
30
+ When I click the remote link
31
+
32
+ ### Remote testing
33
+
34
+ When you want to use this driver to test a remote application. You have to set the app_host:
35
+
36
+ Capybara.app_host = "http://www.yourapp.com"
37
+
38
+ Note that I haven't tested this case for my self yet. The Capybara tests pass for this situation though so it should work! Please provide me with feedback if it doesn't.
39
+
40
+ ## Running tests
41
+
42
+ Until this library is merged with capybara there needs to be local app and you need to add the following to your host file:
43
+
44
+ 127.0.0.1 capybara-testapp.heroku.com
45
+
46
+ Run bundler
47
+
48
+ bundle install
49
+
50
+ Run the app with the following line:
51
+
52
+ bundle exec ruby -rrubygems lib/capybara/spec/extended_test_app.rb
53
+
54
+ Then you are ready to run the test like so
55
+
56
+ rake spec
57
+
58
+ Todo
59
+ ----
60
+ * Make the last 12 failing remote session spec pass, see remote_mechanize_spec and uncomment one line there to see them fail
61
+ * Test this driver with non-rack/non-ruby projects
62
+
63
+ Note on Patches/Pull Requests
64
+ -----------------------------
65
+
66
+ * Fork the project.
67
+ * Make your feature addition or bug fix.
68
+ * Add tests for it. This is important so I don't break it in a
69
+ future version unintentionally.
70
+ * Commit, do not mess with rakefile, version, or history.
71
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
72
+ * Send me a pull request. Bonus points for topic branches.
73
+
74
+ Copyright
75
+ ---------
76
+ Copyright (c) 2010 Jeroen van Dijk. See LICENSE for details.
@@ -2,12 +2,12 @@ require 'spec_helper'
2
2
 
3
3
  describe "Capybara::Driver::Mechanize, in local model" do
4
4
  before do
5
- @driver = Capybara::Driver::Mechanize.new(ExtendedTestApp)
5
+ @driver = Capybara::Mechanize::Driver.new(ExtendedTestApp)
6
6
  end
7
7
 
8
8
  it "should throw an error when no rack app is given without an app host" do
9
9
  running do
10
- Capybara::Driver::Mechanize.new
10
+ Capybara::Mechanize::Driver.new
11
11
  end.should raise_error(ArgumentError, "You have to set at least Capybara.app_host or Capybara.app")
12
12
  end
13
13
 
@@ -17,16 +17,20 @@ describe "Capybara::Driver::Mechanize, in local model" do
17
17
  it_should_behave_like "driver with cookies support"
18
18
  it_should_behave_like "driver with infinite redirect detection"
19
19
 
20
- it "should default to local mode" do
21
- @driver.remote?('http://www.local.com').should be false
20
+ it "should default to local mode for relative paths" do
21
+ @driver.should_not be_remote('/')
22
22
  end
23
23
 
24
+ it "should default to local mode for the default host" do
25
+ @driver.should_not be_remote('http://www.example.com')
26
+ end
27
+
24
28
  context "with an app_host" do
25
-
29
+
26
30
  before do
27
- Capybara.app_host = 'remote.com'
31
+ Capybara.app_host = 'http://www.remote.com'
28
32
  end
29
-
33
+
30
34
  after do
31
35
  Capybara.app_host = nil
32
36
  end
@@ -35,20 +39,25 @@ describe "Capybara::Driver::Mechanize, in local model" do
35
39
  @driver.should be_remote('http://www.remote.com')
36
40
  end
37
41
  end
38
-
42
+
39
43
  context "with a default url, no app host" do
40
44
  before :each do
41
45
  Capybara.default_host = 'www.local.com'
42
46
  end
43
47
 
48
+ it "should allow local hosts to be set" do
49
+ Capybara::Mechanize.local_hosts = ['subdomain.local.com']
50
+ @driver.should_not be_remote('http://subdomain.local.com')
51
+ end
52
+
44
53
  it "should treat urls with the same host names as local" do
45
54
  @driver.should_not be_remote('http://www.local.com')
46
55
  end
47
-
56
+
48
57
  it "should treat other urls as remote" do
49
58
  @driver.should be_remote('http://www.remote.com')
50
59
  end
51
-
60
+
52
61
  it "should treat relative paths as remote if the previous request was remote" do
53
62
  @driver.visit(REMOTE_TEST_URL)
54
63
  @driver.should be_remote('/some_relative_link')
@@ -61,26 +70,32 @@ describe "Capybara::Driver::Mechanize, in local model" do
61
70
 
62
71
  it "should receive the right host" do
63
72
  @driver.visit('http://www.local.com/host')
64
- @driver.body.should == "current host is www.local.com:80, method get"
73
+ should_be_a_local_get
65
74
  end
66
75
 
67
- it "should always switch to the right context" do
76
+ it "should consider relative paths to be local when the previous request was local" do
68
77
  @driver.visit('http://www.local.com/host')
69
- should_be_a_local_get
70
-
71
78
  @driver.visit('/host')
79
+
72
80
  should_be_a_local_get
73
81
  @driver.should_not be_remote('/first_local')
74
-
82
+ end
83
+
84
+ it "should consider relative paths to be remote when the previous request was remote" do
75
85
  @driver.visit("#{REMOTE_TEST_URL}/host")
76
- should_be_a_remote_get
77
- @driver.should be_remote('/first_remote')
86
+ @driver.get('/host')
78
87
 
79
- @driver.visit('/host')
80
88
  should_be_a_remote_get
81
89
  @driver.should be_remote('/second_remote')
82
-
90
+ end
91
+
92
+ it "should always switch to the right context" do
83
93
  @driver.visit('http://www.local.com/host')
94
+ @driver.get('/host')
95
+ @driver.get("#{REMOTE_TEST_URL}/host")
96
+ @driver.get('/host')
97
+ @driver.get('http://www.local.com/host')
98
+
84
99
  should_be_a_local_get
85
100
  @driver.should_not be_remote('/second_local')
86
101
  end
@@ -90,9 +105,20 @@ describe "Capybara::Driver::Mechanize, in local model" do
90
105
  should_be_a_remote_get
91
106
  end
92
107
 
108
+ it "should follow redirects from remote to local" do
109
+ @driver.visit("#{REMOTE_TEST_URL}/redirect_to/http://www.local.com/host")
110
+ should_be_a_local_get
111
+ end
112
+
93
113
  after :each do
94
114
  Capybara.default_host = nil
95
115
  end
116
+
117
+ it "should raise a useful error for sites that return a 404, because it is probably a misconfiguration", :focus => true do
118
+ lambda {
119
+ @driver.visit("http://iamreallysurethatthisdoesntexist.com/canttouchthis")
120
+ }.should raise_error("Received the following error for a GET request to http://iamreallysurethatthisdoesntexist.com/canttouchthis: 'getaddrinfo: nodename nor servname provided, or not known'")
121
+ end
96
122
  end
97
123
 
98
124
  it "should include the right host when remote" do
@@ -100,14 +126,9 @@ describe "Capybara::Driver::Mechanize, in local model" do
100
126
  should_be_a_remote_get
101
127
  end
102
128
 
103
- it "should follow redirects from remote to local" do
104
- @driver.visit("#{REMOTE_TEST_URL}/redirect_to/http://www.local.com/host")
105
- should_be_a_local_get
106
- end
107
-
108
129
  describe '#reset!' do
109
130
  before :each do
110
- Capybara.default_host = 'www.local.com'
131
+ Capybara.default_host = 'http://www.local.com'
111
132
  end
112
133
 
113
134
  it 'should reset remote host' do
@@ -120,11 +141,11 @@ describe "Capybara::Driver::Mechanize, in local model" do
120
141
  end
121
142
 
122
143
  def should_be_a_remote_get
123
- @driver.body.should == "current host is #{REMOTE_TEST_HOST}, method get"
144
+ @driver.body.should include(REMOTE_TEST_URL)
124
145
  end
125
146
 
126
147
  def should_be_a_local_get
127
- @driver.body.should == "current host is www.local.com:80, method get"
148
+ @driver.body.should include("www.local.com")
128
149
  end
129
150
 
130
151
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Capybara::Driver::Mechanize do
3
+ describe Capybara::Mechanize::Driver do
4
4
  before(:each) do
5
5
  Capybara.app_host = REMOTE_TEST_URL
6
6
  end
@@ -10,31 +10,31 @@ describe Capybara::Driver::Mechanize do
10
10
  end
11
11
 
12
12
  before do
13
- @driver = Capybara::Driver::Mechanize.new
13
+ @driver = Capybara::Mechanize::Driver.new
14
14
  end
15
15
 
16
16
  context "in remote mode" do
17
17
  it "should not throw an error when no rack app is given" do
18
18
  running do
19
- Capybara::Driver::Mechanize.new
19
+ Capybara::Mechanize::Driver.new
20
20
  end.should_not raise_error(ArgumentError)
21
21
  end
22
22
 
23
23
  it "should pass arguments through to a get request" do
24
24
  @driver.visit("#{REMOTE_TEST_URL}/form/get", {:form => "success"})
25
- @driver.body.should == %{<pre id="results">--- success\n</pre>}
25
+ @driver.body.should include('success')
26
26
  end
27
27
 
28
28
  it "should pass arguments through to a post request" do
29
29
  @driver.post("#{REMOTE_TEST_URL}/form", {:form => "success"})
30
- @driver.body.should == %{<pre id="results">--- success\n</pre>}
30
+ @driver.body.should include('success')
31
31
  end
32
32
 
33
33
  context "for a post request" do
34
34
 
35
35
  it "should transform nested map in post data" do
36
36
  @driver.post("#{REMOTE_TEST_URL}/form", {:form => {:key => "value"}})
37
- @driver.body.should == %{<pre id="results">--- \nkey: value\n</pre>}
37
+ @driver.body.should include('key: value')
38
38
  end
39
39
 
40
40
  end
@@ -4,12 +4,12 @@ describe Capybara::Session do
4
4
  context 'with mechanize driver' do
5
5
  before do
6
6
  @session = Capybara::Session.new(:mechanize, TestApp)
7
- Capybara.default_host = "www.local.com"
7
+ Capybara.default_host = 'http://www.local.com'
8
8
  end
9
9
 
10
10
  describe '#driver' do
11
11
  it "should be a mechanize driver" do
12
- @session.driver.should be_an_instance_of(Capybara::Driver::Mechanize)
12
+ @session.driver.should be_an_instance_of(Capybara::Mechanize::Driver)
13
13
  end
14
14
  end
15
15
 
@@ -23,20 +23,20 @@ describe Capybara::Session do
23
23
  it "should use data-method if available" do
24
24
  @session.visit "/with_html"
25
25
  @session.click_link "A link with data-method"
26
- @session.body.should == 'The requested object was deleted'
26
+ @session.body.should include('The requested object was deleted')
27
27
  end
28
28
  end
29
29
 
30
30
  it "should use the last remote url when following relative links" do
31
31
  @session.visit("#{REMOTE_TEST_URL}/relative_link_to_host")
32
32
  @session.click_link "host"
33
- @session.body.should == "current host is #{REMOTE_TEST_HOST}, method get"
33
+ @session.body.should include("Current host is #{REMOTE_TEST_URL}, method get")
34
34
  end
35
35
 
36
36
  it "should use the last remote url when submitting a form with a relative action" do
37
37
  @session.visit("#{REMOTE_TEST_URL}/form_with_relative_action_to_host")
38
38
  @session.click_button "submit"
39
- @session.body.should == "current host is #{REMOTE_TEST_HOST}, method post"
39
+ @session.body.should include("Current host is #{REMOTE_TEST_URL}, method post")
40
40
  end
41
41
 
42
42
  it_should_behave_like "session"
@@ -17,7 +17,7 @@ describe Capybara::Session do
17
17
 
18
18
  describe '#driver' do
19
19
  it "should be a mechanize driver" do
20
- @session.driver.should be_an_instance_of(Capybara::Driver::Mechanize)
20
+ @session.driver.should be_an_instance_of(Capybara::Mechanize::Driver)
21
21
  end
22
22
  end
23
23
 
@@ -31,7 +31,7 @@ describe Capybara::Session do
31
31
  it "should use data-method if available" do
32
32
  @session.visit "/with_html"
33
33
  @session.click_link "A link with data-method"
34
- @session.body.should == 'The requested object was deleted'
34
+ @session.body.should include('The requested object was deleted')
35
35
  end
36
36
  end
37
37
 
data/spec/spec_helper.rb CHANGED
@@ -17,13 +17,15 @@ Capybara.default_wait_time = 0 # less timeout so tests run faster
17
17
  RSpec.configure do |config|
18
18
  config.after do
19
19
  Capybara.default_selector = :xpath
20
+ Capybara::Mechanize.local_hosts = nil
20
21
  end
21
22
  # config.filter_run :focus => true
22
23
  end
23
24
 
24
25
  # Until this library is merged with capybara there needs to be a local app and you need to add
25
- # 127.0.0.1 capybara-testapp.heroku.com to your host file
26
- # Run the app with the following line:
27
- # ruby -rrubygems lib/capybara/spec/extended_test_app.rb
28
- REMOTE_TEST_HOST = "capybara-testapp.heroku.com:8070"
29
- REMOTE_TEST_URL = "http://#{REMOTE_TEST_HOST}"
26
+ # Install pow (get.pow.cx) and run add a symlink in ~/.pow with ln -s lib/capybara/spec capybara-testapp.heroku
27
+ if ENV['HOME'] =~ /jvandijk/ # TODO don't tie it to my personal stuff :)
28
+ REMOTE_TEST_URL = "http://capybara-testapp.heroku.dev:80"
29
+ else
30
+ REMOTE_TEST_URL = "http://capybara-mechanize-testapp.herokuapp.com:80"
31
+ end
metadata CHANGED
@@ -1,70 +1,55 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: capybara-mechanize
3
- version: !ruby/object:Gem::Version
4
- hash: 25
5
- prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 7
10
- version: 0.2.7
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0.rc1
5
+ prerelease: 6
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Jeroen van Dijk
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2010-09-27 00:00:00 +02:00
12
+ date: 2010-09-27 00:00:00.000000000 +02:00
19
13
  default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- version_requirements: &id001 !ruby/object:Gem::Requirement
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: mechanize
17
+ requirement: &2165947000 !ruby/object:Gem::Requirement
23
18
  none: false
24
- requirements:
19
+ requirements:
25
20
  - - ~>
26
- - !ruby/object:Gem::Version
27
- hash: 23
28
- segments:
29
- - 1
30
- - 0
31
- - 0
21
+ - !ruby/object:Gem::Version
32
22
  version: 1.0.0
33
23
  type: :runtime
34
- requirement: *id001
35
- name: mechanize
36
24
  prerelease: false
37
- - !ruby/object:Gem::Dependency
38
- version_requirements: &id002 !ruby/object:Gem::Requirement
25
+ version_requirements: *2165947000
26
+ - !ruby/object:Gem::Dependency
27
+ name: capybara
28
+ requirement: &2165946180 !ruby/object:Gem::Requirement
39
29
  none: false
40
- requirements:
30
+ requirements:
41
31
  - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 15
44
- segments:
45
- - 0
46
- - 4
47
- - 0
48
- version: 0.4.0
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.0
49
34
  type: :runtime
50
- requirement: *id002
51
- name: capybara
52
35
  prerelease: false
53
- description: RackTest driver for Capybara, but with remote request support thanks to mechanize
36
+ version_requirements: *2165946180
37
+ description: RackTest driver for Capybara, but with remote request support thanks
38
+ to mechanize
54
39
  email: jeroen@jeevidee.nl
55
40
  executables: []
56
-
57
41
  extensions: []
58
-
59
42
  extra_rdoc_files: []
60
-
61
- files:
62
- - lib/capybara/driver/mechanize_driver.rb
43
+ files:
44
+ - lib/capybara/mechanize/browser.rb
63
45
  - lib/capybara/mechanize/cucumber.rb
46
+ - lib/capybara/mechanize/driver.rb
64
47
  - lib/capybara/mechanize.rb
65
48
  - lib/capybara/spec/extended_test_app.rb
49
+ - lib/capybara/spec/tmp/restart.txt
66
50
  - spec/driver/mechanize_driver_spec.rb
67
51
  - spec/driver/remote_mechanize_driver_spec.rb
52
+ - spec/README.mdown
68
53
  - spec/session/mechanize_spec.rb
69
54
  - spec/session/remote_mechanize_spec.rb
70
55
  - spec/spec_helper.rb
@@ -72,36 +57,30 @@ files:
72
57
  has_rdoc: true
73
58
  homepage: http://github.com/jeroenvandijk/capybara-mechanize
74
59
  licenses: []
75
-
76
60
  post_install_message:
77
- rdoc_options:
61
+ rdoc_options:
78
62
  - --charset=UTF-8
79
- require_paths:
63
+ require_paths:
80
64
  - lib
81
- required_ruby_version: !ruby/object:Gem::Requirement
65
+ required_ruby_version: !ruby/object:Gem::Requirement
82
66
  none: false
83
- requirements:
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- hash: 3
87
- segments:
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ segments:
88
72
  - 0
89
- version: "0"
90
- required_rubygems_version: !ruby/object:Gem::Requirement
73
+ hash: 1928965797535188471
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
75
  none: false
92
- requirements:
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- hash: 3
96
- segments:
97
- - 0
98
- version: "0"
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
99
80
  requirements: []
100
-
101
81
  rubyforge_project:
102
- rubygems_version: 1.4.1
82
+ rubygems_version: 1.6.2
103
83
  signing_key:
104
84
  specification_version: 3
105
85
  summary: RackTest driver for Capybara with remote request support
106
86
  test_files: []
107
-