stub_requests 0.1.5 → 0.1.6

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
  SHA256:
3
- metadata.gz: fb6e6aa72e0616a2a89284efa00ae33420dcf6cf3247e069af90fda69c769733
4
- data.tar.gz: f7c963fcc527dce3e5979890b908d9a9a8acd31d676e5a91353180ea8ba55612
3
+ metadata.gz: d4dcfcb95fc0084e09f59ae295b6244b9f08fe11a284b7ee3e7df9d988d4c832
4
+ data.tar.gz: 38716732dc7d96ccab33752e7e097f324ce1c3c4d2d588bce7397bdec996a24d
5
5
  SHA512:
6
- metadata.gz: d6cc37d6d92dec8aeacee90ff793f12db37deef28a4b735854fd34d6838ac47952a39e75f190e3488613a67fb9e475be952da5a4c9d3ec865bd1ed30cd68f5e2
7
- data.tar.gz: 9db50e02b973429d74fa989baa0212d78b1c6df34e5aca7b556573bdf8bdff25aa689a0b21d053b4308fe8faefbb3826f277686d217687b147d9e9f44dbb0232
6
+ metadata.gz: 3c07523bea4f8fe8ed44df67862e29c46030aca348ea3f1c962a2040f02ce519292c468a4b753d76656afa08c839b4bfb936835bfa350cc15a5302cf6121036c
7
+ data.tar.gz: 926410d4326bf53974c8074bd2072d465a1f5fabb052794477a16e39440527ad0fcc55cf4a8d602bd1afa4a2a1b3bd56b6accf3030267198b7aa414b8207ba40
data/CHANGELOG.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # Change Log
2
2
 
3
- ## [Unreleased](https://github.com/mhenrixon/stub_requests/tree/HEAD)
4
-
5
- [Full Changelog](https://github.com/mhenrixon/stub_requests/compare/v0.1.4...HEAD)
3
+ ## [v0.1.5](https://github.com/mhenrixon/stub_requests/tree/v0.1.5) (2019-02-06)
4
+ [Full Changelog](https://github.com/mhenrixon/stub_requests/compare/v0.1.4...v0.1.5)
6
5
 
7
6
  **Implemented enhancements:**
8
7
 
@@ -15,6 +14,7 @@
15
14
 
16
15
  **Merged pull requests:**
17
16
 
17
+ - Update Changelog [\#20](https://github.com/mhenrixon/stub_requests/pull/20) ([mhenrixon](https://github.com/mhenrixon))
18
18
  - Update Changelog [\#16](https://github.com/mhenrixon/stub_requests/pull/16) ([mhenrixon](https://github.com/mhenrixon))
19
19
 
20
20
  ## [v0.1.4](https://github.com/mhenrixon/stub_requests/tree/v0.1.4) (2019-02-06)
data/Rakefile CHANGED
@@ -19,3 +19,9 @@ YARD::Rake::YardocTask.new do |t|
19
19
  end
20
20
 
21
21
  task default: :spec
22
+
23
+ task :release do
24
+ sh("gem bump --tag --release --push")
25
+ sh("./update_docs.sh")
26
+ Rake::Task["changelog"].invoke
27
+ end
@@ -5,7 +5,7 @@ class Hash
5
5
  # @api private
6
6
  def extractable_options?
7
7
  instance_of?(Hash)
8
- end
8
+ end unless method_defined?(:extractable_options?)
9
9
  end
10
10
 
11
11
  # :nodoc:
@@ -17,7 +17,7 @@ class Array
17
17
  else
18
18
  {}
19
19
  end
20
- end
20
+ end unless method_defined?(:extract_options!)
21
21
 
22
22
  # :nodoc:
23
23
  def extract_options
@@ -26,5 +26,5 @@ class Array
26
26
  else
27
27
  {}
28
28
  end
29
- end
29
+ end unless method_defined?(:extract_options)
30
30
  end
@@ -1,60 +1,58 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- unless defined?(Rails) || defined?(ActiveSupport)
3
+ # :nodoc:
4
+ class Class
4
5
  # :nodoc:
5
- class Class
6
- # :nodoc:
7
- def class_attribute(*attrs)
8
- options = attrs.extract_options!
9
- default_value = options.fetch(:default, nil)
6
+ def class_attribute(*attrs)
7
+ options = attrs.extract_options!
8
+ default_value = options.fetch(:default, nil)
10
9
 
11
- attrs.each do |name|
12
- singleton_class.silence_redefinition_of_method(name)
13
- define_singleton_method(name) { nil }
10
+ attrs.each do |name|
11
+ singleton_class.silence_redefinition_of_method(name)
12
+ define_singleton_method(name) { nil }
14
13
 
15
- singleton_class.silence_redefinition_of_method("#{name}?")
16
- define_singleton_method("#{name}?") { !!public_send(name) }
14
+ singleton_class.silence_redefinition_of_method("#{name}?")
15
+ define_singleton_method("#{name}?") { !!public_send(name) }
17
16
 
18
- ivar = "@#{name}"
17
+ ivar = "@#{name}"
19
18
 
20
- singleton_class.silence_redefinition_of_method("#{name}=")
21
- define_singleton_method("#{name}=") do |val|
22
- singleton_class.class_eval do
23
- redefine_method(name) { val }
24
- end
19
+ singleton_class.silence_redefinition_of_method("#{name}=")
20
+ define_singleton_method("#{name}=") do |val|
21
+ singleton_class.class_eval do
22
+ redefine_method(name) { val }
23
+ end
25
24
 
26
- if singleton_class?
27
- class_eval do
28
- redefine_method(name) do
29
- if instance_variable_defined? ivar
30
- instance_variable_get ivar
31
- else
32
- singleton_class.send name
33
- end
25
+ if singleton_class?
26
+ class_eval do
27
+ redefine_method(name) do
28
+ if instance_variable_defined? ivar
29
+ instance_variable_get ivar
30
+ else
31
+ singleton_class.send name
34
32
  end
35
33
  end
36
34
  end
37
- val
38
35
  end
36
+ val
37
+ end
39
38
 
40
- redefine_method(name) do
41
- if instance_variable_defined?(ivar)
42
- instance_variable_get ivar
43
- else
44
- self.class.public_send name
45
- end
39
+ redefine_method(name) do
40
+ if instance_variable_defined?(ivar)
41
+ instance_variable_get ivar
42
+ else
43
+ self.class.public_send name
46
44
  end
45
+ end
47
46
 
48
- redefine_method("#{name}?") { !!public_send(name) }
47
+ redefine_method("#{name}?") { !!public_send(name) }
49
48
 
50
- redefine_method("#{name}=") do |val|
51
- instance_variable_set ivar, val
52
- end
49
+ redefine_method("#{name}=") do |val|
50
+ instance_variable_set ivar, val
51
+ end
53
52
 
54
- unless default_value.nil?
55
- self.send("#{name}=", default_value)
56
- end
53
+ unless default_value.nil?
54
+ self.send("#{name}=", default_value)
57
55
  end
58
56
  end
59
- end
57
+ end unless method_defined?(:class_attribute)
60
58
  end
@@ -1,11 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- unless defined?(Rails) || defined?(ActiveSupport)
3
+ # :nodoc:
4
+ module Kernel
4
5
  # :nodoc:
5
- module Kernel
6
- # :nodoc:
7
- def class_eval(*args, &block)
8
- singleton_class.class_eval(*args, &block)
9
- end
6
+ def class_eval(*args, &block)
7
+ singleton_class.class_eval(*args, &block)
10
8
  end
11
9
  end
@@ -2,49 +2,47 @@
2
2
 
3
3
  # :nodoc:
4
4
 
5
- unless defined?(Rails) || defined?(ActiveSupport)
6
- # See {Module}
5
+ # See {Module}
6
+ # @api private
7
+ class Module
7
8
  # @api private
8
- class Module
9
- # @api private
10
- # :nodoc:
11
- def silence_redefinition_of_method(method)
12
- if method_defined?(method) || private_method_defined?(method)
13
- alias_method :__rails_redefine, method
14
- remove_method :__rails_redefine
15
- end
9
+ # :nodoc:
10
+ def silence_redefinition_of_method(method)
11
+ if method_defined?(method) || private_method_defined?(method)
12
+ alias_method :__stub_requests_redefine, method
13
+ remove_method :__stub_requests_redefine
16
14
  end
15
+ end unless method_defined?(:silence_redefinition_of_method)
17
16
 
18
- # Replaces the existing method definition, if there is one, with the passed
19
- # block as its body.
20
- # @api private
21
- # :nodoc:
22
- def redefine_method(method, &block)
23
- visibility = method_visibility(method)
24
- silence_redefinition_of_method(method)
25
- define_method(method, &block)
26
- send(visibility, method)
27
- end
17
+ # Replaces the existing method definition, if there is one, with the passed
18
+ # block as its body.
19
+ # @api private
20
+ # :nodoc:
21
+ def redefine_method(method, &block)
22
+ visibility = method_visibility(method)
23
+ silence_redefinition_of_method(method)
24
+ define_method(method, &block)
25
+ send(visibility, method)
26
+ end unless method_defined?(:redefine_method)
28
27
 
29
- # Replaces the existing singleton method definition, if there is one, with
30
- # the passed block as its body.
31
- # @api private
32
- # :nodoc:
33
- def redefine_singleton_method(method, &block)
34
- singleton_class.redefine_method(method, &block)
35
- end
28
+ # Replaces the existing singleton method definition, if there is one, with
29
+ # the passed block as its body.
30
+ # @api private
31
+ # :nodoc:
32
+ def redefine_singleton_method(method, &block)
33
+ singleton_class.redefine_method(method, &block)
34
+ end unless method_defined?(:redefine_singleton_method)
36
35
 
37
- # @api private
38
- # :nodoc:
39
- def method_visibility(method) # :nodoc:
40
- case
41
- when private_method_defined?(method)
42
- :private
43
- when protected_method_defined?(method)
44
- :protected
45
- else
46
- :public
47
- end
36
+ # @api private
37
+ # :nodoc:
38
+ def method_visibility(method) # :nodoc:
39
+ case
40
+ when private_method_defined?(method)
41
+ :private
42
+ when protected_method_defined?(method)
43
+ :protected
44
+ else
45
+ :public
48
46
  end
49
- end
47
+ end unless method_defined?(:method_visibility)
50
48
  end
@@ -2,113 +2,112 @@
2
2
 
3
3
  # Copied from https://raw.githubusercontent.com/rails/rails/d66e7835bea9505f7003e5038aa19b6ea95ceea1/activesupport/lib/active_support/core_ext/object/blank.rb
4
4
 
5
- unless defined?(Rails) || defined?(ActiveSupport)
5
+ # :nodoc:
6
+ class Object
7
+ # :nodoc:
8
+ def blank?
9
+ respond_to?(:empty?) ? !!empty? : !self # rubocop:disable Style/DoubleNegation
10
+ end unless method_defined?(:blank?)
6
11
 
7
12
  # :nodoc:
8
- class Object
9
- # :nodoc:
10
- def blank?
11
- respond_to?(:empty?) ? !!empty? : !self # rubocop:disable Style/DoubleNegation
12
- end
13
- # :nodoc:
14
- def present?
15
- !blank?
16
- end
17
- # :nodoc:
18
- def presence
19
- self if present?
20
- end
21
- end
13
+ def present?
14
+ !blank?
15
+ end unless method_defined?(:present?)
22
16
 
23
- # @see NilClass
24
17
  # :nodoc:
25
- class NilClass
26
- # :nodoc:
27
- def blank?
28
- true
29
- end
30
- end
18
+ def presence
19
+ self if present?
20
+ end unless method_defined?(:presence)
21
+ end
31
22
 
32
- # @see FalseClass
23
+ # @see NilClass
24
+ # :nodoc:
25
+ class NilClass
33
26
  # :nodoc:
34
- class FalseClass
35
- # :nodoc:
36
- def blank?
37
- true
38
- end
27
+ def blank?
28
+ true
39
29
  end
30
+ end
40
31
 
41
- # @see TrueClass
32
+ # @see FalseClass
33
+ # :nodoc:
34
+ class FalseClass
42
35
  # :nodoc:
43
- class TrueClass
44
- # :nodoc:
45
- def blank?
46
- false
47
- end
36
+ def blank?
37
+ true
48
38
  end
39
+ end
49
40
 
50
- # @see Array
41
+ # @see TrueClass
42
+ # :nodoc:
43
+ class TrueClass
51
44
  # :nodoc:
52
- class Array
53
- # :nodoc:
54
- alias blank? empty?
45
+ def blank?
46
+ false
55
47
  end
48
+ end
56
49
 
57
- # @see Hash
50
+ # @see Array
51
+ # :nodoc:
52
+ class Array
58
53
  # :nodoc:
59
- class Hash
60
- # :nodoc:
61
- alias blank? empty?
62
- end
54
+ alias blank? empty?
55
+ end
63
56
 
64
- # @see String
65
- class String
66
- # :nodoc:
67
- # :nodoc:
68
- BLANK_RE = /\A[[:space:]]*\z/.freeze
69
- # :nodoc:
70
- # :nodoc:
71
- ENCODED_BLANKS = Concurrent::Map.new do |map, enc|
72
- map[enc] = Regexp.new(BLANK_RE.source.encode(enc), BLANK_RE.options | Regexp::FIXEDENCODING)
73
- end
57
+ # @see Hash
58
+ # :nodoc:
59
+ class Hash
60
+ # :nodoc:
61
+ alias blank? empty?
62
+ end
74
63
 
75
- # :nodoc:
76
- def blank?
77
- # The regexp that matches blank strings is expensive. For the case of empty
78
- # strings we can speed up this method (~3.5x) with an empty? call. The
79
- # penalty for the rest of strings is marginal.
80
- empty? ||
81
- begin
82
- if RUBY_VERSION >= "2.4"
83
- BLANK_RE.match?(self)
84
- else
85
- !!BLANK_RE.match(self)
86
- end
87
- rescue Encoding::CompatibilityError
88
- if RUBY_VERSION >= "2.4"
89
- ENCODED_BLANKS[encoding].match?(self)
90
- else
91
- !!ENCODED_BLANKS[encoding].match(self)
92
- end
64
+ # @see String
65
+ class String
66
+ # :nodoc:
67
+ # :nodoc:
68
+ BLANK_RE = /\A[[:space:]]*\z/.freeze
69
+ # :nodoc:
70
+ # :nodoc:
71
+ ENCODED_BLANKS = Concurrent::Map.new do |map, enc|
72
+ map[enc] = Regexp.new(BLANK_RE.source.encode(enc), BLANK_RE.options | Regexp::FIXEDENCODING)
73
+ end
74
+
75
+ # :nodoc:
76
+ def blank?
77
+ # The regexp that matches blank strings is expensive. For the case of empty
78
+ # strings we can speed up this method (~3.5x) with an empty? call. The
79
+ # penalty for the rest of strings is marginal.
80
+ empty? ||
81
+ begin
82
+ if RUBY_VERSION >= "2.4"
83
+ BLANK_RE.match?(self)
84
+ else
85
+ !!BLANK_RE.match(self)
86
+ end
87
+ rescue Encoding::CompatibilityError
88
+ if RUBY_VERSION >= "2.4"
89
+ ENCODED_BLANKS[encoding].match?(self)
90
+ else
91
+ !!ENCODED_BLANKS[encoding].match(self)
93
92
  end
94
- end
93
+ end
95
94
  end
95
+ end
96
96
 
97
- # @see Numeric
97
+ # @see Numeric
98
+ # :nodoc:
99
+ class Numeric
98
100
  # :nodoc:
99
- class Numeric
100
- # :nodoc:
101
- def blank?
102
- false
103
- end
101
+ def blank?
102
+ false
104
103
  end
104
+ end
105
105
 
106
- # @see Time
106
+ # @see Time
107
+ # :nodoc:
108
+ class Time
107
109
  # :nodoc:
108
- class Time
109
- # :nodoc:
110
- def blank?
111
- false
112
- end
110
+ def blank?
111
+ false
113
112
  end
114
113
  end
@@ -22,7 +22,7 @@ class Symbol
22
22
  end unless method_defined?(:to_route_param)
23
23
  end
24
24
 
25
- # :nodoc:
25
+ # :nodoc:key => "value",
26
26
  # @api private
27
27
  class Hash
28
28
  # :nodoc:
@@ -9,5 +9,5 @@
9
9
  module StubRequests
10
10
  #
11
11
  # @return [String] a version string
12
- VERSION = "0.1.5"
12
+ VERSION = "0.1.6"
13
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stub_requests
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson