ngrok-rspec 1.0.2
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 +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +52 -0
- data/Rakefile +2 -0
- data/lib/ngrok/rspec.rb +37 -0
- data/lib/ngrok/rspec/version.rb +5 -0
- data/ngrok-rspec.gemspec +32 -0
- data/spec/ngrok-rspec/ngrok-rspec_spec.rb +24 -0
- data/spec/spec_helper.rb +38 -0
- metadata +183 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 90ea985afdffca83398ccd9e824f7adb40c8c41d
|
4
|
+
data.tar.gz: 65c1bae448bf21e72cb295617bcce93ac661e05a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5b8b855315b65eaac423cfe9d33bd4caafa1920264572fcda1c668dc6cff8a6c0a2c47f184a523e607911d8366716e8bffe6129d8c359029bde40d693635400b
|
7
|
+
data.tar.gz: b11e867fd0f3dc1a8cdc2edbc3b51e2521f4c3a240c351bcfdce3745f119ac1c9b18d9d3fa763a7d8a8c8fd1f46d4c92260e66d501a24f2914520219e32d6efc
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Anton Bogdanovich
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# Ngrok::Rspec
|
2
|
+
|
3
|
+
Ngrok-rspec gem allows you to run capybara specs through ngrok.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
group :test do
|
11
|
+
gem 'ngrok-rspec'
|
12
|
+
end
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install ngrok-rspec
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
Configure rspec
|
26
|
+
```ruby
|
27
|
+
RSpec.configure do |config|
|
28
|
+
|
29
|
+
Capybara.server_port = 3001 # any port can be used
|
30
|
+
config.include Ngrok::Rspec
|
31
|
+
end
|
32
|
+
```
|
33
|
+
|
34
|
+
Write specs using filter ngrok: true
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
context "Using ngrok", ngrok: true do
|
38
|
+
it "should process paypal payment" do
|
39
|
+
# test your sanbox paypal payment for example
|
40
|
+
end
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
## Contributing
|
47
|
+
|
48
|
+
1. Fork it ( https://github.com/[my-github-username]/ngrok-rspec/fork )
|
49
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
50
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
51
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
52
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/lib/ngrok/rspec.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
require "ngrok/rspec/version"
|
2
|
+
require "ngrok/tunnel"
|
3
|
+
|
4
|
+
module Ngrok
|
5
|
+
|
6
|
+
class UnknownServerPort < StandardError; end
|
7
|
+
|
8
|
+
module Rspec
|
9
|
+
class << self; attr_accessor :original_app_host; end
|
10
|
+
|
11
|
+
def self.included(base)
|
12
|
+
|
13
|
+
Ngrok::Rspec.original_app_host = Capybara.app_host
|
14
|
+
|
15
|
+
::RSpec.configure do |config|
|
16
|
+
|
17
|
+
config.around(:each, ngrok: true) do |example|
|
18
|
+
raise UnknownServerPort, "Define Capybara.server_port in RSpec.config" unless Capybara.server_port
|
19
|
+
Ngrok::Tunnel.start(Capybara.server_port) unless Ngrok::Tunnel.running?
|
20
|
+
|
21
|
+
Capybara.app_host = Ngrok::Tunnel.ngrok_url
|
22
|
+
|
23
|
+
example.run
|
24
|
+
|
25
|
+
Capybara.app_host = Ngrok::Rspec::original_app_host
|
26
|
+
end
|
27
|
+
|
28
|
+
config.after(:suite) do
|
29
|
+
Ngrok::Tunnel.stop if Ngrok::Tunnel.running?
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
data/ngrok-rspec.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ngrok/rspec/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "ngrok-rspec"
|
8
|
+
spec.version = Ngrok::Rspec::VERSION
|
9
|
+
spec.authors = ["Anton Bogdanovich"]
|
10
|
+
spec.email = ["27bogdanovich@gmail.com"]
|
11
|
+
spec.summary = %q{Ngrok-rspec gem - run capybara specs with ngrok tunnel}
|
12
|
+
spec.description = %q{Ngrok-rspec gem provides ability to run capybara specs with ngrok tunnel}
|
13
|
+
spec.homepage = "https://github.com/bogdanovich/ngrok-rspec"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "ngrok-tunnel", "~> 1.0"
|
22
|
+
spec.add_dependency "rspec", "~> 3.1"
|
23
|
+
spec.add_dependency "capybara", "~> 2.4"
|
24
|
+
|
25
|
+
spec.add_development_dependency "pry", "~> 0.10"
|
26
|
+
spec.add_development_dependency "pry-byebug", "~> 2.0"
|
27
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
28
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
29
|
+
spec.add_development_dependency "poltergeist", "~> 1.5"
|
30
|
+
spec.add_development_dependency "selenium-webdriver", "~> 2.43"
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Ngrok::Rspec do
|
4
|
+
|
5
|
+
context "without ngrok" do
|
6
|
+
it "should have default app_host" do
|
7
|
+
app_host = Capybara.app_host
|
8
|
+
expect(app_host).to be_nil
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
context "with ngrok", ngrok: true do
|
13
|
+
it "should have ngrok app_host" do
|
14
|
+
expect(Capybara.app_host =~ /ngrok.com$/).to_not be_nil
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context "after ngrok" do
|
19
|
+
it "should have default app host" do
|
20
|
+
expect(Capybara.app_host =~ /ngrok.com$/).to be_nil
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'pry'
|
2
|
+
require 'capybara/rspec'
|
3
|
+
require 'capybara/poltergeist'
|
4
|
+
require 'ngrok/tunnel'
|
5
|
+
require 'ngrok/rspec'
|
6
|
+
|
7
|
+
|
8
|
+
RSpec.configure do |config|
|
9
|
+
config.expect_with :rspec do |expectations|
|
10
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
11
|
+
end
|
12
|
+
|
13
|
+
config.mock_with :rspec do |mocks|
|
14
|
+
mocks.verify_partial_doubles = true
|
15
|
+
end
|
16
|
+
|
17
|
+
config.include Capybara::DSL
|
18
|
+
|
19
|
+
Capybara.server_port = 3001
|
20
|
+
config.include Ngrok::Rspec
|
21
|
+
|
22
|
+
Capybara.register_driver :poltergeist do |app|
|
23
|
+
Capybara::Poltergeist::Driver.new(app,
|
24
|
+
:phantomjs_options => ['--debug=no', '--load-images=no', '--ignore-ssl-errors=yes', '--ssl-protocol=any'], :debug => false)
|
25
|
+
end
|
26
|
+
|
27
|
+
NGROK_SPEC_DEBUG = ENV['NGROK_SPEC_DEBUG'] || false
|
28
|
+
if NGROK_SPEC_DEBUG
|
29
|
+
Capybara.default_driver = :selenium
|
30
|
+
else
|
31
|
+
Capybara.default_driver = :selenium #:poltergeist
|
32
|
+
Capybara.javascript_driver = :selenium #:poltergeist
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,183 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ngrok-rspec
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Anton Bogdanovich
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ngrok-tunnel
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: capybara
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.4'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.4'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.10'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.10'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry-byebug
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: bundler
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.7'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.7'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '10.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '10.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: poltergeist
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.5'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.5'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: selenium-webdriver
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '2.43'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '2.43'
|
139
|
+
description: Ngrok-rspec gem provides ability to run capybara specs with ngrok tunnel
|
140
|
+
email:
|
141
|
+
- 27bogdanovich@gmail.com
|
142
|
+
executables: []
|
143
|
+
extensions: []
|
144
|
+
extra_rdoc_files: []
|
145
|
+
files:
|
146
|
+
- ".gitignore"
|
147
|
+
- ".rspec"
|
148
|
+
- Gemfile
|
149
|
+
- LICENSE.txt
|
150
|
+
- README.md
|
151
|
+
- Rakefile
|
152
|
+
- lib/ngrok/rspec.rb
|
153
|
+
- lib/ngrok/rspec/version.rb
|
154
|
+
- ngrok-rspec.gemspec
|
155
|
+
- spec/ngrok-rspec/ngrok-rspec_spec.rb
|
156
|
+
- spec/spec_helper.rb
|
157
|
+
homepage: https://github.com/bogdanovich/ngrok-rspec
|
158
|
+
licenses:
|
159
|
+
- MIT
|
160
|
+
metadata: {}
|
161
|
+
post_install_message:
|
162
|
+
rdoc_options: []
|
163
|
+
require_paths:
|
164
|
+
- lib
|
165
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - ">="
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
170
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
175
|
+
requirements: []
|
176
|
+
rubyforge_project:
|
177
|
+
rubygems_version: 2.2.2
|
178
|
+
signing_key:
|
179
|
+
specification_version: 4
|
180
|
+
summary: Ngrok-rspec gem - run capybara specs with ngrok tunnel
|
181
|
+
test_files:
|
182
|
+
- spec/ngrok-rspec/ngrok-rspec_spec.rb
|
183
|
+
- spec/spec_helper.rb
|