capybara 2.10.0 → 2.10.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e04794fbb1724e14269beeff9388b53a6f8603b
4
- data.tar.gz: 377ee4cf8d61e2c1420ad7bc44b400e1f991ac30
3
+ metadata.gz: 07946b3e00d76327b735257b253d81a77f0bfd00
4
+ data.tar.gz: d374024318381ec84383a452871be665f7645168
5
5
  SHA512:
6
- metadata.gz: afcaeaf6eb1aa0690b74ffa21acbaea6282b2ed0aba4382bc926ec6a6fbdd43bff3facc886e2d5558f7cf9af167a8278ef9ded0e946dbc9052168fc6583e94f4
7
- data.tar.gz: b6be9f0cd07cc125a46f14c9a322b789547eb875252a10d217b4c1410080bf4be0c146c83361846a17a114b1c648416dca1a3301eefdb26087f215a0fa120872
6
+ metadata.gz: 0d5d700c0b6473d31e6196ff3def9f259a72038c4bfc4082e2b2351bda87ecbe20d25843d59eaba8f6b50de19f0314e708d9e340149cf0385eb2e8c0874f2bfc
7
+ data.tar.gz: 5ce06798a097f56b478b3d1d9345aa50bc21977db980832747dba6429edd9506ea20aecbaebd320aae9e17675c46201f168bbdbc34ddf9cc3923e3458eef6184
data/History.md CHANGED
@@ -1,3 +1,11 @@
1
+ #2.10.1
2
+ Release date: 2016-10-08
3
+
4
+ ### Fixed
5
+ * App errors are now correctly raised with the explanatory cause in JRuby [Thomas Walpole]
6
+ * Capybara::Result optimization disabled in JRuby due to issue with lazy enumerator evaluation [Thomas Walpole]
7
+ See: https://github.com/jruby/jruby/issues/4212
8
+
1
9
  #2.10.0
2
10
  Release date: 2016-10-05
3
11
 
@@ -28,6 +28,11 @@ module Capybara
28
28
  @result_cache = []
29
29
  @results_enum = lazy_select_elements { |node| query.matches_filters?(node) }
30
30
  @query = query
31
+ # JRuby has an issue with eagerly finding next in lazy enumerators which
32
+ # causes a concurrency issue with network requests here
33
+ # https://github.com/jruby/jruby/issues/4212
34
+ # Just force all the results to be evaluated
35
+ full_results if RUBY_PLATFORM == 'java'
31
36
  end
32
37
 
33
38
  def_delegators :full_results, :size, :length, :last, :values_at, :inspect, :sample
@@ -345,6 +345,7 @@ Capybara.add_selector(:select) do
345
345
  end
346
346
  options.sort == actual.sort
347
347
  end
348
+
348
349
  filter(:with_options) do |node, options|
349
350
  finder_settings = { minimum: 0 }
350
351
  if !node.visible?
@@ -352,6 +353,7 @@ Capybara.add_selector(:select) do
352
353
  end
353
354
  options.all? { |option| node.first(:option, option, finder_settings) }
354
355
  end
356
+
355
357
  filter(:selected) do |node, selected|
356
358
  actual = node.all(:xpath, './/option', visible: false).select { |option| option.selected? }.map { |option| option.text(:all) }
357
359
  [selected].flatten.sort == actual.sort
@@ -2,6 +2,7 @@
2
2
  require "uri"
3
3
 
4
4
  class Capybara::Selenium::Driver < Capybara::Driver::Base
5
+
5
6
  DEFAULT_OPTIONS = {
6
7
  :browser => :firefox
7
8
  }
@@ -40,6 +41,7 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
40
41
  end
41
42
  end
42
43
 
44
+
43
45
  @app = app
44
46
  @browser = nil
45
47
  @exit_status = nil
@@ -125,7 +125,7 @@ module Capybara
125
125
  begin
126
126
  raise CapybaraError, "Your application server raised an error - It has been raised in your test code because Capybara.raise_server_errors == true"
127
127
  rescue CapybaraError
128
- raise @server.error
128
+ raise @server.error.class, @server.error.message, @server.error.backtrace
129
129
  end
130
130
  end
131
131
  ensure
@@ -70,7 +70,7 @@ $(function() {
70
70
  }
71
71
  });
72
72
  $('#open-alert').click(function() {
73
- alert('Alert opened');
73
+ alert('Alert opened [*Yay?*]');
74
74
  $(this).attr('opened', 'true');
75
75
  });
76
76
  $('#open-delayed-alert').click(function() {
@@ -18,6 +18,20 @@ Capybara::SpecHelper.spec '#accept_alert', requires: [:modals] do
18
18
  expect(@session).to have_xpath("//a[@id='open-alert' and @opened='true']")
19
19
  end
20
20
 
21
+ it 'should accept the alert if text contains "special" Regex characters' do
22
+ @session.accept_alert 'opened [*Yay?*]' do
23
+ @session.click_link('Open alert')
24
+ end
25
+ expect(@session).to have_xpath("//a[@id='open-alert' and @opened='true']")
26
+ end
27
+
28
+ it "should accept the alert if the text matches a regexp" do
29
+ @session.accept_alert /op.{2}ed/ do
30
+ @session.click_link('Open alert')
31
+ end
32
+ expect(@session).to have_xpath("//a[@id='open-alert' and @opened='true']")
33
+ end
34
+
21
35
  it "should not accept the alert if the text doesnt match" do
22
36
  expect do
23
37
  @session.accept_alert 'Incorrect Text' do
@@ -30,7 +44,7 @@ Capybara::SpecHelper.spec '#accept_alert', requires: [:modals] do
30
44
  message = @session.accept_alert do
31
45
  @session.click_link('Open alert')
32
46
  end
33
- expect(message).to eq('Alert opened')
47
+ expect(message).to eq('Alert opened [*Yay?*]')
34
48
  end
35
49
 
36
50
  context "with an asynchronous alert" do
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Capybara
3
- VERSION = '2.10.0'
3
+ VERSION = '2.10.1'
4
4
  end
@@ -73,6 +73,7 @@ RSpec.describe Capybara::Result do
73
73
 
74
74
  #Not a great test but it indirectly tests what is needed
75
75
  it "should evaluate filters lazily" do
76
+ skip 'JRuby has an issue with lazy enumerator next evaluation' if RUBY_PLATFORM == 'java'
76
77
  #Not processed until accessed
77
78
  expect(result.instance_variable_get('@result_cache').size).to be 0
78
79
 
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.10.0
4
+ version: 2.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Walpole
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain:
12
12
  - gem-public_cert.pem
13
- date: 2016-10-05 00:00:00.000000000 Z
13
+ date: 2016-10-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nokogiri
@@ -442,7 +442,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
442
442
  version: '0'
443
443
  requirements: []
444
444
  rubyforge_project:
445
- rubygems_version: 2.6.4
445
+ rubygems_version: 2.5.1
446
446
  signing_key:
447
447
  specification_version: 4
448
448
  summary: Capybara aims to simplify the process of integration testing Rack applications,