infrataster 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/infrataster.gemspec +1 -1
- data/lib/infrataster/contexts/capybara_context.rb +5 -5
- data/lib/infrataster/server.rb +8 -3
- data/lib/infrataster/version.rb +1 -1
- data/spec/integration/capybara_spec.rb +26 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c688ef83410f30dc9e25254d43f69a64ac91800
|
4
|
+
data.tar.gz: edf44d55e56d2d2b146e42a4a1e971bd94e34f92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59d06ca182ed05759cac708bf4c320b5df020cb10018b56f68751e0a719b0490b8c0219eb6f069dfd3db3a6faaa50b8aa54edbb73f279815ddd82fd9d03efa32
|
7
|
+
data.tar.gz: 0dfd6f925864f1add5905ee34ff1fa6ff9fe4012e6a1d13e80814e87b9c840f161ce6224ab96d03ea52dc3d5ef0c641fe4871d16f7d9138ffdc723807677ef1f
|
data/CHANGELOG.md
CHANGED
data/infrataster.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_runtime_dependency "net-ssh-gateway"
|
25
25
|
spec.add_runtime_dependency "mysql2"
|
26
26
|
spec.add_runtime_dependency "capybara"
|
27
|
-
spec.add_runtime_dependency "
|
27
|
+
spec.add_runtime_dependency "poltergeist"
|
28
28
|
spec.add_runtime_dependency "browsermob-proxy"
|
29
29
|
spec.add_runtime_dependency "faraday"
|
30
30
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'capybara'
|
2
2
|
require 'capybara/rspec/matchers'
|
3
|
-
require '
|
3
|
+
require 'capybara/poltergeist'
|
4
4
|
|
5
5
|
module Infrataster
|
6
6
|
module Contexts
|
@@ -40,11 +40,11 @@ module Infrataster
|
|
40
40
|
proxy = BrowsermobProxy.server.create_proxy
|
41
41
|
proxy.header({"Host" => resource.uri.host})
|
42
42
|
|
43
|
-
profile = Selenium::WebDriver::Firefox::Profile.new
|
44
|
-
profile.proxy = proxy.selenium_proxy
|
45
|
-
|
46
43
|
Capybara.register_driver capybara_driver_name do |app|
|
47
|
-
Capybara::
|
44
|
+
Capybara::Poltergeist::Driver.new(
|
45
|
+
app,
|
46
|
+
phantomjs_options: ["--proxy=http://#{proxy.host}:#{proxy.port}"],
|
47
|
+
)
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
data/lib/infrataster/server.rb
CHANGED
@@ -60,16 +60,21 @@ module Infrataster
|
|
60
60
|
finalize_proc.call
|
61
61
|
end
|
62
62
|
|
63
|
-
def gateway_open(
|
63
|
+
def gateway_open(host, port)
|
64
|
+
# find available local port
|
65
|
+
server = TCPServer.new('127.0.0.1', 0)
|
66
|
+
local_port = server.addr[1]
|
67
|
+
server.close
|
68
|
+
|
64
69
|
if block_given?
|
65
70
|
with_ssh_gateway do |gateway|
|
66
|
-
gateway.open(
|
71
|
+
gateway.open(host, port, local_port) do |port|
|
67
72
|
yield port
|
68
73
|
end
|
69
74
|
end
|
70
75
|
else
|
71
76
|
gateway, gateway_finalize_proc = ssh_gateway
|
72
|
-
port = gateway.open(
|
77
|
+
port = gateway.open(host, port, local_port)
|
73
78
|
finalize_proc = Proc.new do
|
74
79
|
gateway.close(port)
|
75
80
|
gateway_finalize_proc.call
|
data/lib/infrataster/version.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'integration/spec_helper'
|
2
|
+
|
3
|
+
describe server(:proxy) do
|
4
|
+
describe capybara('http://app.example.com') do
|
5
|
+
it 'has content "app"' do
|
6
|
+
visit '/'
|
7
|
+
expect(page).to have_content('app')
|
8
|
+
end
|
9
|
+
end
|
10
|
+
describe capybara('http://static.example.com') do
|
11
|
+
it 'has content "static"' do
|
12
|
+
visit '/'
|
13
|
+
expect(page).to have_content('static')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe server(:app) do
|
19
|
+
describe capybara('http://app.example.com') do
|
20
|
+
it 'has content "app"' do
|
21
|
+
visit '/'
|
22
|
+
expect(page).to have_content('app')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infrataster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryota Arai
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: poltergeist
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -198,6 +198,7 @@ files:
|
|
198
198
|
- lib/infrataster/rspec.rb
|
199
199
|
- lib/infrataster/server.rb
|
200
200
|
- lib/infrataster/version.rb
|
201
|
+
- spec/integration/capybara_spec.rb
|
201
202
|
- spec/integration/http_spec.rb
|
202
203
|
- spec/integration/spec_helper.rb
|
203
204
|
- spec/integration/vm/.gitignore
|
@@ -239,6 +240,7 @@ signing_key:
|
|
239
240
|
specification_version: 4
|
240
241
|
summary: Infrastructure Behavior Testing Framework
|
241
242
|
test_files:
|
243
|
+
- spec/integration/capybara_spec.rb
|
242
244
|
- spec/integration/http_spec.rb
|
243
245
|
- spec/integration/spec_helper.rb
|
244
246
|
- spec/integration/vm/.gitignore
|