capybara 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +36 -5
- data/README.md +1 -1
- data/lib/capybara.rb +3 -11
- data/lib/capybara/helpers.rb +2 -0
- data/lib/capybara/node/base.rb +1 -0
- data/lib/capybara/node/matchers.rb +3 -9
- data/lib/capybara/rack_test/browser.rb +1 -1
- data/lib/capybara/selector.rb +1 -0
- data/lib/capybara/server.rb +1 -1
- data/lib/capybara/session.rb +3 -0
- data/lib/capybara/spec/session/current_url_spec.rb +10 -10
- data/lib/capybara/spec/session/node_spec.rb +4 -0
- data/lib/capybara/spec/session/screenshot.rb +1 -0
- data/lib/capybara/spec/spec_helper.rb +19 -22
- data/lib/capybara/version.rb +1 -1
- data/spec/dsl_spec.rb +8 -24
- data/spec/spec_helper.rb +4 -0
- metadata +2 -2
data/History.md
CHANGED
@@ -1,14 +1,37 @@
|
|
1
|
-
#
|
1
|
+
# Version 2.0.2
|
2
|
+
|
3
|
+
Release date: 2012-12-31
|
4
|
+
|
5
|
+
### Changed
|
6
|
+
|
7
|
+
* Capybara no longer uses thin as a server if it is available, due to thread
|
8
|
+
safety issues. Now Capybara always defaults to WEBrick. [Jonas Nicklas]
|
9
|
+
|
10
|
+
### Fixed
|
11
|
+
|
12
|
+
* Suppress several warnings [Kouhei Sutou]
|
13
|
+
* Fix default host becoming nil [Brian Cardarella]
|
14
|
+
* Fix regression in 2.0.1 which caused node comparisons with non node objects
|
15
|
+
to throw an exception [Kouhei Sotou]
|
16
|
+
* A few changes to the specs, only relevant to driver authors [Jonas Nicklas]
|
17
|
+
* Encoding error under JRuby [Piotr Krawiec]
|
18
|
+
* Ruby 2 encoding fix [Murahashi Sanemat Kenichi]
|
19
|
+
* Catch correct exception on server timeout [Jonathan del Strother]
|
20
|
+
|
21
|
+
# Version 2.0.1
|
22
|
+
|
23
|
+
Release date: 2012-12-21
|
2
24
|
|
3
25
|
### Changed
|
4
26
|
|
5
27
|
* Move the RackTest driver override with the `:respect_data_method` option
|
6
28
|
enabled from capybara/rspec to capybara/rails, so that it is enabled in
|
7
29
|
Rails projects that don't use RSpec. [Carlos Antonio da Silva]
|
8
|
-
*
|
9
|
-
to `
|
10
|
-
anyway, and should have minimal impact for end users.
|
11
|
-
|
30
|
+
* `source` is now an alias for `html`. RackTest no longer returns modifications
|
31
|
+
to `html`. This basically codifies the behaviour which we've had for a while
|
32
|
+
anyway, and should have minimal impact for end users. For driver authors, it
|
33
|
+
means that they only have to implement `html`, and not `source`. [Jonas
|
34
|
+
Nicklas]
|
12
35
|
|
13
36
|
### Fixed
|
14
37
|
|
@@ -131,6 +154,14 @@ Release date: 2012-11-05
|
|
131
154
|
* `:count => 0` now works as expected [Jarl Friis]
|
132
155
|
* Fixed race conditions on negative assertions when removing nodes [Jonas Nicklas]
|
133
156
|
|
157
|
+
# Version 1.1.4
|
158
|
+
|
159
|
+
Release date: 2012-11-28
|
160
|
+
|
161
|
+
### Fixed
|
162
|
+
|
163
|
+
* Fix more race conditions on negative assertions. [Jonas Nicklas]
|
164
|
+
|
134
165
|
# Version 1.1.3
|
135
166
|
|
136
167
|
Release date: 2012-10-30
|
data/README.md
CHANGED
@@ -827,7 +827,7 @@ additional info about how the underlying driver can be configured.
|
|
827
827
|
since Capybara's Ajax timing uses the system time, resulting in Capybara
|
828
828
|
never timing out and just hanging when a failure occurs. It's still possible to
|
829
829
|
use gems which allow you to travel in time, rather than freeze time.
|
830
|
-
One such gem is [Timecop](http://github.com/
|
830
|
+
One such gem is [Timecop](http://github.com/travisjeffery/timecop).
|
831
831
|
|
832
832
|
* When using Rack::Test, beware if attempting to visit absolute URLs. For
|
833
833
|
example, a session might not be shared between visits to `posts_path`
|
data/lib/capybara.rb
CHANGED
@@ -12,9 +12,7 @@ module Capybara
|
|
12
12
|
class FileNotFound < CapybaraError; end
|
13
13
|
class UnselectNotAllowed < CapybaraError; end
|
14
14
|
class NotSupportedByDriverError < CapybaraError; end
|
15
|
-
class
|
16
|
-
class LocateHiddenElementError < CapybaraError; end
|
17
|
-
class InfiniteRedirectError < TimeoutError; end
|
15
|
+
class InfiniteRedirectError < CapybaraError; end
|
18
16
|
|
19
17
|
class << self
|
20
18
|
attr_accessor :asset_root, :app_host, :run_server, :default_host, :always_include_port
|
@@ -175,14 +173,8 @@ module Capybara
|
|
175
173
|
# @param [Fixnum] port The port to run the application on
|
176
174
|
#
|
177
175
|
def run_default_server(app, port)
|
178
|
-
|
179
|
-
|
180
|
-
Thin::Logging.silent = true
|
181
|
-
Rack::Handler::Thin.run(app, :Port => port)
|
182
|
-
rescue LoadError
|
183
|
-
require 'rack/handler/webrick'
|
184
|
-
Rack::Handler::WEBrick.run(app, :Port => port, :AccessLog => [], :Logger => WEBrick::Log::new(nil, 0))
|
185
|
-
end
|
176
|
+
require 'rack/handler/webrick'
|
177
|
+
Rack::Handler::WEBrick.run(app, :Port => port, :AccessLog => [], :Logger => WEBrick::Log::new(nil, 0))
|
186
178
|
end
|
187
179
|
|
188
180
|
##
|
data/lib/capybara/helpers.rb
CHANGED
data/lib/capybara/node/base.rb
CHANGED
@@ -421,15 +421,9 @@ module Capybara
|
|
421
421
|
##
|
422
422
|
#
|
423
423
|
# Checks if the page or current node has a table with the given id
|
424
|
-
# or caption
|
424
|
+
# or caption:
|
425
425
|
#
|
426
|
-
#
|
427
|
-
# the rows and columns given:
|
428
|
-
#
|
429
|
-
# page.has_table?('People', :rows => [['Jonas', '24'], ['Peter', '32']])
|
430
|
-
#
|
431
|
-
# Note that this option is quite strict, the order needs to be correct
|
432
|
-
# and the text needs to match exactly.
|
426
|
+
# page.has_table?('People')
|
433
427
|
#
|
434
428
|
# @param [String] locator The id or caption of a table
|
435
429
|
# @return [Boolean] Whether it exist
|
@@ -451,7 +445,7 @@ module Capybara
|
|
451
445
|
end
|
452
446
|
|
453
447
|
def ==(other)
|
454
|
-
self.eql?(other) or base == other.base
|
448
|
+
self.eql?(other) or (other.respond_to?(:base) and base == other.base)
|
455
449
|
end
|
456
450
|
|
457
451
|
private
|
data/lib/capybara/selector.rb
CHANGED
data/lib/capybara/server.rb
CHANGED
data/lib/capybara/session.rb
CHANGED
@@ -79,15 +79,15 @@ Capybara::SpecHelper.spec '#current_url, #current_path, #current_host' do
|
|
79
79
|
should_be_on 0, "/landed"
|
80
80
|
end
|
81
81
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
82
|
+
it "is affected by pushState", :requires => [:js] do
|
83
|
+
@session.visit("/with_js")
|
84
|
+
@session.execute_script("window.history.pushState({}, '', '/pushed')")
|
85
|
+
@session.current_path.should == "/pushed"
|
86
|
+
end
|
87
87
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
88
|
+
it "is affected by replaceState", :requires => [:js] do
|
89
|
+
@session.visit("/with_js")
|
90
|
+
@session.execute_script("window.history.replaceState({}, '', '/replaced')")
|
91
|
+
@session.current_path.should == "/replaced"
|
92
|
+
end
|
93
93
|
end
|
@@ -114,6 +114,10 @@ Capybara::SpecHelper.spec "node" do
|
|
114
114
|
(@session.find('//h1') === @session.find('//h1')).should be_true
|
115
115
|
(@session.find('//h1').eql? @session.find('//h1')).should be_false
|
116
116
|
end
|
117
|
+
|
118
|
+
it "returns false for unrelated object" do
|
119
|
+
(@session.find('//h1') == "Not Capybara::Node::Base").should be_false
|
120
|
+
end
|
117
121
|
end
|
118
122
|
|
119
123
|
describe "#trigger", :requires => [:js, :trigger] do
|
@@ -9,24 +9,25 @@ module Capybara
|
|
9
9
|
module SpecHelper
|
10
10
|
class << self
|
11
11
|
def configure(config)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
17
|
-
else
|
18
|
-
false
|
19
|
-
end
|
20
|
-
end
|
21
|
-
config.filter_run_excluding :requires => filter
|
22
|
-
config.before do
|
23
|
-
Capybara.app = TestApp
|
12
|
+
config.filter_run_excluding :requires => method(:filter).to_proc
|
13
|
+
config.before { Capybara::SpecHelper.reset! }
|
14
|
+
config.after { Capybara::SpecHelper.reset! }
|
15
|
+
end
|
24
16
|
|
25
|
-
|
26
|
-
|
27
|
-
|
17
|
+
def reset!
|
18
|
+
Capybara.app = TestApp
|
19
|
+
Capybara.app_host = nil
|
20
|
+
Capybara.default_selector = :xpath
|
21
|
+
Capybara.default_wait_time = 1
|
22
|
+
end
|
28
23
|
|
29
|
-
|
24
|
+
def filter(requires, metadata)
|
25
|
+
if requires and metadata[:skip]
|
26
|
+
requires.any? do |require|
|
27
|
+
metadata[:skip].include?(require)
|
28
|
+
end
|
29
|
+
else
|
30
|
+
false
|
30
31
|
end
|
31
32
|
end
|
32
33
|
|
@@ -45,8 +46,8 @@ module Capybara
|
|
45
46
|
after do
|
46
47
|
@session.reset_session!
|
47
48
|
end
|
48
|
-
specs.each do |
|
49
|
-
describe
|
49
|
+
specs.each do |spec_name, spec_options, block|
|
50
|
+
describe spec_name, spec_options do
|
50
51
|
class_eval(&block)
|
51
52
|
end
|
52
53
|
end
|
@@ -77,8 +78,4 @@ module Capybara
|
|
77
78
|
end
|
78
79
|
end
|
79
80
|
|
80
|
-
RSpec.configure do |config|
|
81
|
-
Capybara::SpecHelper.configure(config)
|
82
|
-
end
|
83
|
-
|
84
81
|
Dir[File.dirname(__FILE__)+'/session/*'].each { |group| require group }
|
data/lib/capybara/version.rb
CHANGED
data/spec/dsl_spec.rb
CHANGED
@@ -229,41 +229,25 @@ describe Capybara::DSL do
|
|
229
229
|
end
|
230
230
|
|
231
231
|
it "should be possible to include it in another class" do
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
foo = klass.new
|
236
|
-
foo.visit('/with_html')
|
237
|
-
foo.click_link('ullamco')
|
238
|
-
foo.body.should include('Another World')
|
232
|
+
@session.visit('/with_html')
|
233
|
+
@session.click_link('ullamco')
|
234
|
+
@session.body.should include('Another World')
|
239
235
|
end
|
240
236
|
|
241
237
|
it "should provide a 'page' shortcut for more expressive tests" do
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
foo = klass.new
|
246
|
-
foo.page.visit('/with_html')
|
247
|
-
foo.page.click_link('ullamco')
|
248
|
-
foo.page.body.should include('Another World')
|
238
|
+
@session.page.visit('/with_html')
|
239
|
+
@session.page.click_link('ullamco')
|
240
|
+
@session.page.body.should include('Another World')
|
249
241
|
end
|
250
242
|
|
251
243
|
it "should provide an 'using_session' shortcut" do
|
252
|
-
klass = Class.new do
|
253
|
-
include Capybara::DSL
|
254
|
-
end
|
255
244
|
Capybara.should_receive(:using_session).with(:name)
|
256
|
-
|
257
|
-
foo.using_session(:name)
|
245
|
+
@session.using_session(:name)
|
258
246
|
end
|
259
247
|
|
260
248
|
it "should provide a 'using_wait_time' shortcut" do
|
261
|
-
klass = Class.new do
|
262
|
-
include Capybara::DSL
|
263
|
-
end
|
264
249
|
Capybara.should_receive(:using_wait_time).with(6)
|
265
|
-
|
266
|
-
foo.using_wait_time(6)
|
250
|
+
@session.using_wait_time(6)
|
267
251
|
end
|
268
252
|
end
|
269
253
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
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: 2012-
|
12
|
+
date: 2012-12-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|