capybara-webmock 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -3
- data/lib/capybara/webmock/proxy.rb +4 -0
- data/lib/capybara/webmock/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f307a699eb166e3af9de147e1c3f41f84432d716
|
4
|
+
data.tar.gz: 07be870d00b3cf1f23059ad1d83b10cf69b7c4a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01c5c747cabdcfd4a466f62fa5cc6a55fe6400f5d8080be159605c77fa94e938483cb21470b2908a92ff00168a8dc56712cd7d5104f4102b687df19068931184
|
7
|
+
data.tar.gz: 67fd10ece7d4bd9f864676d199c111fea988a8c33502232ecd63585d03fc4584ac1fc320d6e5e912450e0bdcb1f8183d99ee851c0f3ee77b9a117a4e6d6d88d2
|
data/README.md
CHANGED
@@ -1,11 +1,25 @@
|
|
1
1
|
[![CircleCI](https://circleci.com/gh/hashrocket/capybara-webmock.svg?style=svg)](https://circleci.com/gh/hashrocket/capybara-webmock)
|
2
|
+
[![Version](https://img.shields.io/gem/v/capybara-webmock.svg?style=flat)](https://rubygems.org/gems/capybara-webmock)
|
2
3
|
|
3
4
|
# Capybara::Webmock
|
4
5
|
|
5
|
-
|
6
|
+
Browser integration tests are expensive. We can mock external requests in our
|
7
|
+
tests, but once a browser is involved, we lose control.
|
8
|
+
|
9
|
+
External JavaScript libraries, CDN's, images, analytics, and more can slow an
|
10
|
+
integration test suite to a crawl.
|
11
|
+
|
12
|
+
`Capybara::Webmock` is a Rack proxy server that sits between your Ruby on Rails
|
13
|
+
Selenium Firefox test suite and the Internet, blocking external requests.
|
14
|
+
|
15
|
+
Adding this gem to your project can significantly speed up the test suite. No
|
16
|
+
more waiting on irrelevant external requests.
|
17
|
+
|
18
|
+
`localhost` and `lvh.me` are the only whitelisted domains. Custom domain
|
19
|
+
support is a planned feature.
|
6
20
|
|
7
21
|
This gem currently supports Ruby on Rails applications with an RSpec test
|
8
|
-
suite.
|
22
|
+
suite, using the Selenium Firefox driver. ChromeDriver support is in the works.
|
9
23
|
|
10
24
|
### Installation
|
11
25
|
|
@@ -86,7 +100,7 @@ License](http://opensource.org/licenses/MIT).
|
|
86
100
|
|
87
101
|
[![Hashrocket logo](https://hashrocket.com/hashrocket_logo.svg)](https://hashrocket.com)
|
88
102
|
|
89
|
-
Capybara::Webmock is supported by the team at [Hashrocket, a multidisciplinary
|
103
|
+
`Capybara::Webmock` is supported by the team at [Hashrocket, a multidisciplinary
|
90
104
|
design and development consultancy](https://hashrocket.com). If you'd like to
|
91
105
|
[work with us](https://hashrocket.com/contact-us/hire-us) or [join our
|
92
106
|
team](https://hashrocket.com/contact-us/jobs), don't hesitate to get in touch.
|
@@ -24,6 +24,10 @@ class Capybara::Webmock::Proxy < Rack::Proxy
|
|
24
24
|
private
|
25
25
|
|
26
26
|
def write_pid(pid)
|
27
|
+
tmp_dir = 'tmp'
|
28
|
+
pid_dir = File.join(tmp_dir, 'pids')
|
29
|
+
Dir.mkdir(tmp_dir) unless Dir.exist?(tmp_dir)
|
30
|
+
Dir.mkdir(pid_dir) unless Dir.exist?(pid_dir)
|
27
31
|
File.write(PID_FILE, pid)
|
28
32
|
end
|
29
33
|
end
|