proxy_rb 0.7.1 → 0.8.0

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: d596139bab9ef9b858831dfca447f18f20bfc27c
4
- data.tar.gz: 1f539a3727f6e96eabc7fcb78927932970f79cd5
3
+ metadata.gz: 6c22b3176f4ab9834dc8aa9d17f8fb1d2e4e60ee
4
+ data.tar.gz: 48468995af00e8133f6d540a7dd96c60dc45c616
5
5
  SHA512:
6
- metadata.gz: 559e7216f699f755daf26b02a47f8d9402b002e10c121ab3b1a9d927464888f0f94b3415a826b0c8386b5b323d78c2fa11b8484f4b43fd757b52a8702b080407
7
- data.tar.gz: 3aa466ab70afbac880c504f0a4d6ad1d1dab21a0144472fa4e03de15936841d1eda8da7a7525f1497fcdaa703e0d035102323783a8280818b11ccd780659bc9a
6
+ metadata.gz: 3aa39f45927ddf916e30aa622c57c301f204ae52ba117d110900281a56b259235a9c7153f5062d2caf362743ea1c2cc53cd4ec34822b61ef321f8f0133922e4f
7
+ data.tar.gz: a83e601a85290e0c49e5e69fb45489352c0fae7caa5697e6023e10cbff8d36e0bbd6d84b83499321840e86e516d64fc98e52b5f467cbbfd75a9c9c9ae4d68192
data/History.md CHANGED
@@ -4,6 +4,11 @@ Empty
4
4
 
5
5
  # RELEASED
6
6
 
7
+ ## [v0.8.0](https://github.com/cucumber/aruba/compare/v0.7.1...v0.8.0)
8
+
9
+ * Introduce `strict` option to make it possible to be more relaxed in matchers
10
+ when the response is not readable, this can lead to status_code == 0
11
+
7
12
  ## [v0.7.1](https://github.com/cucumber/aruba/compare/v0.7.0...v0.7.1)
8
13
 
9
14
  * Handle nil as input for `#simple_table`
@@ -1,6 +1,17 @@
1
+ # frozen_string_literal: true
2
+ # ProxyRb
1
3
  module ProxyRb
4
+ # Api
2
5
  module Api
6
+ # Formatters for output
3
7
  module Formatters
8
+ # Convert Hash to simple table
9
+ #
10
+ # @param [Hash] hash
11
+ # the hash which should be converted
12
+ #
13
+ # @return [String]
14
+ # The generated table
4
15
  def simple_table(hash)
5
16
  SimpleTable.new(hash).to_s
6
17
  end
@@ -18,6 +18,7 @@ module ProxyRb
18
18
  option_accessor :password_fetcher, contract: { PasswordFetchers::BasicPasswordFetcher => PasswordFetchers::BasicPasswordFetcher }, default: ProxyRb::PasswordFetchers::EnvironmentPasswordFetcher.new(prefix: 'SECRET')
19
19
  option_accessor :driver, contract: { Drivers::BasicDriver => Drivers::BasicDriver }, default: ProxyRb::Drivers::WebkitDriver.new
20
20
  option_accessor :console_history_file, contract: { String => String }, default: '~/.proxy_rb_history'
21
+ option_accessor :strict, contract: { Bool => Bool }, default: true
21
22
  end
22
23
  end
23
24
 
@@ -1,6 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
  RSpec::Matchers.define :be_forbidden do
3
3
  match do |actual|
4
+ next true if proxy_rb.config.strict == false && (actual.status_code.nil? || actual.status_code == 0)
5
+ require 'pry'
6
+ sleep 0.5 # handle network latency
7
+
4
8
  values_match?(403, actual.status_code)
5
9
  end
6
10
 
@@ -1,6 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
  RSpec::Matchers.define :be_successful do
3
3
  match do |actual|
4
+ next true if proxy_rb.config.strict == false && (actual.status_code.nil? || actual.status_code == 0)
5
+
6
+ sleep 0.5
4
7
  actual.status_code.to_s.start_with?('2', '3')
5
8
  end
6
9
 
@@ -26,6 +26,7 @@ module ProxyRb
26
26
  private
27
27
 
28
28
  # disable Metrics/MethodLength
29
+ # rubocop:disable Metrics/AbcSize
29
30
  def events
30
31
  runtime.event_bus.register(
31
32
  :proxy_set,
@@ -63,5 +64,6 @@ module ProxyRb
63
64
  )
64
65
  end
65
66
  # enable Metrics/MethodLength
67
+ # rubocop:enable Metrics/AbcSize
66
68
  end
67
69
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Aruba
2
3
  module ProxyRb
3
4
  # Generate simple table
@@ -15,7 +16,7 @@ module ProxyRb
15
16
  def initialize(hash, opts = {})
16
17
  @hash = Hash(hash)
17
18
  @opts = {
18
- :sort => true
19
+ sort: true
19
20
  }.merge opts
20
21
  end
21
22
 
@@ -29,7 +30,7 @@ module ProxyRb
29
30
 
30
31
  name_size = longest_key.length
31
32
 
32
- rows = hash.each_with_object([]) do |(k,v), a|
33
+ rows = hash.each_with_object([]) do |(k, v), a|
33
34
  a << format("# %-#{name_size}s => %s", k, v)
34
35
  end
35
36
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  # Main Module
3
3
  module ProxyRb
4
- VERSION = '0.7.1'
4
+ VERSION = '0.8.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proxy_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Meyer