puffing-billy 3.0.0 → 3.0.3

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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/lib/billy/browsers/capybara.rb +13 -9
  4. data/lib/billy/cache.rb +2 -0
  5. data/lib/billy/handlers/proxy_handler.rb +3 -3
  6. data/lib/billy/version.rb +1 -1
  7. metadata +10 -73
  8. data/.github/workflows/ci.yml +0 -27
  9. data/.gitignore +0 -6
  10. data/.rspec +0 -2
  11. data/Dockerfile +0 -14
  12. data/Gemfile +0 -4
  13. data/Guardfile +0 -23
  14. data/Rakefile +0 -11
  15. data/bin/proxy.rb +0 -3
  16. data/examples/README.md +0 -1
  17. data/examples/facebook_api.html +0 -59
  18. data/examples/intercept_request.html +0 -10
  19. data/examples/post_api.html +0 -16
  20. data/examples/preflight_request.html +0 -22
  21. data/examples/tumblr_api.html +0 -22
  22. data/examples/tumblr_api_https.html +0 -22
  23. data/log/.gitkeep +0 -0
  24. data/puffing-billy.gemspec +0 -41
  25. data/spec/features/examples/facebook_api_spec.rb +0 -23
  26. data/spec/features/examples/intercept_request_spec.rb +0 -31
  27. data/spec/features/examples/post_api_spec.rb +0 -15
  28. data/spec/features/examples/preflight_request_spec.rb +0 -29
  29. data/spec/features/examples/tumblr_api_spec.rb +0 -59
  30. data/spec/lib/billy/browsers/capybara_spec.rb +0 -28
  31. data/spec/lib/billy/cache_spec.rb +0 -158
  32. data/spec/lib/billy/handlers/cache_handler_spec.rb +0 -191
  33. data/spec/lib/billy/handlers/handler_spec.rb +0 -16
  34. data/spec/lib/billy/handlers/proxy_handler_spec.rb +0 -258
  35. data/spec/lib/billy/handlers/request_handler_spec.rb +0 -200
  36. data/spec/lib/billy/handlers/request_log_spec.rb +0 -74
  37. data/spec/lib/billy/handlers/stub_handler_spec.rb +0 -117
  38. data/spec/lib/billy/proxy_connection_spec.rb +0 -20
  39. data/spec/lib/billy/proxy_request_stub_spec.rb +0 -252
  40. data/spec/lib/billy/resource_utils_spec.rb +0 -55
  41. data/spec/lib/billy/ssl/authority_spec.rb +0 -84
  42. data/spec/lib/billy/ssl/certificate_chain_spec.rb +0 -39
  43. data/spec/lib/billy/ssl/certificate_spec.rb +0 -89
  44. data/spec/lib/billy/watir/watir_spec.rb +0 -18
  45. data/spec/lib/proxy_spec.rb +0 -431
  46. data/spec/spec_helper.rb +0 -52
  47. data/spec/support/test_server.rb +0 -79
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1955fb7348660b0f353200d6280598a526b86b78407165fb294faed839157eb5
4
- data.tar.gz: 06db7eee54aa9cb21b876111695b399cf1073211d5268221cf5ed1ad36d044a9
3
+ metadata.gz: 6ba63b8d1332e409066b96b5e01205be8503dee2e3bb11ad8863df3c8c5586d2
4
+ data.tar.gz: 8a8cee9e25a6c5cf5cdfc9fa5c3eb3a176827447ec41a0891351808cf1a67bca
5
5
  SHA512:
6
- metadata.gz: 6f397b5d7889e2e233336c4f35ce6cef157a7f86c64bd8d812ccb7700cc4bd91a48ff9695f3d14a29e696c44a3192c47eeba11e80f77c8b2391238a12dd15813
7
- data.tar.gz: 5f46e1fedad3a942b30a8667338073c8e3cbc166054f6acde5f2d5820734b603188dc247d845850e23e95762726cc0de2c657ced3d5c3ce4f8e9e02206e014df
6
+ metadata.gz: 93c40d01325be4deb136bec1e3f0c5f375475669dd2b44a535733bbc54976eca5d7bcce58b2688ca916303a45dbb6f7bcf2df3bc20fdcdb7a18ab1c7e0bcda4f
7
+ data.tar.gz: 4b66a6c0242bed4283dafdb5d7a68a9dc9357ab5ce75e87824afd0dd1b68fecf686863b242c95b8ddc239efb003423c9dd7687ff042228a16cbf1aad0b2e8fe2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ v3.0.3, 2022-05-31
2
+ -------------------
3
+ * Only calculate cache scope and key if request is cacheable [#324](https://github.com/oesmith/puffing-billy/pull/324)
4
+
5
+ v3.0.2, 2022-02-16
6
+ -------------------
7
+ * Add rake tasks inside files DSL in gemspec [#321](https://github.com/oesmith/puffing-billy/pull/321)
8
+
9
+ v3.0.1, 2022-02-15
10
+ -------------------
11
+ * Adapt to newer versions selenium webdriver [#314](https://github.com/oesmith/puffing-billy/pull/314)
12
+
1
13
  v3.0.0, 2022-02-15
2
14
  -------------------
3
15
  * Add support for Ruby 2.7+, remove support for Ruby 2.4 and 2.5
@@ -47,19 +47,24 @@ module Billy
47
47
 
48
48
  def self.register_selenium_driver
49
49
  ::Capybara.register_driver :selenium_billy do |app|
50
- options = build_selenium_options_for_firefox
51
- capabilities = Selenium::WebDriver::Remote::Capabilities.firefox(accept_insecure_certs: true)
50
+ capabilities = [
51
+ build_selenium_options_for_firefox,
52
+ Selenium::WebDriver::Remote::Capabilities.firefox(accept_insecure_certs: true)
53
+ ]
52
54
 
53
- ::Capybara::Selenium::Driver.new(app, options: options, desired_capabilities: capabilities)
55
+ ::Capybara::Selenium::Driver.new(app, capabilities: capabilities)
54
56
  end
55
57
 
56
58
  ::Capybara.register_driver :selenium_headless_billy do |app|
57
59
  options = build_selenium_options_for_firefox.tap do |opts|
58
60
  opts.add_argument '-headless'
59
61
  end
60
- capabilities = Selenium::WebDriver::Remote::Capabilities.firefox(accept_insecure_certs: true)
61
-
62
- ::Capybara::Selenium::Driver.new(app, options: options, desired_capabilities: capabilities)
62
+ capabilities = [
63
+ options,
64
+ Selenium::WebDriver::Remote::Capabilities.firefox(accept_insecure_certs: true)
65
+ ]
66
+
67
+ ::Capybara::Selenium::Driver.new(app, capabilities: capabilities)
63
68
  end
64
69
 
65
70
  ::Capybara.register_driver :selenium_chrome_billy do |app|
@@ -70,7 +75,7 @@ module Billy
70
75
  ::Capybara::Selenium::Driver.new(
71
76
  app,
72
77
  browser: :chrome,
73
- options: options,
78
+ capabilities: options,
74
79
  clear_local_storage: true,
75
80
  clear_session_storage: true
76
81
  )
@@ -88,7 +93,7 @@ module Billy
88
93
  ::Capybara::Selenium::Driver.new(
89
94
  app,
90
95
  browser: :chrome,
91
- options: options,
96
+ capabilities: options,
92
97
  clear_local_storage: true,
93
98
  clear_session_storage: true
94
99
  )
@@ -105,7 +110,6 @@ module Billy
105
110
 
106
111
  def self.build_selenium_options_for_firefox
107
112
  profile = Selenium::WebDriver::Firefox::Profile.new.tap do |prof|
108
- prof.assume_untrusted_certificate_issuer = false
109
113
  prof.proxy = Selenium::WebDriver::Proxy.new(
110
114
  http: "#{Billy.proxy.host}:#{Billy.proxy.port}",
111
115
  ssl: "#{Billy.proxy.host}:#{Billy.proxy.port}")
data/lib/billy/cache.rb CHANGED
@@ -15,6 +15,8 @@ module Billy
15
15
  end
16
16
 
17
17
  def cached?(method, url, body)
18
+ return false unless Billy.config.cache
19
+
18
20
  # Only log the key the first time it's looked up (in this method)
19
21
  key = key(method, url, body, true)
20
22
  !@cache[key].nil? || persisted?(key)
@@ -25,9 +25,6 @@ module Billy
25
25
  port: Billy.config.proxied_request_port }} )
26
26
  end
27
27
 
28
- cache_scope = Billy::Cache.instance.scope
29
- cache_key = Billy::Cache.instance.key(method.downcase, url, body)
30
-
31
28
  req = EventMachine::HttpRequest.new(url, opts)
32
29
  req = req.send(method.downcase, build_request_options(url, headers, body))
33
30
 
@@ -47,6 +44,9 @@ module Billy
47
44
  end
48
45
 
49
46
  if cacheable?(url, response[:headers], response[:status])
47
+ cache_scope = Billy::Cache.instance.scope
48
+ cache_key = Billy::Cache.instance.key(method.downcase, url, body)
49
+
50
50
  Billy::Cache.instance.store(
51
51
  cache_key,
52
52
  cache_scope,
data/lib/billy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Billy
2
- VERSION = '3.0.0'
2
+ VERSION = '3.0.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puffing-billy
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olly Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-15 00:00:00.000000000 Z
11
+ date: 2022-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -182,16 +182,16 @@ dependencies:
182
182
  name: watir
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - ">="
185
+ - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: 7.0.0
187
+ version: 7.1.0
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
- - - ">="
192
+ - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: 7.0.0
194
+ version: 7.1.0
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: webdrivers
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -328,29 +328,13 @@ description: A stubbing proxy server for ruby. Connect it to your browser in int
328
328
  tests to fake interactions with remote HTTP(S) servers.
329
329
  email:
330
330
  - olly.smith@gmail.com
331
- executables:
332
- - proxy.rb
331
+ executables: []
333
332
  extensions: []
334
333
  extra_rdoc_files: []
335
334
  files:
336
- - ".github/workflows/ci.yml"
337
- - ".gitignore"
338
- - ".rspec"
339
335
  - CHANGELOG.md
340
- - Dockerfile
341
- - Gemfile
342
- - Guardfile
343
336
  - LICENSE
344
337
  - README.md
345
- - Rakefile
346
- - bin/proxy.rb
347
- - examples/README.md
348
- - examples/facebook_api.html
349
- - examples/intercept_request.html
350
- - examples/post_api.html
351
- - examples/preflight_request.html
352
- - examples/tumblr_api.html
353
- - examples/tumblr_api_https.html
354
338
  - lib/billy.rb
355
339
  - lib/billy/browsers/capybara.rb
356
340
  - lib/billy/browsers/watir.rb
@@ -383,33 +367,9 @@ files:
383
367
  - lib/puffing-billy.rb
384
368
  - lib/puffing-billy/rspec.rb
385
369
  - lib/tasks/billy.rake
386
- - log/.gitkeep
387
- - puffing-billy.gemspec
388
- - spec/features/examples/facebook_api_spec.rb
389
- - spec/features/examples/intercept_request_spec.rb
390
- - spec/features/examples/post_api_spec.rb
391
- - spec/features/examples/preflight_request_spec.rb
392
- - spec/features/examples/tumblr_api_spec.rb
393
- - spec/lib/billy/browsers/capybara_spec.rb
394
- - spec/lib/billy/cache_spec.rb
395
- - spec/lib/billy/handlers/cache_handler_spec.rb
396
- - spec/lib/billy/handlers/handler_spec.rb
397
- - spec/lib/billy/handlers/proxy_handler_spec.rb
398
- - spec/lib/billy/handlers/request_handler_spec.rb
399
- - spec/lib/billy/handlers/request_log_spec.rb
400
- - spec/lib/billy/handlers/stub_handler_spec.rb
401
- - spec/lib/billy/proxy_connection_spec.rb
402
- - spec/lib/billy/proxy_request_stub_spec.rb
403
- - spec/lib/billy/resource_utils_spec.rb
404
- - spec/lib/billy/ssl/authority_spec.rb
405
- - spec/lib/billy/ssl/certificate_chain_spec.rb
406
- - spec/lib/billy/ssl/certificate_spec.rb
407
- - spec/lib/billy/watir/watir_spec.rb
408
- - spec/lib/proxy_spec.rb
409
- - spec/spec_helper.rb
410
- - spec/support/test_server.rb
411
370
  homepage: https://github.com/oesmith/puffing-billy
412
- licenses: []
371
+ licenses:
372
+ - MIT
413
373
  metadata: {}
414
374
  post_install_message:
415
375
  rdoc_options: []
@@ -430,27 +390,4 @@ rubygems_version: 3.2.22
430
390
  signing_key:
431
391
  specification_version: 4
432
392
  summary: Easy request stubs for browser tests.
433
- test_files:
434
- - spec/features/examples/facebook_api_spec.rb
435
- - spec/features/examples/intercept_request_spec.rb
436
- - spec/features/examples/post_api_spec.rb
437
- - spec/features/examples/preflight_request_spec.rb
438
- - spec/features/examples/tumblr_api_spec.rb
439
- - spec/lib/billy/browsers/capybara_spec.rb
440
- - spec/lib/billy/cache_spec.rb
441
- - spec/lib/billy/handlers/cache_handler_spec.rb
442
- - spec/lib/billy/handlers/handler_spec.rb
443
- - spec/lib/billy/handlers/proxy_handler_spec.rb
444
- - spec/lib/billy/handlers/request_handler_spec.rb
445
- - spec/lib/billy/handlers/request_log_spec.rb
446
- - spec/lib/billy/handlers/stub_handler_spec.rb
447
- - spec/lib/billy/proxy_connection_spec.rb
448
- - spec/lib/billy/proxy_request_stub_spec.rb
449
- - spec/lib/billy/resource_utils_spec.rb
450
- - spec/lib/billy/ssl/authority_spec.rb
451
- - spec/lib/billy/ssl/certificate_chain_spec.rb
452
- - spec/lib/billy/ssl/certificate_spec.rb
453
- - spec/lib/billy/watir/watir_spec.rb
454
- - spec/lib/proxy_spec.rb
455
- - spec/spec_helper.rb
456
- - spec/support/test_server.rb
393
+ test_files: []
@@ -1,27 +0,0 @@
1
- # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
2
- # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
3
-
4
- name: CI
5
- on:
6
- push:
7
- branches: [ master ]
8
- pull_request:
9
- branches: [ master ]
10
- jobs:
11
- test:
12
- runs-on: ubuntu-latest
13
- strategy:
14
- fail-fast: false
15
- matrix:
16
- ruby-version: ['2.6', '2.7', '3.0', '3.1']
17
-
18
- steps:
19
- - uses: actions/checkout@v2
20
- - name: Set up Ruby
21
- uses: ruby/setup-ruby@v1
22
- with:
23
- ruby-version: ${{ matrix.ruby-version }}
24
- bundler-cache: true
25
- rubygems: latest
26
- - name: Run tests
27
- run: bundle exec rake
data/.gitignore DELETED
@@ -1,6 +0,0 @@
1
- node_modules/
2
- /Gemfile.lock
3
- log/test.log
4
- .idea/
5
- .ruby-version
6
- *.swp
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --color
2
- --format progress
data/Dockerfile DELETED
@@ -1,14 +0,0 @@
1
- FROM ruby:1.9.3
2
-
3
- RUN apt-get update -y
4
- RUN apt-get install -y qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x
5
- RUN gem install bundler
6
- RUN \
7
- export PHANTOMJS_VERSION='2.1.1' && \
8
- export PHANTOMJS_URL='https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2' && \
9
- wget -q ${PHANTOMJS_URL} && \
10
- tar xfv phantomjs-${PHANTOMJS_VERSION}-linux-x86_64.tar.bz2 \
11
- -C /usr/bin --wildcards */bin/phantomjs --strip-components=2
12
- RUN mkdir -p /app
13
- COPY . /app
14
- RUN cd /app && bundle install
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in puffing-billy.gemspec
4
- gemspec
data/Guardfile DELETED
@@ -1,23 +0,0 @@
1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
- guard 'rspec', version: 2 do
5
- watch(%r{^spec/.+_spec\.rb$})
6
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
- watch('spec/spec_helper.rb') { 'spec' }
8
-
9
- # Rails example
10
- watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
11
- watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
12
- watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
13
- watch(%r{^spec/support/(.+)\.rb$}) { 'spec' }
14
- watch('config/routes.rb') { 'spec/routing' }
15
- watch('app/controllers/application_controller.rb') { 'spec/controllers' }
16
-
17
- # Capybara request specs
18
- watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
19
-
20
- # Turnip features and steps
21
- watch(%r{^spec/acceptance/(.+)\.feature$})
22
- watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
23
- end
data/Rakefile DELETED
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env rake
2
- require 'bundler/gem_tasks'
3
-
4
- begin
5
- require 'rspec/core/rake_task'
6
- RSpec::Core::RakeTask.new(:spec)
7
- rescue LoadError
8
- end
9
-
10
- desc 'Run all tests'
11
- task default: [:spec]
data/bin/proxy.rb DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'billy'
3
- Billy::Proxy.new.start(false)
data/examples/README.md DELETED
@@ -1 +0,0 @@
1
- See example specs in `spec/requests/examples`.
@@ -1,59 +0,0 @@
1
- <div id="fb-root"></div>
2
- <script>
3
- // Load the SDK Asynchronously
4
- (function(d){
5
- var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
6
- if (d.getElementById(id)) {return;}
7
- js = d.createElement('script'); js.id = id; js.async = true;
8
- js.src = "//connect.facebook.net/en_US/all.js";
9
- ref.parentNode.insertBefore(js, ref);
10
- }(document));
11
-
12
- // Init the SDK upon load
13
- window.fbAsyncInit = function() {
14
- FB.init({
15
- appId : '408416075843608', // App ID
16
- //channelUrl : '//'+window.location.hostname+'/channel', // Path to your Channel File
17
- status : true, // check login status
18
- cookie : true, // enable cookies to allow the server to access the session
19
- xfbml : true // parse XFBML
20
- });
21
-
22
- // listen for and handle auth.statusChange events
23
- FB.Event.subscribe('auth.statusChange', function(response) {
24
- if (response.authResponse) {
25
- // user has auth'd your app and is logged into Facebook
26
- FB.api('/me', function(me){
27
- if (me.name) {
28
- document.getElementById('auth-displayname').innerHTML = me.name;
29
- }
30
- })
31
- document.getElementById('auth-loggedout').style.display = 'none';
32
- document.getElementById('auth-loggedin').style.display = 'block';
33
- } else {
34
- // user has not auth'd your app, or is not logged into Facebook
35
- document.getElementById('auth-loggedout').style.display = 'block';
36
- document.getElementById('auth-loggedin').style.display = 'none';
37
- }
38
- });
39
-
40
- // respond to clicks on the login and logout links
41
- document.getElementById('auth-loginlink').addEventListener('click', function(){
42
- FB.login();
43
- });
44
- document.getElementById('auth-logoutlink').addEventListener('click', function(){
45
- FB.logout();
46
- });
47
- }
48
- </script>
49
-
50
- <h1>Facebook Client-side Authentication Example</h1>
51
- <div id="auth-status">
52
- <div id="auth-loggedout">
53
- <a href="#" id="auth-loginlink">Login</a>
54
- </div>
55
- <div id="auth-loggedin" style="display:none">
56
- Hi, <span id="auth-displayname"></span>
57
- (<a href="#" id="auth-logoutlink">logout</a>)
58
- </div>
59
- </div>
@@ -1,10 +0,0 @@
1
- <!DOCTYPE html>
2
- <body>
3
- <h1>Intercept request example</h1>
4
- <script type='text/javascript' src='http://code.jquery.com/jquery-1.8.2.min.js'></script>
5
- <script type='text/javascript'>
6
- $(function () {
7
- $.post('http://example.com/', { foo: 'bar' });
8
- })
9
- </script>
10
- </body>
@@ -1,16 +0,0 @@
1
- <!doctype html>
2
- <body>
3
- <h1>POST to API</h1>
4
- <div id="result"></div>
5
- <script type='text/javascript' src='http://code.jquery.com/jquery-1.8.2.min.js'></script>
6
- <script type='text/javascript'>
7
- $(function () {
8
- $.post('http://example.com/api', { foo: 'bar' }).done(function(data) {
9
- $('#result').append('Success!');
10
- })
11
- .fail(function(data) {
12
- $('#result').append('Fail!');
13
- });
14
- })
15
- </script>
16
- </body>
@@ -1,22 +0,0 @@
1
- <!doctype html>
2
- <body>
3
- <h1>Cross Domain Request</h1>
4
- <div id="result"></div>
5
- <script type='text/javascript' src='http://code.jquery.com/jquery-1.8.2.min.js'></script>
6
- <script type='text/javascript'>
7
- $(function () {
8
- $.ajax(
9
- {
10
- url: 'http://example.com/api',
11
- method: 'GET',
12
- contentType: 'json' // setting this forces an OPTIONS request
13
- }
14
- ).done(function(data) {
15
- $('#result').append('Success!');
16
- })
17
- .fail(function(data) {
18
- $('#result').append('Fail!');
19
- });
20
- })
21
- </script>
22
- </body>
@@ -1,22 +0,0 @@
1
- <!doctype html>
2
- <body>
3
- <h1>Latest news</h1>
4
- <div id="news"></div>
5
-
6
- <script type='text/javascript' src='http://code.jquery.com/jquery-1.8.2.min.js'></script>
7
- <script type='text/javascript'>
8
- $(function () {
9
- var url = 'http://blog.howmanyleft.co.uk/api/read/json?callback=?&type=text&num=3&filter=text';
10
- $.getJSON(url, function (data) {
11
- $.each(data.posts, function (idx, post) {
12
- var title = post['regular-title'];
13
- var href = post['url-with-slug'];
14
- var body = post['regular-body'];
15
- $('#news').append(
16
- '<h3><a href="' + href + '">' + title + '</a></h3>' +
17
- '<p>' + body + '</p>');
18
- });
19
- });
20
- })
21
- </script>
22
- </body>
@@ -1,22 +0,0 @@
1
- <!doctype html>
2
- <body>
3
- <h1>Latest news</h1>
4
- <div id="news"></div>
5
-
6
- <script type='text/javascript' src='http://code.jquery.com/jquery-1.8.2.min.js'></script>
7
- <script type='text/javascript'>
8
- $(function () {
9
- var url = 'https://blog.howmanyleft.co.uk/api/read/json?callback=?&type=text&num=3&filter=text';
10
- $.getJSON(url, function (data) {
11
- $.each(data.posts, function (idx, post) {
12
- var title = post['regular-title'];
13
- var href = post['url-with-slug'];
14
- var body = post['regular-body'];
15
- $('#news').append(
16
- '<h3><a href="' + href + '">' + title + '</a></h3>' +
17
- '<p>' + body + '</p>');
18
- });
19
- });
20
- })
21
- </script>
22
- </body>
data/log/.gitkeep DELETED
File without changes
@@ -1,41 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/billy/version', __FILE__)
3
-
4
- Gem::Specification.new do |gem|
5
- gem.authors = ['Olly Smith']
6
- gem.email = ['olly.smith@gmail.com']
7
- gem.description = 'A stubbing proxy server for ruby. Connect it to your browser in integration tests to fake interactions with remote HTTP(S) servers.'
8
- gem.summary = 'Easy request stubs for browser tests.'
9
- gem.homepage = 'https://github.com/oesmith/puffing-billy'
10
-
11
- gem.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
12
- gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
13
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
- gem.name = 'puffing-billy'
15
- gem.require_paths = ['lib']
16
- gem.version = Billy::VERSION
17
- gem.required_ruby_version = '>= 2.6.0'
18
-
19
- gem.add_development_dependency 'rspec'
20
- gem.add_development_dependency 'thin'
21
- gem.add_development_dependency 'faraday', '>= 0.9.0'
22
- gem.add_development_dependency 'apparition'
23
- gem.add_development_dependency 'capybara'
24
- gem.add_development_dependency 'selenium-webdriver', '>= 4.0.0'
25
- gem.add_development_dependency 'rack'
26
- gem.add_development_dependency 'rake'
27
- gem.add_development_dependency 'guard'
28
- gem.add_development_dependency 'rb-inotify'
29
- gem.add_development_dependency 'pry'
30
- gem.add_development_dependency 'cucumber'
31
- gem.add_development_dependency 'watir', '>= 7.0.0'
32
- gem.add_development_dependency 'webdrivers', '>= 5.0.0'
33
- gem.add_development_dependency 'webrick'
34
- gem.add_runtime_dependency 'addressable', '~> 2.5'
35
- gem.add_runtime_dependency 'eventmachine', '~> 1.2'
36
- gem.add_runtime_dependency 'em-synchrony'
37
- gem.add_runtime_dependency 'em-http-request', '~> 1.1', '>= 1.1.0'
38
- gem.add_runtime_dependency 'eventmachine_httpserver'
39
- gem.add_runtime_dependency 'http_parser.rb', '~> 0.6.0'
40
- gem.add_runtime_dependency 'multi_json'
41
- end
@@ -1,23 +0,0 @@
1
- require 'spec_helper'
2
- require 'base64'
3
-
4
- # FIXME: Looks like Facebook API changed recently and this test fails consistently now -RS 2018-03-05
5
- xdescribe 'Facebook API example', type: :feature, js: true do
6
- before do
7
- proxy.stub('https://www.facebook.com:443/dialog/oauth').and_return(proc do |params, _, _|
8
- # mock a signed request from facebook. the JS api never verifies the
9
- # signature, so all it needs is the base64-encoded payload
10
- signed_request = "xxxxxxxxxx.#{Base64.encode64('{"user_id":"1234567"}')}"
11
- # redirect to the 'redirect_uri', with some extra crap in the query string
12
- { redirect_to: "#{params['redirect_uri'][0]}&access_token=foobar&expires_in=600&base_domain=localhost&https=1&signed_request=#{signed_request}" }
13
- end)
14
-
15
- proxy.stub('https://graph.facebook.com:443/me').and_return(jsonp: { name: 'Tester 1' })
16
- end
17
-
18
- it 'should show me as logged-in' do
19
- visit '/facebook_api.html'
20
- click_on 'Login'
21
- expect(page).to have_content 'Hi, Tester 1'
22
- end
23
- end
@@ -1,31 +0,0 @@
1
- require 'spec_helper'
2
- require 'timeout'
3
-
4
- describe 'intercept request example', type: :feature, js: true do
5
- before do
6
- Billy.config.record_stub_requests = true
7
- end
8
-
9
- it 'should intercept a GET request directly' do
10
- stub = proxy.stub('http://example.com/').and_return(
11
- headers: { 'Access-Control-Allow-Origin' => '*' },
12
- code: 200
13
- )
14
- visit 'http://example.com/'
15
- expect(stub.has_requests?).to be true
16
- expect(stub.requests).not_to be_empty
17
- end
18
-
19
- it 'should intercept a POST request through an intermediary page' do
20
- stub = proxy.stub('http://example.com/', method: 'post').and_return(
21
- headers: { 'Access-Control-Allow-Origin' => '*' },
22
- code: 200
23
- )
24
- visit '/intercept_request.html'
25
- Timeout::timeout(5) do
26
- sleep(0.1) until stub.has_requests?
27
- end
28
- request = stub.requests.shift
29
- expect(request[:body]).to eql 'foo=bar'
30
- end
31
- end
@@ -1,15 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'jQuery POST API example', type: :feature, js: true do
4
- before do
5
- proxy.stub('http://example.com/api', method: 'post').and_return(
6
- headers: { 'Access-Control-Allow-Origin' => '*' },
7
- code: 201
8
- )
9
- end
10
-
11
- it 'posts to an API' do
12
- visit '/post_api.html'
13
- expect(page.find('#result')).to have_content 'Success!'
14
- end
15
- end