proxy_pac_rb 0.8.0 → 0.8.1
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34befa5ef800334a8c802128b0ef7995da2f7302
|
4
|
+
data.tar.gz: 175420dfe26f0e8b70d676c705b0e14b19abb6a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53bc10282abfb856e21cd3df7fddd533795c99239698ce17abd2d6fc4cbaf0d054f4eea0c45b269f7ed6dac513c4d7ea2872d09a7eacdbdc0c08465eb33f0fb4
|
7
|
+
data.tar.gz: e223aba4f3b7140967267720476812130a50412bb3bb9c2749574f1dffb815250e85dcf685379604a1a45b7323e53b72932450dee0af6e9f84a41bebac9bd118
|
@@ -21,7 +21,7 @@ module ProxyPacRb
|
|
21
21
|
# @private
|
22
22
|
attr_reader :actual, :expected, :rescued_exception
|
23
23
|
|
24
|
-
def initialize(expected=UNDEFINED)
|
24
|
+
def initialize(expected = UNDEFINED)
|
25
25
|
@expected = expected unless UNDEFINED.equal?(expected)
|
26
26
|
end
|
27
27
|
|
@@ -91,7 +91,7 @@ module ProxyPacRb
|
|
91
91
|
|
92
92
|
# @private
|
93
93
|
def self.matcher_name
|
94
|
-
@matcher_name ||= underscore(name.split(
|
94
|
+
@matcher_name ||= underscore(name.split('::').last)
|
95
95
|
end
|
96
96
|
|
97
97
|
# @private
|
@@ -100,7 +100,7 @@ module ProxyPacRb
|
|
100
100
|
word = camel_cased_word.to_s.dup
|
101
101
|
word.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
102
102
|
word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
|
103
|
-
word.tr!(
|
103
|
+
word.tr!('-', '_')
|
104
104
|
word.downcase!
|
105
105
|
word
|
106
106
|
end
|
@@ -111,17 +111,17 @@ module ProxyPacRb
|
|
111
111
|
def assert_ivars(*expected_ivars)
|
112
112
|
return unless (expected_ivars - present_ivars).any?
|
113
113
|
ivar_list = EnglishPhrasing.list(expected_ivars)
|
114
|
-
|
114
|
+
fail "#{self.class.name} needs to supply#{ivar_list}"
|
115
115
|
end
|
116
116
|
|
117
117
|
if RUBY_VERSION.to_f < 1.9
|
118
118
|
# :nocov:
|
119
119
|
def present_ivars
|
120
|
-
instance_variables.map
|
120
|
+
instance_variables.map(&:to_sym)
|
121
121
|
end
|
122
122
|
# :nocov:
|
123
123
|
else
|
124
|
-
|
124
|
+
alias_method :present_ivars, :instance_variables
|
125
125
|
end
|
126
126
|
|
127
127
|
# @private
|
@@ -165,12 +165,14 @@ module ProxyPacRb
|
|
165
165
|
end
|
166
166
|
|
167
167
|
# @private
|
168
|
+
# rubocop:disable Style/PredicateName
|
168
169
|
def self.has_default_failure_messages?(matcher)
|
169
170
|
matcher.method(:failure_message).owner == self &&
|
170
171
|
matcher.method(:failure_message_when_negated).owner == self
|
171
172
|
rescue NameError
|
172
173
|
false
|
173
174
|
end
|
175
|
+
# rubocop:enable Style/PredicateName
|
174
176
|
end
|
175
177
|
|
176
178
|
include DefaultFailureMessages
|
@@ -1,7 +1,9 @@
|
|
1
1
|
require 'proxy_pac_rb'
|
2
2
|
|
3
3
|
module ProxyPacRb
|
4
|
+
# RSpec matchers
|
4
5
|
module RSpecMatchers
|
6
|
+
# Check if other proxy pac the same
|
5
7
|
class BeTheSameProxyPacFile < BaseMatcher
|
6
8
|
def initialize(expected)
|
7
9
|
@file_a = begin
|
@@ -48,34 +50,16 @@ module ProxyPacRb
|
|
48
50
|
end
|
49
51
|
end
|
50
52
|
|
53
|
+
# External documented
|
51
54
|
module RSpec
|
55
|
+
# External documented
|
52
56
|
module Matchers
|
57
|
+
# Check proxy pac
|
58
|
+
#
|
59
|
+
# @param [RSpec::Matcher] expected
|
60
|
+
# The matcher
|
53
61
|
def be_the_same_proxy_pac_file(expected)
|
54
|
-
|
62
|
+
ProxyPacRb::RSpecMatchers::BeTheSameProxyPacFile.new(expected)
|
55
63
|
end
|
56
64
|
end
|
57
65
|
end
|
58
|
-
|
59
|
-
# RSpec::Matchers.define :be_the_same_proxy_pac_file do |expected|
|
60
|
-
# def loader
|
61
|
-
# @loader ||= ProxyPacRb::ProxyPacLoader.new
|
62
|
-
# end
|
63
|
-
#
|
64
|
-
# match do |actual|
|
65
|
-
#
|
66
|
-
# @file_b = begin
|
67
|
-
# file = ProxyPacRb::ProxyPacFile.new(source: expected)
|
68
|
-
# loader.load(file)
|
69
|
-
#
|
70
|
-
# file
|
71
|
-
# end
|
72
|
-
#
|
73
|
-
# @actual = @file_a.content
|
74
|
-
# @expected = @file_b.content
|
75
|
-
#
|
76
|
-
# binding.pry
|
77
|
-
#
|
78
|
-
# values_match?(@expected, @actual)
|
79
|
-
# end
|
80
|
-
#
|
81
|
-
# end
|
@@ -5,14 +5,14 @@ RSpec::Matchers.define :be_downloaded_via do |expected|
|
|
5
5
|
@old_actual = actual
|
6
6
|
@actual = proxy_pac.find(actual).to_s
|
7
7
|
|
8
|
-
@actual
|
8
|
+
values_match? expected, @actual
|
9
9
|
end
|
10
10
|
|
11
|
-
failure_message do
|
11
|
+
failure_message do
|
12
12
|
format(%(expected that url "%s" is downloaded via "%s", but it is downloaded via "%s".), @old_actual, expected, @actual)
|
13
13
|
end
|
14
14
|
|
15
|
-
failure_message_when_negated do
|
15
|
+
failure_message_when_negated do
|
16
16
|
format(%(expected that url "%s" is not downloaded via "%s", but it is downloaded via "%s".), @old_actual, expected, @actual)
|
17
17
|
end
|
18
18
|
end
|
data/lib/proxy_pac_rb/version.rb
CHANGED