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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0f55bdccf28c4b1f8550418fec4c53e68bf4462
4
- data.tar.gz: c81fd723defa93cf29bcd6160b0cde91cf0491c4
3
+ metadata.gz: 2c688ef83410f30dc9e25254d43f69a64ac91800
4
+ data.tar.gz: edf44d55e56d2d2b146e42a4a1e971bd94e34f92
5
5
  SHA512:
6
- metadata.gz: 9f1f9c8ae16e732ebdb6002bd0ab41afe1a5e65eea2c7b09eb05b7a0f30b6ec0d51f550bbff1996c2b04a9758fac80a2262617e42cda479296f316e2474b9ad8
7
- data.tar.gz: e377410f6e398bf4098eeb25562b99c6405ceeb8c6427875fbf4919ff2e8357d72c5916fee8ced00b0b0da24e6a58d426997fa19ad4ebc7412ece03a85166283
6
+ metadata.gz: 59d06ca182ed05759cac708bf4c320b5df020cb10018b56f68751e0a719b0490b8c0219eb6f069dfd3db3a6faaa50b8aa54edbb73f279815ddd82fd9d03efa32
7
+ data.tar.gz: 0dfd6f925864f1add5905ee34ff1fa6ff9fe4012e6a1d13e80814e87b9c840f161ce6224ab96d03ea52dc3d5ef0c641fe4871d16f7d9138ffdc723807677ef1f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Infrataster Changelog
2
2
 
3
+ ## v0.1.2
4
+
5
+ * Use poltergeist (PhantomJS) as capybara driver instead of selenium-webdriver.
6
+
3
7
  ## v0.1.1
4
8
 
5
9
  * Http resources accept `method`, `params` and `headers` options. (Issue #7)
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 "selenium-webdriver"
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 'selenium-webdriver'
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::Selenium::Driver.new(app, profile: profile)
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
 
@@ -60,16 +60,21 @@ module Infrataster
60
60
  finalize_proc.call
61
61
  end
62
62
 
63
- def gateway_open(*args)
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(*args) do |port|
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(*args)
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
@@ -1,3 +1,3 @@
1
1
  module Infrataster
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -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.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: selenium-webdriver
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