capybara_spa 0.5.0 → 0.6.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
2
  SHA256:
3
- metadata.gz: ad8de84ee5fc55314261a0b31adb83704dd6221e9cf6926d652461797e2d3b31
4
- data.tar.gz: 4a106b49fdebcca51da9634d19f1f3e2bb4387ee9f54c6dfce3baa9b6f95cee7
3
+ metadata.gz: 51d25cae7ab75d66e5440b5c030015abc9d1ecdd87e97fbe75cef68831f281a5
4
+ data.tar.gz: 9c0a896822259b9179b27118a07483156d5e4f185ced4292f5fbac99427bc5bb
5
5
  SHA512:
6
- metadata.gz: 8606efd9d87995891b81a5c9f5205baf045a5824cc5596ff2c2cf34a43ccc15ba4e6dd27d09e6cbf6955a762777804d8454ccc33ad5a8dcb3937f4d284c7413c
7
- data.tar.gz: da0d24d2c6604fb062ba9a315d2cd820c3ae45146b714e2af6fb8a43de86833f603135fa2b5c2c2e0b13d4d30398f75a0382ca8d52972923e08bc3447860fe13
6
+ metadata.gz: e6c33f624ba50bbd390392e8964b7091ee920142bef13eebb8cdea8d9ebbc64b16c480fab1337c184c216f537ca52547d87a59523bbd22103e332841721fab3e
7
+ data.tar.gz: a87ee063812891af220e8a7888838ce20852f04e4833ccf731ba9dd09d5cf258e08f68843f2674e91a6500a5ef7ab3275d094c9bf1908bdeb36ccdaf7ff76197
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capybara_spa (0.5.0)
4
+ capybara_spa (0.6.0)
5
5
  capybara (~> 3.0)
6
6
 
7
7
  GEM
@@ -13,7 +13,7 @@ GEM
13
13
  io-like (~> 0.3.0)
14
14
  bump (0.6.0)
15
15
  byebug (10.0.2)
16
- capybara (3.5.0)
16
+ capybara (3.8.1)
17
17
  addressable
18
18
  mini_mime (>= 0.1.3)
19
19
  nokogiri (~> 1.8)
@@ -32,7 +32,7 @@ GEM
32
32
  io-like (0.3.0)
33
33
  json (2.1.0)
34
34
  method_source (0.9.0)
35
- mini_mime (1.0.0)
35
+ mini_mime (1.0.1)
36
36
  mini_portile2 (2.3.0)
37
37
  nokogiri (1.8.2)
38
38
  mini_portile2 (~> 2.3.0)
@@ -42,7 +42,7 @@ GEM
42
42
  pry-byebug (3.6.0)
43
43
  byebug (~> 10.0)
44
44
  pry (~> 0.10)
45
- public_suffix (3.0.2)
45
+ public_suffix (3.0.3)
46
46
  rack (2.0.5)
47
47
  rack-test (1.1.0)
48
48
  rack (>= 1.0, < 3)
@@ -7,6 +7,10 @@ module CapybaraSpa
7
7
  # +log_file+ where to log the output of angular-http-server. Defaults to /dev/null \
8
8
  # This can be set thru the SPA_LOG_FILE environment variable.
9
9
  attr_accessor :log_file
10
+
11
+ # +single_page_app_found+ stores whether or not the single page app has been found. \
12
+ # It will be a falsy value if not found and true when found.
13
+ attr_accessor :single_page_app_found
10
14
  end
11
15
 
12
16
  self.app_tag = ENV.fetch('SPA_APP_TAG', 'app-root')
@@ -3,31 +3,36 @@ require 'capybara/dsl'
3
3
  module Capybara
4
4
  module DSL
5
5
  def page
6
- wait_until_angular_app_is_found unless @ignoring_angular
6
+ wait_until_single_page_app_is_found unless @ignoring_single_page_app
7
7
  Capybara.current_session
8
8
  end
9
9
 
10
- def wait_until_angular_app_is_found
11
- return if @angular_app_found
10
+ def wait_until_single_page_app_is_found
11
+ return if CapybaraSpa.single_page_app_found
12
12
 
13
- @angular_app_found = false
13
+ single_page_app_found = false
14
14
 
15
15
  loop do
16
16
  Capybara.current_session.visit('/')
17
17
  app_tag = CapybaraSpa.app_tag
18
- @angular_app_found = Capybara.current_session.evaluate_script <<-JAVASCRIPT
18
+ single_page_app_found = Capybara.current_session.evaluate_script <<-JAVASCRIPT
19
19
  document.getElementsByTagName('#{app_tag}').length === 1
20
20
  JAVASCRIPT
21
- break if @angular_app_found
21
+ CapybaraSpa.single_page_app_found = single_page_app_found
22
+ break if CapybaraSpa.single_page_app_found
22
23
  sleep 0.25
23
24
  end
24
25
  end
25
26
 
26
- def ignoring_angular
27
- @ignoring_angular = true
27
+ def ignoring_angular(&block)
28
+ ignoring_single_page_app(&block)
29
+ end
30
+
31
+ def ignoring_single_page_app(&block)
32
+ @ignoring_single_page_app = true
28
33
  yield
29
34
  ensure
30
- @ignoring_angular = false
35
+ @ignoring_single_page_app = false
31
36
  end
32
37
  end
33
38
  end
@@ -1,3 +1,3 @@
1
1
  module CapybaraSpa
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara_spa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Dennis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-02 00:00:00.000000000 Z
11
+ date: 2018-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara