falcon-capybara 1.3.5 → 1.5.1

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: 326885aae5976709743d18092eb9d41c5f54761f1f9b161f13eea51d18adda06
4
- data.tar.gz: 6265be09a60b79c14da84e069bcd65c26464266e8edac69aa815f41d240ef9b0
3
+ metadata.gz: 7604a673fc003f4e61fc30c56e845e163effe994f9421267698a09dc92d20b11
4
+ data.tar.gz: 93572ee467f7ca925ce26395b014f5edda2c0843d610e9a6c136da18cb0ee60c
5
5
  SHA512:
6
- metadata.gz: 49166cbc500180c3de175c646cf1c5dc87826ef1908d2ae0fcf80c25d042a48a1fc359d3457c760cf4bdbd640e6df55916658b55651f986a82f642632a7aa090
7
- data.tar.gz: da7981b7bae8ae9576929341d1277d7a30268c1f70d2a1ff227f58ce9707dcaed54c13770e5084b8e38a9e626719f3ea0aef2181b754d8a59af4d02b5efe4872
6
+ metadata.gz: 4dc038cebaacdaae7f302697eb4e0b00425854408ecbe829498b6863a3982570cf968a35f4e581501824f534d0a4582b9623571d9294f2b927a61c6436f5aada
7
+ data.tar.gz: e6a62217108aaff74eb4e54e85057e9674395f140338e69167451cfd8292661096239465ad7524af5c7dbfa828ac36d138838bc3a77868e067fb95808cd092a5
@@ -21,6 +21,6 @@
21
21
  require 'capybara'
22
22
 
23
23
  require_relative "capybara/version"
24
- require_relative "capybara/wrapper"
25
24
 
26
- Capybara.servers[:falcon] = Falcon::Capybara::Wrapper.new
25
+ require_relative "capybara/servers"
26
+ require_relative "capybara/drivers"
@@ -0,0 +1,16 @@
1
+ # Falcon::Capybara::Drivers
2
+
3
+ Provides Capybara driver definitions for using Chrome with self-signed HTTPS via localhost **only**.
4
+
5
+ ## Usage
6
+
7
+ In your Capybara configuration, you'd typically select one of the named server configurations:
8
+
9
+ ~~~ ruby
10
+ Capybara.configure do |config|
11
+ config.javascript_driver = :selenium_chrome_https
12
+
13
+ # Or for headless:
14
+ config.javascript_driver = :selenium_chrome_headless_https
15
+ end
16
+ ~~~
@@ -0,0 +1,45 @@
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
+ # A selenium driver for chrome which allows insecure localhost https protocol.
24
+ # @scope Falcon Capybara Drivers
25
+ # @name selenium_chrome_https
26
+ # @attribute [Block]
27
+ Capybara.register_driver :selenium_chrome_https do |app|
28
+ require 'selenium/webdriver'
29
+
30
+ Capybara.drivers[:selenium_chrome].call(app).tap do |driver|
31
+ driver.options[:options].args << '--allow-insecure-localhost'
32
+ end
33
+ end
34
+
35
+ # A headless selenium driver for chrome which allows insecure localhost https protocol.
36
+ # @scope Falcon Capybara Drivers
37
+ # @name selenium_chrome_headless_https
38
+ # @attribute [Block]
39
+ Capybara.register_driver :selenium_chrome_headless_https do |app|
40
+ require 'selenium/webdriver'
41
+
42
+ Capybara.drivers[:selenium_chrome_headless].call(app).tap do |driver|
43
+ driver.options[:options].args << '--allow-insecure-localhost'
44
+ end
45
+ end
@@ -0,0 +1,13 @@
1
+ # Falcon::Capybara::Servers
2
+
3
+ Provides Capybara server definitions for using Falcon with Capybara integration & acceptance tests.
4
+
5
+ ## Usage
6
+
7
+ In your Capybara configuration, you'd typically select one of the named server configurations:
8
+
9
+ ~~~ ruby
10
+ Capybara.configure do |config|
11
+ config.server = :falcon_https
12
+ end
13
+ ~~~
@@ -0,0 +1,48 @@
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
+ # The default Falcon server wrapper which uses the `HTTP` scheme.
24
+ # @scope Falcon Capybara Servers
25
+ # @name falcon
26
+ # @attribute [Block]
27
+ Capybara.register_server(:falcon) do |*arguments|
28
+ require_relative 'wrapper'
29
+ Falcon::Capybara::Wrapper.new.call(*arguments)
30
+ end
31
+
32
+ # An explicit Falcon server wrapper which uses the `HTTP` scheme.
33
+ # @scope Falcon Capybara Servers
34
+ # @name falcon_http
35
+ # @attribute [Block]
36
+ Capybara.register_server(:falcon_http) do |*arguments|
37
+ require_relative 'wrapper'
38
+ Falcon::Capybara::Wrapper.new('http').call(*arguments)
39
+ end
40
+
41
+ # The default Falcon server wrapper which uses the `HTTPS` scheme.
42
+ # @scope Falcon Capybara Servers
43
+ # @name falcon_https
44
+ # @attribute [Block]
45
+ Capybara.register_server(:falcon_https) do |*arguments|
46
+ require_relative 'wrapper'
47
+ Falcon::Capybara::Wrapper.new('https').call(*arguments)
48
+ end
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Falcon
22
22
  module Capybara
23
- VERSION = "1.3.5"
23
+ VERSION = "1.5.1"
24
24
  end
25
25
  end
@@ -20,60 +20,46 @@
20
20
 
21
21
  require 'thread'
22
22
 
23
- require 'async/io/host_endpoint'
23
+ require 'async'
24
+ require 'falcon/endpoint'
24
25
  require 'async/io/notification'
25
26
 
26
27
  module Falcon
27
28
  module Capybara
29
+ # Implements a wrapper for starting the Falcon server for Capybara.
28
30
  class Wrapper
29
- def initialize
30
- @job = nil
31
-
32
- @job_available = Async::IO::Notification.new
33
- @job_complete = Async::IO::Notification.new
34
- end
35
-
36
- def close
37
- @job_available.close
38
- @job_complete.close
31
+ # @parameter scheme [String] The scheme for the server to bind to.
32
+ # e.g. `http` or `https`.
33
+ def initialize(scheme = "http")
34
+ @scheme = scheme
39
35
  end
40
36
 
41
- def remote(&block)
42
- @job = block
43
- @job_available.signal
44
-
45
- Async::Reactor.run do
46
- Async.logger.debug (self) {"Waiting for job completion..."}
47
- @job_complete.wait
48
- end.wait
37
+ # Build a server endpoint using the given scheme.
38
+ def endpoint(host, port)
39
+ Falcon::Endpoint.parse("#{@scheme}://#{host}:#{port}")
49
40
  end
50
41
 
42
+ # Run the Falcon server hosting the given rack application.
43
+ # @parameter rack_app [Proc] A Rack application.
44
+ # @parameter port [Integer] The port number to bind to.
45
+ # @parameter host [String] The local host to bind to.
51
46
  def call(rack_app, port, host)
52
47
  require 'async/reactor'
53
48
  require 'falcon/server'
54
49
 
55
- Async::Reactor.run do |task|
50
+ Async do |task|
56
51
  app = Falcon::Server.middleware(rack_app)
57
52
 
58
- server = Falcon::Server.new(app,
59
- Async::IO::Endpoint.tcp(host, port)
60
- )
61
-
62
- task.async do
63
- Async.logger.debug (self) {"Running server..."}
64
- server.run
53
+ if host == "127.0.0.1"
54
+ host = "localhost"
65
55
  end
66
56
 
67
- while true
68
- Async.logger.debug (self) {"Waiting for job..."}
69
- @job_available.wait while @job.nil?
70
-
71
- Async.logger.debug (self) {"Running job #{@job}"}
72
- @job.call
73
- @job = nil
74
-
75
- @job_complete.signal
76
- end
57
+ endpoint = self.endpoint(host, port)
58
+
59
+ server = Falcon::Server.new(app, endpoint, protocol: endpoint.protocol, scheme: endpoint.scheme)
60
+
61
+ Async.logger.debug (self) {"Running server..."}
62
+ server.run
77
63
  end
78
64
  end
79
65
  end
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.5
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-07 00:00:00.000000000 Z
11
+ date: 2021-01-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.18.0
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.18.0
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,7 +67,7 @@ dependencies:
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
- name: chromedriver-helper
70
+ name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - ">="
@@ -67,68 +81,65 @@ dependencies:
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
- name: bundler
84
+ name: covered
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - "~>"
87
+ - - ">="
74
88
  - !ruby/object:Gem::Version
75
- version: '1.15'
89
+ version: '0'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - "~>"
94
+ - - ">="
81
95
  - !ruby/object:Gem::Version
82
- version: '1.15'
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
- name: rake
98
+ name: rspec
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: '10.0'
103
+ version: '3.0'
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: '10.0'
110
+ version: '3.0'
97
111
  - !ruby/object:Gem::Dependency
98
- name: rspec
112
+ name: webdrivers
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - "~>"
102
116
  - !ruby/object:Gem::Version
103
- version: '3.0'
117
+ version: '4.0'
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
122
  - - "~>"
109
123
  - !ruby/object:Gem::Version
110
- version: '3.0'
111
- description:
124
+ version: '4.0'
125
+ description:
112
126
  email:
113
- - samuel.williams@oriontransfer.co.nz
114
127
  executables: []
115
128
  extensions: []
116
129
  extra_rdoc_files: []
117
130
  files:
118
- - ".gitignore"
119
- - ".rspec"
120
- - ".travis.yml"
121
- - Gemfile
122
- - README.md
123
- - Rakefile
124
- - falcon-capybara.gemspec
125
131
  - lib/falcon/capybara.rb
132
+ - lib/falcon/capybara/drivers.md
133
+ - lib/falcon/capybara/drivers.rb
134
+ - lib/falcon/capybara/servers.md
135
+ - lib/falcon/capybara/servers.rb
126
136
  - lib/falcon/capybara/version.rb
127
137
  - lib/falcon/capybara/wrapper.rb
128
138
  homepage: https://github.com/socketry/falcon-capybara
129
- licenses: []
139
+ licenses:
140
+ - MIT
130
141
  metadata: {}
131
- post_install_message:
142
+ post_install_message:
132
143
  rdoc_options: []
133
144
  require_paths:
134
145
  - lib
@@ -136,16 +147,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
136
147
  requirements:
137
148
  - - ">="
138
149
  - !ruby/object:Gem::Version
139
- version: '0'
150
+ version: '2.5'
140
151
  required_rubygems_version: !ruby/object:Gem::Requirement
141
152
  requirements:
142
153
  - - ">="
143
154
  - !ruby/object:Gem::Version
144
155
  version: '0'
145
156
  requirements: []
146
- rubyforge_project:
147
- rubygems_version: 2.7.6
148
- signing_key:
157
+ rubygems_version: 3.1.2
158
+ signing_key:
149
159
  specification_version: 4
150
160
  summary: Use the falcon web server to run capybara/selenium tests.
151
161
  test_files: []
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,30 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "falcon/capybara/version"
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "falcon-capybara"
8
- spec.version = Falcon::Capybara::VERSION
9
- spec.authors = ["Samuel Williams"]
10
- spec.email = ["samuel.williams@oriontransfer.co.nz"]
11
-
12
- spec.summary = "Use the falcon web server to run capybara/selenium tests."
13
- spec.homepage = "https://github.com/socketry/falcon-capybara"
14
-
15
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
- f.match(%r{^(test|spec|features)/})
17
- end
18
-
19
- spec.require_paths = ["lib"]
20
-
21
- spec.add_dependency "falcon", "~> 0.18.0"
22
- spec.add_dependency "capybara"
23
- spec.add_dependency "selenium-webdriver"
24
-
25
- spec.add_development_dependency "chromedriver-helper"
26
-
27
- spec.add_development_dependency "bundler", "~> 1.15"
28
- spec.add_development_dependency "rake", "~> 10.0"
29
- spec.add_development_dependency "rspec", "~> 3.0"
30
- end