falcon-capybara 1.3.7 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00abd748a16beb901d11083d9e27f8f8dc5af89c7995ba56f1dcba5f42aab1b7
4
- data.tar.gz: a943bad9fa872f683a913227d1c8d7f2196a606c099d46c6dd5e0b74bf3ebba3
3
+ metadata.gz: 01acd8665a3d99cf7c1fa53c438db7c9b5e341f77ba09114660f5cceffd86603
4
+ data.tar.gz: 3b14914f66d4637bf7ffd72858f0ed8db7827b67995a1c2a9c699bfc4463cfbe
5
5
  SHA512:
6
- metadata.gz: 5dc019449fe32d98e4b4ea25cee777d1329dec4136b8a7f112d3a5e821a390ff5d0e6cf1c4ac71372bb99d6f8c99cd6ef5c41265ee633cafb43a1ded15934375
7
- data.tar.gz: f51365d4c8d3b2cf659cabe32a61860fde0d4ad698740a77e349e7c6699d888847f5a3bb0305eab181daa6e5ca854122e715a6a2f92672c61b23a74c33281717
6
+ metadata.gz: 5a2efd236298b2165e47efa3c3d083de996b7740f934dd4a65cc5ab09de8374adfc770ec11f92aba10680e9c8fb01327109113cf253b7771dce207ce44b847c0
7
+ data.tar.gz: 80f846895f524710119ddc31425b906d9ec556a2517746b48f4bbd1c30ecee04a03a8f7227d797517049ffec80827ebb160ee861a32c2b8c0bf2b8417e5aedde
@@ -22,5 +22,5 @@ require 'capybara'
22
22
 
23
23
  require_relative "capybara/version"
24
24
  require_relative "capybara/wrapper"
25
-
26
- Capybara.servers[:falcon] = Falcon::Capybara::Wrapper.new
25
+ require_relative "capybara/servers"
26
+ require_relative "capybara/drivers"
@@ -0,0 +1,34 @@
1
+ # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require 'capybara'
22
+ require 'selenium/webdriver'
23
+
24
+ Capybara.register_driver :selenium_chrome_https do |app|
25
+ Capybara.drivers[:selenium_chrome].call(app).tap do |driver|
26
+ driver.options[:options].args << '--allow-insecure-localhost'
27
+ end
28
+ end
29
+
30
+ Capybara.register_driver :selenium_chrome_headless_https do |app|
31
+ Capybara.drivers[:selenium_chrome_headless].call(app).tap do |driver|
32
+ driver.options[:options].args << '--allow-insecure-localhost'
33
+ end
34
+ end
@@ -0,0 +1,25 @@
1
+ # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require 'capybara'
22
+
23
+ Capybara.servers[:falcon] = Falcon::Capybara::Wrapper.new
24
+ Capybara.servers[:falcon_http] = Falcon::Capybara::Wrapper.new("http")
25
+ Capybara.servers[:falcon_https] = Falcon::Capybara::Wrapper.new("https")
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Falcon
22
22
  module Capybara
23
- VERSION = "1.3.7"
23
+ VERSION = "1.4.0"
24
24
  end
25
25
  end
@@ -20,15 +20,16 @@
20
20
 
21
21
  require 'thread'
22
22
 
23
- require 'async/reactor'
24
- require 'async/io/host_endpoint'
23
+ require 'async'
24
+ require 'falcon/endpoint'
25
25
  require 'async/io/notification'
26
26
 
27
27
  module Falcon
28
28
  module Capybara
29
29
  class Wrapper
30
- def initialize
30
+ def initialize(scheme = "http")
31
31
  @job = nil
32
+ @scheme = scheme
32
33
 
33
34
  @job_available = Async::IO::Notification.new
34
35
  @job_complete = Async::IO::Notification.new
@@ -43,31 +44,30 @@ module Falcon
43
44
  @job = block
44
45
  @job_available.signal
45
46
 
46
- Async::Reactor.run do
47
+ Async do
47
48
  Async.logger.debug (self) {"Waiting for job completion..."}
48
49
  @job_complete.wait
49
50
  end.wait
50
51
  end
51
52
 
52
- def protocol
53
- Async::HTTP::Protocol::HTTP1
54
- end
55
-
56
- def scheme
57
- "http"
53
+ def endpoint(host, port)
54
+ Falcon::Endpoint.parse("#{@scheme}://#{host}:#{port}")
58
55
  end
59
56
 
60
57
  def call(rack_app, port, host)
61
58
  require 'async/reactor'
62
59
  require 'falcon/server'
63
60
 
64
- Async::Reactor.run do |task|
61
+ Async do |task|
65
62
  app = Falcon::Server.middleware(rack_app)
66
63
 
67
- server = Falcon::Server.new(app,
68
- Async::IO::Endpoint.tcp(host, port),
69
- protocol, scheme
70
- )
64
+ if host == "127.0.0.1"
65
+ host = "localhost"
66
+ end
67
+
68
+ endpoint = self.endpoint(host, port)
69
+
70
+ server = Falcon::Server.new(app, endpoint, endpoint.protocol, endpoint.scheme)
71
71
 
72
72
  task.async do
73
73
  Async.logger.debug (self) {"Running server..."}
metadata CHANGED
@@ -1,31 +1,45 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: falcon-capybara
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.7
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-26 00:00:00.000000000 Z
11
+ date: 2020-05-25 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: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: falcon
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - "~>"
18
32
  - !ruby/object:Gem::Version
19
- version: '0.19'
33
+ version: '0.34'
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
38
  - - "~>"
25
39
  - !ruby/object:Gem::Version
26
- version: '0.19'
40
+ version: '0.34'
27
41
  - !ruby/object:Gem::Dependency
28
- name: capybara
42
+ name: selenium-webdriver
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - ">="
@@ -39,13 +53,13 @@ dependencies:
39
53
  - !ruby/object:Gem::Version
40
54
  version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
- name: selenium-webdriver
56
+ name: bake
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - ">="
46
60
  - !ruby/object:Gem::Version
47
61
  version: '0'
48
- type: :runtime
62
+ type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
@@ -53,47 +67,61 @@ dependencies:
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
- name: chromedriver-helper
70
+ name: bake-bundler
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - "~>"
73
+ - - ">="
60
74
  - !ruby/object:Gem::Version
61
- version: '1.0'
75
+ version: '0'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - "~>"
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: bake-modernize
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
67
95
  - !ruby/object:Gem::Version
68
- version: '1.0'
96
+ version: '0'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: bundler
71
99
  requirement: !ruby/object:Gem::Requirement
72
100
  requirements:
73
- - - "~>"
101
+ - - ">="
74
102
  - !ruby/object:Gem::Version
75
- version: '1.15'
103
+ version: '0'
76
104
  type: :development
77
105
  prerelease: false
78
106
  version_requirements: !ruby/object:Gem::Requirement
79
107
  requirements:
80
- - - "~>"
108
+ - - ">="
81
109
  - !ruby/object:Gem::Version
82
- version: '1.15'
110
+ version: '0'
83
111
  - !ruby/object:Gem::Dependency
84
- name: rake
112
+ name: covered
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
- - - "~>"
115
+ - - ">="
88
116
  - !ruby/object:Gem::Version
89
- version: '10.0'
117
+ version: '0'
90
118
  type: :development
91
119
  prerelease: false
92
120
  version_requirements: !ruby/object:Gem::Requirement
93
121
  requirements:
94
- - - "~>"
122
+ - - ">="
95
123
  - !ruby/object:Gem::Version
96
- version: '10.0'
124
+ version: '0'
97
125
  - !ruby/object:Gem::Dependency
98
126
  name: rspec
99
127
  requirement: !ruby/object:Gem::Requirement
@@ -108,26 +136,34 @@ dependencies:
108
136
  - - "~>"
109
137
  - !ruby/object:Gem::Version
110
138
  version: '3.0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: webdrivers
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '4.0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '4.0'
111
153
  description:
112
- email:
113
- - samuel.williams@oriontransfer.co.nz
154
+ email:
114
155
  executables: []
115
156
  extensions: []
116
157
  extra_rdoc_files: []
117
158
  files:
118
- - ".editorconfig"
119
- - ".gitignore"
120
- - ".rspec"
121
- - ".travis.yml"
122
- - Gemfile
123
- - README.md
124
- - Rakefile
125
- - falcon-capybara.gemspec
126
159
  - lib/falcon/capybara.rb
160
+ - lib/falcon/capybara/drivers.rb
161
+ - lib/falcon/capybara/servers.rb
127
162
  - lib/falcon/capybara/version.rb
128
163
  - lib/falcon/capybara/wrapper.rb
129
164
  homepage: https://github.com/socketry/falcon-capybara
130
- licenses: []
165
+ licenses:
166
+ - MIT
131
167
  metadata: {}
132
168
  post_install_message:
133
169
  rdoc_options: []
@@ -137,14 +173,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
137
173
  requirements:
138
174
  - - ">="
139
175
  - !ruby/object:Gem::Version
140
- version: '0'
176
+ version: '2.5'
141
177
  required_rubygems_version: !ruby/object:Gem::Requirement
142
178
  requirements:
143
179
  - - ">="
144
180
  - !ruby/object:Gem::Version
145
181
  version: '0'
146
182
  requirements: []
147
- rubygems_version: 3.0.1
183
+ rubygems_version: 3.1.2
148
184
  signing_key:
149
185
  specification_version: 4
150
186
  summary: Use the falcon web server to run capybara/selenium tests.
@@ -1,6 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- indent_style = tab
5
- indent_size = 2
6
-
data/.gitignore DELETED
@@ -1,12 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
-
11
- # rspec failure tracking
12
- .rspec_status
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --warnings
3
- --require spec_helper
@@ -1,29 +0,0 @@
1
- language: ruby
2
- sudo: false
3
- dist: trusty
4
- cache: bundler
5
-
6
- addons:
7
- apt:
8
- sources:
9
- - google-chrome
10
- packages:
11
- - google-chrome-stable
12
-
13
- before_script:
14
- - gem update --system
15
- - gem install bundler
16
-
17
- rvm:
18
- - 2.3
19
- - 2.4
20
- - 2.5
21
- - 2.6
22
- - jruby-head
23
- - ruby-head
24
- - rbx-3
25
- matrix:
26
- allow_failures:
27
- - rvm: ruby-head
28
- - rvm: jruby-head
29
- - rvm: rbx-3
data/Gemfile DELETED
@@ -1,10 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
- # Specify your gem's dependencies in falcon-capybara.gemspec
6
- gemspec
7
-
8
- group :development do
9
- gem "pry"
10
- end
data/README.md DELETED
@@ -1,90 +0,0 @@
1
- # Falcon::Capybara
2
-
3
- Provides relevant [capybara] configuration to run tests using [falcon].
4
-
5
- [falcon]: https://github.com/socketry/falcon
6
- [capybara]: https://github.com/teamcapybara/capybara
7
-
8
- [![Build Status](https://secure.travis-ci.org/socketry/falcon-capybara.svg)](http://travis-ci.org/socketry/falcon-capybara)
9
- [![Code Climate](https://codeclimate.com/github/socketry/falcon-capybara.svg)](https://codeclimate.com/github/socketry/falcon-capybara)
10
- [![Coverage Status](https://coveralls.io/repos/socketry/falcon-capybara/badge.svg)](https://coveralls.io/r/socketry/falcon-capybara)
11
-
12
- ## Installation
13
-
14
- Add this line to your application's Gemfile:
15
-
16
- ```ruby
17
- gem 'falcon-capybara'
18
- ```
19
-
20
- And then execute:
21
-
22
- $ bundle
23
-
24
- Or install it yourself as:
25
-
26
- $ gem install falcon-capybara
27
-
28
- ## Usage
29
-
30
- ### RSpec
31
-
32
- In your `spec_helper.rb` add the following:
33
-
34
- ```ruby
35
- require "falcon/capybara"
36
-
37
- require "capybara/rspec"
38
- Capybara.configure do |config|
39
- config.server = :falcon
40
-
41
- # config.app = ...
42
- end
43
- ```
44
-
45
- ### Selenium
46
-
47
- Optionally, you might want to set up selenium:
48
-
49
- ```ruby
50
- require "selenium/webdriver"
51
- Capybara.javascript_driver = :selenium_chrome_headless
52
- ```
53
-
54
- To use chromedriver add the following to your gemfile:
55
-
56
- ```ruby
57
- gem "chromedriver-helper"
58
- ```
59
-
60
- ## Contributing
61
-
62
- 1. Fork it
63
- 2. Create your feature branch (`git checkout -b my-new-feature`)
64
- 3. Commit your changes (`git commit -am 'Add some feature'`)
65
- 4. Push to the branch (`git push origin my-new-feature`)
66
- 5. Create new Pull Request
67
-
68
- ## License
69
-
70
- Released under the MIT license.
71
-
72
- Copyright, 2017, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
73
-
74
- Permission is hereby granted, free of charge, to any person obtaining a copy
75
- of this software and associated documentation files (the "Software"), to deal
76
- in the Software without restriction, including without limitation the rights
77
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
78
- copies of the Software, and to permit persons to whom the Software is
79
- furnished to do so, subject to the following conditions:
80
-
81
- The above copyright notice and this permission notice shall be included in
82
- all copies or substantial portions of the Software.
83
-
84
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
85
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
86
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
87
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
88
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
89
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
90
- THE SOFTWARE.
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
@@ -1,28 +0,0 @@
1
-
2
- require_relative "lib/falcon/capybara/version"
3
-
4
- Gem::Specification.new do |spec|
5
- spec.name = "falcon-capybara"
6
- spec.version = Falcon::Capybara::VERSION
7
- spec.authors = ["Samuel Williams"]
8
- spec.email = ["samuel.williams@oriontransfer.co.nz"]
9
-
10
- spec.summary = "Use the falcon web server to run capybara/selenium tests."
11
- spec.homepage = "https://github.com/socketry/falcon-capybara"
12
-
13
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
14
- f.match(%r{^(test|spec|features)/})
15
- end
16
-
17
- spec.require_paths = ["lib"]
18
-
19
- spec.add_dependency "falcon", "~> 0.19"
20
- spec.add_dependency "capybara"
21
- spec.add_dependency "selenium-webdriver"
22
-
23
- spec.add_development_dependency "chromedriver-helper", "~> 1.0"
24
-
25
- spec.add_development_dependency "bundler", "~> 1.15"
26
- spec.add_development_dependency "rake", "~> 10.0"
27
- spec.add_development_dependency "rspec", "~> 3.0"
28
- end