capybara-mechanize 1.10.1 → 1.12.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  module TestSessions
4
- Mechanize = Capybara::Session.new(:mechanize, TestApp)
6
+ RemoteMechanize = Capybara::Session.new(:mechanize, TestApp)
5
7
  end
6
8
 
7
- shared_context "remote tests" do
9
+ shared_context 'remote tests' do
8
10
  before do
9
11
  Capybara.app_host = remote_test_url
10
12
  end
@@ -14,29 +16,31 @@ shared_context "remote tests" do
14
16
  end
15
17
  end
16
18
 
17
- session_describe = Capybara::SpecHelper.run_specs TestSessions::Mechanize, "Mechanize", :capybara_skip => [
18
- :js,
19
- :screenshot,
20
- :frames,
21
- :windows,
22
- :server,
23
- :hover,
24
- :modals,
25
- :about_scheme,
26
- :send_keys
19
+ skipped_tests = %i[
20
+ about_scheme
21
+ active_element
22
+ css
23
+ download
24
+ frames
25
+ hover
26
+ html_validation
27
+ js
28
+ modals
29
+ screenshot
30
+ scroll
31
+ send_keys
32
+ server
33
+ shadow_dom
34
+ spatial
35
+ windows
27
36
  ]
28
37
 
29
- session_describe.include_context("remote tests")
30
-
31
- # We disable additional tests because we don't provide a server, but do test external URls
32
- disabler = DisableExternalTests.new
33
- disabler.tests_to_disable = [
34
- ['#visit', 'when Capybara.always_include_port is true', 'should fetch a response from the driver with an absolute url without a port'],
35
- ['#has_current_path?', 'should compare the full url if url: true is used'],
36
- ['#reset_session!', 'raises any errors caught inside the server'],
37
- ['#reset_session!', 'raises any standard errors caught inside the server']
38
- ]
39
- disabler.disable(session_describe)
38
+ Capybara::SpecHelper.run_specs(TestSessions::RemoteMechanize, 'RemoteMechanize', capybara_skip: skipped_tests) do |example|
39
+ case example.metadata[:full_description]
40
+ when /has_css\? should support case insensitive :class and :id options/
41
+ skip "Nokogiri doesn't support case insensitive CSS attribute matchers"
42
+ end
43
+ end
40
44
 
41
45
  describe Capybara::Session do
42
46
  context 'with remote mechanize driver' do
@@ -45,37 +49,37 @@ describe Capybara::Session do
45
49
  let(:session) { Capybara::Session.new(:mechanize, ExtendedTestApp) }
46
50
 
47
51
  describe '#driver' do
48
- it "should be a mechanize driver" do
49
- session.driver.should be_an_instance_of(Capybara::Mechanize::Driver)
52
+ it 'should be a mechanize driver' do
53
+ expect(session.driver).to be_an_instance_of(Capybara::Mechanize::Driver)
50
54
  end
51
55
  end
52
56
 
53
57
  describe '#mode' do
54
- it "should remember the mode" do
55
- session.mode.should == :mechanize
58
+ it 'should remember the mode' do
59
+ expect(session.mode).to eq(:mechanize)
56
60
  end
57
61
  end
58
62
 
59
63
  describe '#click_link' do
60
- it "should use data-method if option is true" do
64
+ it 'should use data-method if option is true' do
61
65
  session.driver.options[:respect_data_method] = true
62
- session.visit "/with_html"
63
- session.click_link "A link with data-method"
64
- session.html.should include('The requested object was deleted')
66
+ session.visit '/with_html'
67
+ session.click_link 'A link with data-method'
68
+ expect(session.html).to include('The requested object was deleted')
65
69
  end
66
70
 
67
- it "should not use data-method if option is false" do
71
+ it 'should not use data-method if option is false' do
68
72
  session.driver.options[:respect_data_method] = false
69
- session.visit "/with_html"
70
- session.click_link "A link with data-method"
71
- session.html.should include('Not deleted')
73
+ session.visit '/with_html'
74
+ session.click_link 'A link with data-method'
75
+ expect(session.html).to include('Not deleted')
72
76
  end
73
77
 
74
78
  it "should use data-method if available even if it's capitalized" do
75
79
  session.driver.options[:respect_data_method] = true
76
- session.visit "/with_html"
77
- session.click_link "A link with capitalized data-method"
78
- session.html.should include('The requested object was deleted')
80
+ session.visit '/with_html'
81
+ session.click_link 'A link with capitalized data-method'
82
+ expect(session.html).to include('The requested object was deleted')
79
83
  end
80
84
 
81
85
  after do
@@ -83,27 +87,27 @@ describe Capybara::Session do
83
87
  end
84
88
  end
85
89
 
86
- describe "#attach_file" do
87
- context "with multipart form" do
88
- it "should submit an empty form-data section if no file is submitted" do
89
- session.visit("/form")
90
- session.click_button("Upload Empty")
91
- session.html.should include('Successfully ignored empty file field.')
90
+ describe '#attach_file' do
91
+ context 'with multipart form' do
92
+ it 'should submit an empty form-data section if no file is submitted' do
93
+ session.visit('/form')
94
+ session.click_button('Upload Empty')
95
+ expect(session.html).to include('Successfully ignored empty file field.')
92
96
  end
93
97
  end
94
98
  end
95
99
 
96
- context "remote app in a sub-path" do
97
- it "follows relative link correctly" do
98
- session.visit "/subsite/relative_link_to_host"
99
- session.click_link "host"
100
- session.body.should include('request_info2/host')
100
+ context 'remote app in a sub-path' do
101
+ it 'follows relative link correctly' do
102
+ session.visit '/subsite/relative_link_to_host'
103
+ session.click_link 'host'
104
+ expect(session.body).to include('request_info2/host')
101
105
  end
102
106
 
103
- it "follows local link correctly" do
104
- session.visit "/subsite/local_link_to_host"
105
- session.click_link "host"
106
- session.body.should include('request_info2/host')
107
+ it 'follows local link correctly' do
108
+ session.visit '/subsite/local_link_to_host'
109
+ session.click_link 'host'
110
+ expect(session.body).to include('request_info2/host')
107
111
  end
108
112
  end
109
113
  end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'capybara/spec/spec_helper'
2
4
  require 'capybara/mechanize'
3
5
  require 'capybara/spec/extended_test_app'
@@ -9,10 +11,8 @@ $LOAD_PATH << File.join(PROJECT_ROOT, 'lib')
9
11
  Dir[File.join(PROJECT_ROOT, 'spec', 'support', '**', '*.rb')].each { |file| require(file) }
10
12
 
11
13
  RSpec.configure do |config|
12
- # This needs to remain commented out until there is a capybara release that includes https://github.com/jnicklas/capybara/pull/1078
13
- # config.filter_run :focus => true
14
+ config.filter_run focus: true unless ENV['CI']
14
15
  config.run_all_when_everything_filtered = true
15
- config.treat_symbols_as_metadata_keys_with_true_values = true
16
16
 
17
17
  # Used with DisableExternalTests
18
18
  config.filter_run_excluding :external_test_disabled
@@ -27,8 +27,7 @@ RSpec.configure do |config|
27
27
 
28
28
  Capybara::SpecHelper.configure(config)
29
29
 
30
- config.order = "random"
30
+ config.order = 'random'
31
31
 
32
32
  CAPYBARA_DEFAULT_HOST = Capybara.default_host
33
33
  end
34
-
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class DisableExternalTests
2
4
  attr_accessor :tests_to_disable
3
5
 
@@ -8,13 +10,12 @@ class DisableExternalTests
8
10
  example_description = to_disable.pop
9
11
 
10
12
  to_disable.each do |description|
11
- example_group = example_group.children.find{ |g| g.description == description }
13
+ example_group = example_group.children.find { |g| g.description == description }
12
14
  end
13
15
 
14
- example = example_group.examples.find{ |e| e.description == example_description }
16
+ example = example_group.examples.find { |e| e.description == example_description }
15
17
 
16
18
  example.metadata[:external_test_disabled] = true unless example.nil?
17
19
  end
18
-
19
20
  end
20
21
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This class works around some weirdness with Capybara's test suite and sinatra's behavior.
2
4
  # We need to make sure that sinatra uses TestApp for at least one request before the Capybara session
3
5
  # specs run. Without this we get errors from sinatra trying to handle requests with TestApp.clone
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RemoteTestUrl
2
4
  def remote_test_url
3
5
  ExtendedTestAppSetup.new.boot.remote_test_url
4
6
  end
5
- end
7
+ end
metadata CHANGED
@@ -1,49 +1,105 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-mechanize
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.1
4
+ version: 1.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeroen van Dijk
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-16 00:00:00.000000000 Z
11
+ date: 2022-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: capybara
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 3.0.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: 3.37.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 3.0.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 3.37.0
13
33
  - !ruby/object:Gem::Dependency
14
34
  name: mechanize
15
35
  requirement: !ruby/object:Gem::Requirement
16
36
  requirements:
17
37
  - - "~>"
18
38
  - !ruby/object:Gem::Version
19
- version: 2.7.0
39
+ version: 2.8.5
20
40
  type: :runtime
21
41
  prerelease: false
22
42
  version_requirements: !ruby/object:Gem::Requirement
23
43
  requirements:
24
44
  - - "~>"
25
45
  - !ruby/object:Gem::Version
26
- version: 2.7.0
46
+ version: 2.8.5
27
47
  - !ruby/object:Gem::Dependency
28
- name: capybara
48
+ name: launchy
29
49
  requirement: !ruby/object:Gem::Requirement
30
50
  requirements:
31
51
  - - ">="
32
52
  - !ruby/object:Gem::Version
33
- version: 2.4.4
34
- - - "<"
53
+ version: 2.0.4
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
35
59
  - !ruby/object:Gem::Version
36
- version: '4'
37
- type: :runtime
60
+ version: 2.0.4
61
+ - !ruby/object:Gem::Dependency
62
+ name: rake
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
38
69
  prerelease: false
39
70
  version_requirements: !ruby/object:Gem::Requirement
40
71
  requirements:
41
72
  - - ">="
42
73
  - !ruby/object:Gem::Version
43
- version: 2.4.4
44
- - - "<"
74
+ version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rdoc
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rspec
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
45
94
  - !ruby/object:Gem::Version
46
- version: '4'
95
+ version: '3.5'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '3.5'
47
103
  description: RackTest driver for Capybara, but with remote request support thanks
48
104
  to mechanize
49
105
  email: jeroen@jeevidee.nl
@@ -71,7 +127,7 @@ files:
71
127
  homepage: https://github.com/jeroenvandijk/capybara-mechanize
72
128
  licenses: []
73
129
  metadata: {}
74
- post_install_message:
130
+ post_install_message:
75
131
  rdoc_options:
76
132
  - "--charset=UTF-8"
77
133
  require_paths:
@@ -80,16 +136,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
80
136
  requirements:
81
137
  - - ">="
82
138
  - !ruby/object:Gem::Version
83
- version: '0'
139
+ version: 2.6.0
84
140
  required_rubygems_version: !ruby/object:Gem::Requirement
85
141
  requirements:
86
142
  - - ">="
87
143
  - !ruby/object:Gem::Version
88
144
  version: '0'
89
145
  requirements: []
90
- rubyforge_project:
91
- rubygems_version: 2.4.8
92
- signing_key:
146
+ rubygems_version: 3.1.4
147
+ signing_key:
93
148
  specification_version: 4
94
149
  summary: RackTest driver for Capybara with remote request support
95
150
  test_files: []