falcon-capybara 1.0.0 → 1.1.0

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
- SHA1:
3
- metadata.gz: f13782d8b3ab7182209b65b6545fc3ad8a1c4acd
4
- data.tar.gz: 247c771c625fc5590b878c39bbe3f4b0484f5faa
2
+ SHA256:
3
+ metadata.gz: f4162ab989c210b1cec6c9da885de4d750028b4e4136d07141f1722497c14f39
4
+ data.tar.gz: 85b2701c5a7b97b570d68cc90a7822da77e5efa490d4da86583c231dd0f96cc0
5
5
  SHA512:
6
- metadata.gz: 650fbbb92b42056029fe130b509ee1a1cd698e1ebd16418c2978b95b67067f54e0123985877e38d3b4f27cf8d8eac4f74882c51e2d74fc2f94396f8c5768ca6b
7
- data.tar.gz: 445cde6699a18be68f5f876dded9365c08c06a8b1092bda229ed376ba7e96291dabc591cad3ff943cb500956c551442b76b2b28a6cd76dde9d107aff0dea49ee
6
+ metadata.gz: 50dc210923c0df355de145e0905765784c20c597dd8889261c99df7222b7981dcf781be66cb4583074b3b476d04bd5425cdbf797154e899c289889a38e3f3c9f
7
+ data.tar.gz: 017cf0912a7634f9fda1e8a372d32cc0c737489a19bb10d6b429250e006b460c418e9dbbd62db7672c0a986fce9f576c97996511ee5264e106f208a8f4d40f8c
@@ -2,6 +2,10 @@ language: ruby
2
2
  sudo: false
3
3
  dist: trusty
4
4
  cache: bundler
5
+ addons:
6
+ apt:
7
+ packages:
8
+ - google-chrome-stable
5
9
  rvm:
6
10
  - 2.0
7
11
  - 2.1
data/Gemfile CHANGED
@@ -4,3 +4,7 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in falcon-capybara.gemspec
6
6
  gemspec
7
+
8
+ group :development do
9
+ gem "pry"
10
+ end
data/README.md CHANGED
@@ -32,7 +32,7 @@ Or install it yourself as:
32
32
  In your `spec_helper.rb` add the following:
33
33
 
34
34
  ```ruby
35
- require 'falcon-capybara'
35
+ require "falcon/capybara"
36
36
 
37
37
  require "capybara/rspec"
38
38
  Capybara.configure do |config|
@@ -42,6 +42,8 @@ Capybara.configure do |config|
42
42
  end
43
43
  ```
44
44
 
45
+ ### Selenium
46
+
45
47
  Optionally, you might want to set up selenium:
46
48
 
47
49
  ```ruby
@@ -49,6 +51,12 @@ require "selenium/webdriver"
49
51
  Capybara.javascript_driver = :selenium_chrome_headless
50
52
  ```
51
53
 
54
+ To use chromedriver add the following to your gemfile:
55
+
56
+ ```ruby
57
+ gem "chromedriver-helper"
58
+ ```
59
+
52
60
  ## Contributing
53
61
 
54
62
  1. Fork it
@@ -18,10 +18,12 @@ Gem::Specification.new do |spec|
18
18
 
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "falcon"
21
+ spec.add_dependency "falcon", "~> 0.9"
22
22
  spec.add_dependency "capybara"
23
23
  spec.add_dependency "selenium-webdriver"
24
24
 
25
+ spec.add_development_dependency "chromedriver-helper"
26
+
25
27
  spec.add_development_dependency "bundler", "~> 1.15"
26
28
  spec.add_development_dependency "rake", "~> 10.0"
27
29
  spec.add_development_dependency "rspec", "~> 3.0"
@@ -21,14 +21,6 @@
21
21
  require 'capybara'
22
22
 
23
23
  require_relative "capybara/version"
24
+ require_relative "capybara/wrapper"
24
25
 
25
- Capybara.register_server :falcon do |app, port, host|
26
- require 'async/reactor'
27
- require 'falcon/server'
28
-
29
- Async::Reactor.run do
30
- server = Falcon::Server.new(app, [Async::IO::Endpoint.tcp(host, port)])
31
-
32
- server.run
33
- end
34
- end
26
+ Capybara.servers[:falcon] = Falcon::Capybara::Wrapper.new
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Falcon
22
22
  module Capybara
23
- VERSION = "1.0.0"
23
+ VERSION = "1.1.0"
24
24
  end
25
25
  end
@@ -0,0 +1,75 @@
1
+ # Copyright, 2017, 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 'thread'
22
+
23
+ require 'async/condition'
24
+ require 'async/io/notification'
25
+
26
+ module Falcon
27
+ module Capybara
28
+ 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
39
+ end
40
+
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 until @job.nil?
48
+ end.wait
49
+ end
50
+
51
+ def call(app, port, host)
52
+ require 'async/reactor'
53
+ require 'falcon/server'
54
+
55
+ Async::Reactor.run do |task|
56
+ server = Falcon::Server.new(app, Async::IO::Endpoint.tcp(host, port))
57
+
58
+ task.async do
59
+ Async.logger.debug (self) {"Running server..."}
60
+ server.run
61
+ end
62
+
63
+ while true
64
+ Async.logger.debug (self) {"Waiting for job..."}
65
+ @job_available.wait while @job.nil?
66
+
67
+ Async.logger.debug (self) {"Running job #{@job}"}
68
+ @job.call
69
+ @job = nil
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
metadata CHANGED
@@ -1,17 +1,31 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: falcon-capybara
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.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: 2017-08-15 00:00:00.000000000 Z
11
+ date: 2018-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: falcon
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.9'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: capybara
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - ">="
@@ -25,7 +39,7 @@ dependencies:
25
39
  - !ruby/object:Gem::Version
26
40
  version: '0'
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: chromedriver-helper
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:
@@ -110,6 +124,7 @@ files:
110
124
  - falcon-capybara.gemspec
111
125
  - lib/falcon/capybara.rb
112
126
  - lib/falcon/capybara/version.rb
127
+ - lib/falcon/capybara/wrapper.rb
113
128
  homepage: https://github.com/socketry/falcon-capybara
114
129
  licenses: []
115
130
  metadata: {}
@@ -129,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
144
  version: '0'
130
145
  requirements: []
131
146
  rubyforge_project:
132
- rubygems_version: 2.6.12
147
+ rubygems_version: 2.7.6
133
148
  signing_key:
134
149
  specification_version: 4
135
150
  summary: ''