active_remote-cached 1.0.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,33 +1,31 @@
1
- require "active_support"
2
- require "active_support/cache"
3
- require "active_support/concern"
4
- require "active_support/core_ext/array/extract_options"
1
+ require 'active_support'
2
+ require 'active_support/cache'
3
+ require 'active_support/concern'
4
+ require 'active_support/core_ext/array/extract_options'
5
5
 
6
- require "active_remote/cached/argument_keys"
7
- require "active_remote/cached/cache"
8
- require "active_remote/cached/version"
9
- require "active_remote/errors"
6
+ require 'active_remote/cached/argument_keys'
7
+ require 'active_remote/cached/cache'
8
+ require 'active_remote/cached/version'
9
+ require 'active_remote/errors'
10
10
 
11
11
  module ActiveRemote
12
12
  module Cached
13
13
  extend ::ActiveSupport::Concern
14
14
 
15
- # When upgrading Rails versions, don't reuse the same cache key, because you can't rely upon the serialized objects to be consistent across versions.
16
- # To fix, this adds a cache key that caches the ruby engine version and the activesupport version to prevent cache re-use across different versions.
15
+ # When upgrading Rails versions, don't reuse the same cache key,
16
+ # because you can't rely upon the serialized objects to be consistent across versions.
17
+ # To fix, this adds a cache key that caches the ruby engine version
18
+ # and the activesupport version to prevent cache re-use across different versions.
17
19
  RUBY_AND_ACTIVE_SUPPORT_VERSION = "#{RUBY_ENGINE_VERSION}:#{ActiveSupport::VERSION::STRING}".freeze
18
20
 
19
21
  def self.cache(cache_provider = nil)
20
- if cache_provider
21
- @cache_provider = ::ActiveRemote::Cached::Cache.new(cache_provider)
22
- end
22
+ @cache_provider = ::ActiveRemote::Cached::Cache.new(cache_provider) if cache_provider
23
23
 
24
24
  @cache_provider
25
25
  end
26
26
 
27
27
  def self.default_options(options = nil)
28
- if options
29
- @default_options = options
30
- end
28
+ @default_options = options if options
31
29
 
32
30
  @default_options || {}
33
31
  end
@@ -50,27 +48,23 @@ module ActiveRemote
50
48
  cached_finders_for(*keys)
51
49
  end
52
50
 
53
- def cached_find(argument_hash, options = {})
51
+ def cached_find(argument_hash, options = {}, &block)
54
52
  method_name = _cached_find_method_name(argument_hash.keys)
55
53
  arguments = argument_hash.keys.sort.map { |k| argument_hash[k] }
56
54
 
57
55
  if block_given?
58
- __send__(method_name, *arguments, options) do
59
- yield
60
- end
56
+ __send__(method_name, *arguments, options, &block)
61
57
  else
62
58
  __send__(method_name, *arguments, options)
63
59
  end
64
60
  end
65
61
 
66
- def cached_search(argument_hash, options = {})
62
+ def cached_search(argument_hash, options = {}, &block)
67
63
  method_name = _cached_search_method_name(argument_hash.keys)
68
64
  arguments = argument_hash.keys.sort.map { |k| argument_hash[k] }
69
65
 
70
66
  if block_given?
71
- __send__(method_name, *arguments, options) do
72
- yield
73
- end
67
+ __send__(method_name, *arguments, options, &block)
74
68
  else
75
69
  __send__(method_name, *arguments, options)
76
70
  end
@@ -101,18 +95,17 @@ module ActiveRemote
101
95
  # Underscored Methods
102
96
  #
103
97
  def _method_missing_name(m)
104
- regex = /(cached_(?:delete|exist_search|search|exist_find|find)_by_)([a-zA-Z_]*)(!|\?)?/
98
+ regex = /(cached_(?:delete|exist_search|search|exist_find|find)_by_)([0-9a-zA-Z_]*)(!|\?)?/
105
99
 
106
- if m.to_s =~ regex
107
- params = $2.split("_and_")
108
- "#{$1}#{params.sort.join("_and_")}#{$3}".to_sym
109
- else
110
- nil
111
- end
100
+ return unless m.to_s =~ regex
101
+
102
+ params = ::Regexp.last_match(2).split('_and_')
103
+ "#{::Regexp.last_match(1)}#{params.sort.join('_and_')}#{::Regexp.last_match(3)}".to_sym
112
104
  end
113
105
 
106
+ # rubocop:disable Metrics/AbcSize
114
107
  def _args_in_sorted_order(m, args)
115
- regex = /cached_(?:delete|exist_search|search|exist_find|find)_by_([a-zA-Z_]*)(!|\?)?/
108
+ regex = /cached_(?:delete|exist_search|search|exist_find|find)_by_([0-9a-zA-Z_]*)(!|\?)?/
116
109
 
117
110
  method_name = _method_missing_name(m)
118
111
 
@@ -122,8 +115,8 @@ module ActiveRemote
122
115
  args_in_order = []
123
116
 
124
117
  if match_1[1] && match_2[1]
125
- orignal_args_name = match_1[1].split("_and_")
126
- args_names_in_order = match_2[1].split("_and_")
118
+ orignal_args_name = match_1[1].split('_and_')
119
+ args_names_in_order = match_2[1].split('_and_')
127
120
 
128
121
  args_names_in_order.each do |arg_name|
129
122
  index = orignal_args_name.index(arg_name)
@@ -140,9 +133,11 @@ module ActiveRemote
140
133
  args
141
134
  end
142
135
  end
136
+ # rubocop:enable Metrics/AbcSize
143
137
 
138
+ # rubocop:disable Metrics/AbcSize
144
139
  def _create_cached_finder_for(cached_finder_key, options = {})
145
- cached_finder_key_set = [ cached_finder_key ].flatten.sort
140
+ cached_finder_key_set = [cached_finder_key].flatten.sort
146
141
 
147
142
  delete_method_name = _cached_delete_method_name(cached_finder_key_set)
148
143
  exist_find_method_name = _cached_exist_find_method_name(cached_finder_key_set)
@@ -154,7 +149,7 @@ module ActiveRemote
154
149
  unless cached_methods.include?(delete_method_name)
155
150
  _define_cached_delete_method(delete_method_name, cached_finder_key_set, options)
156
151
  end
157
-
152
+
158
153
  unless cached_methods.include?(exist_find_method_name)
159
154
  _define_cached_exist_find_method(exist_find_method_name, cached_finder_key_set, options)
160
155
  end
@@ -171,10 +166,11 @@ module ActiveRemote
171
166
  _define_cached_search_bang_method(search_bang_method_name, cached_finder_key_set, options)
172
167
  end
173
168
 
174
- unless cached_methods.include?(search_method_name)
175
- _define_cached_search_method(search_method_name, cached_finder_key_set, options)
176
- end
169
+ return if cached_methods.include?(search_method_name)
170
+
171
+ _define_cached_search_method(search_method_name, cached_finder_key_set, options)
177
172
  end
173
+ # rubocop:enable Metrics/AbcSize
178
174
 
179
175
  def _cached_delete_method_name(arguments)
180
176
  "cached_delete_by_#{arguments.sort.join('_and_')}"
@@ -198,11 +194,11 @@ module ActiveRemote
198
194
 
199
195
  def _define_cached_delete_method(method_name, *method_arguments, cached_finder_options)
200
196
  method_arguments.flatten!
201
- expanded_method_args = method_arguments.join(",")
202
- sorted_method_args = method_arguments.sort.join(",")
197
+ expanded_method_args = method_arguments.join(',')
198
+ sorted_method_args = method_arguments.sort.join(',')
203
199
  cached_methods << method_name
204
200
 
205
- self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
201
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
206
202
  # def self.cached_delete_by_user_guid(user_guid, options = {})
207
203
  # ::ActiveRemote::Cached.cache.delete([name, user_guid])
208
204
  # end
@@ -233,12 +229,12 @@ module ActiveRemote
233
229
 
234
230
  def _define_cached_exist_find_method(method_name, *method_arguments, cached_finder_options)
235
231
  method_arguments.flatten!
236
- expanded_method_args = method_arguments.join(",")
237
- sorted_method_args = method_arguments.sort.join(",")
232
+ expanded_method_args = method_arguments.join(',')
233
+ sorted_method_args = method_arguments.sort.join(',')
238
234
  cached_methods << method_name
239
235
  cached_methods << "#{method_name}?"
240
236
 
241
- self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
237
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
242
238
  # def self.cached_exist_find_by_user_guid(user_guid, options = {})
243
239
  # ::ActiveRemote::Cached.cache.exist?([name, user_guid])
244
240
  # end
@@ -262,12 +258,12 @@ module ActiveRemote
262
258
 
263
259
  def _define_cached_exist_search_method(method_name, *method_arguments, cached_finder_options)
264
260
  method_arguments.flatten!
265
- expanded_method_args = method_arguments.join(",")
266
- sorted_method_args = method_arguments.sort.join(",")
261
+ expanded_method_args = method_arguments.join(',')
262
+ sorted_method_args = method_arguments.sort.join(',')
267
263
  cached_methods << method_name
268
264
  cached_methods << "#{method_name}?"
269
265
 
270
- self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
266
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
271
267
  # def self.cached_exist_search_by_user_guid(user_guid, options = {})
272
268
  # ::ActiveRemote::Cached.cache.exist?([namespace, name, "#search", user_guid])
273
269
  # end
@@ -291,16 +287,16 @@ module ActiveRemote
291
287
 
292
288
  def _define_cached_find_method(method_name, *method_arguments, cached_finder_options)
293
289
  method_arguments.flatten!
294
- expanded_method_args = method_arguments.join(",")
295
- sorted_method_args = method_arguments.sort.join(",")
290
+ expanded_method_args = method_arguments.join(',')
291
+ sorted_method_args = method_arguments.sort.join(',')
296
292
  cached_methods << method_name
297
293
 
298
- expanded_search_args = ""
294
+ expanded_search_args = ''
299
295
  method_arguments.each do |method_argument|
300
296
  expanded_search_args << ":#{method_argument} => #{method_argument},"
301
297
  end
302
298
 
303
- self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
299
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
304
300
  # def self.cached_find_by_user_guid(user_guid, options = {})
305
301
  # options = ::ActiveRemote::Cached.default_options.merge({}).merge(options)
306
302
  #
@@ -336,16 +332,16 @@ module ActiveRemote
336
332
 
337
333
  def _define_cached_search_method(method_name, *method_arguments, cached_finder_options)
338
334
  method_arguments.flatten!
339
- expanded_method_args = method_arguments.join(",")
340
- sorted_method_args = method_arguments.sort.join(",")
335
+ expanded_method_args = method_arguments.join(',')
336
+ sorted_method_args = method_arguments.sort.join(',')
341
337
  cached_methods << method_name
342
338
 
343
- expanded_search_args = ""
339
+ expanded_search_args = ''
344
340
  method_arguments.each do |method_argument|
345
341
  expanded_search_args << ":#{method_argument} => #{method_argument},"
346
342
  end
347
343
 
348
- self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
344
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
349
345
  # def self.cached_search_by_user_guid(user_guid, options = {})
350
346
  # options = ::ActiveRemote::Cached.default_options.merge({}).merge(options)
351
347
  #
@@ -385,16 +381,16 @@ module ActiveRemote
385
381
 
386
382
  def _define_cached_search_bang_method(method_name, *method_arguments, cached_finder_options)
387
383
  method_arguments.flatten!
388
- expanded_method_args = method_arguments.join(",")
389
- sorted_method_args = method_arguments.sort.join(",")
384
+ expanded_method_args = method_arguments.join(',')
385
+ sorted_method_args = method_arguments.sort.join(',')
390
386
  cached_methods << method_name
391
387
 
392
- expanded_search_args = ""
388
+ expanded_search_args = ''
393
389
  method_arguments.each do |method_argument|
394
390
  expanded_search_args << ":#{method_argument} => #{method_argument},"
395
391
  end
396
392
 
397
- self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
393
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
398
394
  # def self.cached_search_by_user_guid!(user_guid, options = {})
399
395
  # options = ::ActiveRemote::Cached.default_options.merge({}).merge(options)
400
396
  #
@@ -448,4 +444,4 @@ module ActiveRemote
448
444
  end
449
445
  end
450
446
 
451
- require "active_remote/cached/railtie" if defined?(Rails)
447
+ require 'active_remote/cached/railtie' if defined?(Rails)
@@ -1 +1,3 @@
1
- require "active_remote/cached"
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_remote/cached'
@@ -1,25 +1,27 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe ::ActiveRemote::Cached::ArgumentKeys do
4
- it "does not mutate a string by default" do
5
- ::ActiveRemote::Cached::ArgumentKeys.new("hello", {}).cache_key.must_equal("hello")
6
+ it 'does not mutate a string by default' do
7
+ expect(::ActiveRemote::Cached::ArgumentKeys.new('hello', {}).cache_key).to eq('hello')
6
8
  end
7
9
 
8
- it "returns a string of a symbol by default" do
9
- ::ActiveRemote::Cached::ArgumentKeys.new(:hello, {}).cache_key.must_equal("hello")
10
+ it 'returns a string of a symbol by default' do
11
+ expect(::ActiveRemote::Cached::ArgumentKeys.new(:hello, {}).cache_key).to eq('hello')
10
12
  end
11
13
 
12
- it "does not mutate a string with special characters by default" do
13
- ::ActiveRemote::Cached::ArgumentKeys.new("hello {}", {}).cache_key.must_equal("hello {}")
14
+ it 'does not mutate a string with special characters by default' do
15
+ expect(::ActiveRemote::Cached::ArgumentKeys.new('hello {}', {}).cache_key).to eq('hello {}')
14
16
  end
15
17
 
16
- it "removes special characters from string with special characters when :active_remote_cached_remove_characters" do
18
+ it 'removes special characters from string with special characters when :active_remote_cached_remove_characters' do
17
19
  options = { :active_remote_cached_remove_characters => true }
18
- ::ActiveRemote::Cached::ArgumentKeys.new("hello {}", options).cache_key.must_equal("hello")
20
+ expect(::ActiveRemote::Cached::ArgumentKeys.new('hello {}', options).cache_key).to eq('hello')
19
21
  end
20
22
 
21
- it "replaces special characters from string with special characters when :active_remote_cached_replace_characters" do
23
+ it 'replaces special characters from string with special characters when :active_remote_cached_replace_characters' do
22
24
  options = { :active_remote_cached_replace_characters => true }
23
- ::ActiveRemote::Cached::ArgumentKeys.new("hello {}", options).cache_key.must_equal("helloSPLBRB")
25
+ expect(::ActiveRemote::Cached::ArgumentKeys.new('hello {}', options).cache_key).to eq('helloSPLBRB')
24
26
  end
25
27
  end
@@ -1,35 +1,32 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe ::ActiveRemote::Cached::Cache do
4
- describe "API" do
5
- it "validates #delete present" do
6
+ describe 'API' do
7
+ it 'validates #delete present' do
6
8
  cache = OpenStruct.new(:write => nil, :fetch => nil, :read => nil, :exist? => nil)
7
- error = lambda { ::ActiveRemote::Cached.cache(cache) }.must_raise(RuntimeError)
8
- error.message.must_match(/respond_to.*delete/i)
9
+ expect { ::ActiveRemote::Cached.cache(cache) }.to raise_error(RuntimeError, /respond_to.*delete/i)
9
10
  end
10
11
 
11
- it "validates #exist? present" do
12
+ it 'validates #exist? present' do
12
13
  cache = OpenStruct.new(:write => nil, :delete => nil, :read => nil, :fetch => nil)
13
- error = lambda { ::ActiveRemote::Cached.cache(cache) }.must_raise(RuntimeError)
14
- error.message.must_match(/respond_to.*exist/i)
14
+ expect { ::ActiveRemote::Cached.cache(cache) }.to raise_error(RuntimeError, /respond_to.*exist/i)
15
15
  end
16
16
 
17
- it "validates #fetch present" do
17
+ it 'validates #fetch present' do
18
18
  cache = OpenStruct.new(:write => nil, :delete => nil, :read => nil, :exist? => nil)
19
- error = lambda { ::ActiveRemote::Cached.cache(cache) }.must_raise(RuntimeError)
20
- error.message.must_match(/respond_to.*fetch/i)
19
+ expect { ::ActiveRemote::Cached.cache(cache) }.to raise_error(RuntimeError, /respond_to.*fetch/i)
21
20
  end
22
21
 
23
- it "validates #read present" do
22
+ it 'validates #read present' do
24
23
  cache = OpenStruct.new(:write => nil, :delete => nil, :fetch => nil, :exist? => nil)
25
- error = lambda { ::ActiveRemote::Cached.cache(cache) }.must_raise(RuntimeError)
26
- error.message.must_match(/respond_to.*read/i)
24
+ expect { ::ActiveRemote::Cached.cache(cache) }.to raise_error(RuntimeError, /respond_to.*read/i)
27
25
  end
28
26
 
29
- it "validates #write present" do
27
+ it 'validates #write present' do
30
28
  cache = OpenStruct.new(:read => nil, :delete => nil, :fetch => nil, :exist? => nil)
31
- error = lambda { ::ActiveRemote::Cached.cache(cache)}.must_raise(RuntimeError)
32
- error.message.must_match(/respond_to.*write/i)
29
+ expect { ::ActiveRemote::Cached.cache(cache) }.to raise_error(RuntimeError, /respond_to.*write/i)
33
30
  end
34
31
  end
35
32
  end
@@ -1,45 +1,52 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  class DeleteMethodClass
4
6
  include ::ActiveRemote::Cached
5
7
 
6
- def self.find; nil; end
7
- def self.search; nil; end
8
+ def self.find
9
+ nil
10
+ end
11
+
12
+ def self.search
13
+ nil
14
+ end
8
15
 
9
16
  cached_finders_for :guid
10
17
  cached_finders_for :guid, :user_guid
11
- cached_finders_for [:user_guid, :client_guid]
12
- cached_finders_for [:derp, :user_guid, :client_guid]
18
+ cached_finders_for %i[user_guid client_guid]
19
+ cached_finders_for %i[derp user_guid client_guid]
13
20
  end
14
21
 
15
22
  describe DeleteMethodClass do
16
- describe "API" do
23
+ describe 'API' do
17
24
  it "creates 'cached_delete_by_guid'" do
18
- DeleteMethodClass.must_respond_to("cached_delete_by_guid")
25
+ expect(DeleteMethodClass).to respond_to(:cached_delete_by_guid)
19
26
  end
20
27
 
21
28
  it "creates 'cached_delete_by_user_guid'" do
22
- DeleteMethodClass.must_respond_to("cached_delete_by_user_guid")
29
+ expect(DeleteMethodClass).to respond_to(:cached_delete_by_user_guid)
23
30
  end
24
31
 
25
32
  it "creates 'cached_delete_by_user_guid_and_client_guid'" do
26
- DeleteMethodClass.must_respond_to("cached_delete_by_user_guid_and_client_guid")
33
+ expect(DeleteMethodClass).to respond_to(:cached_delete_by_user_guid_and_client_guid)
27
34
  end
28
35
 
29
36
  it "creates 'cached_delete_by_client_guid_and_user_guid'" do
30
- DeleteMethodClass.must_respond_to("cached_delete_by_client_guid_and_user_guid")
37
+ expect(DeleteMethodClass).to respond_to(:cached_delete_by_client_guid_and_user_guid)
31
38
  end
32
39
 
33
40
  it "creates 'cached_delete_by_derp_and_user_guid_and_client_guid'" do
34
- DeleteMethodClass.must_respond_to("cached_delete_by_derp_and_user_guid_and_client_guid")
41
+ expect(DeleteMethodClass).to respond_to(:cached_delete_by_derp_and_user_guid_and_client_guid)
35
42
  end
36
43
 
37
44
  it "creates 'cached_delete_by_client_guid_and_derp_and_user_guid'" do
38
- DeleteMethodClass.must_respond_to("cached_delete_by_client_guid_and_derp_and_user_guid")
45
+ expect(DeleteMethodClass).to respond_to(:cached_delete_by_client_guid_and_derp_and_user_guid)
39
46
  end
40
47
 
41
48
  it "creates 'cached_delete_by_client_guid_and_user_guid_and_derp'" do
42
- DeleteMethodClass.must_respond_to("cached_delete_by_client_guid_and_user_guid_and_derp")
49
+ expect(DeleteMethodClass).to respond_to(:cached_delete_by_client_guid_and_user_guid_and_derp)
43
50
  end
44
51
  end
45
52
  end
@@ -1,130 +1,137 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  class ExistMethodClass
4
6
  include ::ActiveRemote::Cached
5
7
 
6
- def self.find; nil; end
7
- def self.search; nil; end
8
+ def self.find
9
+ nil
10
+ end
11
+
12
+ def self.search
13
+ nil
14
+ end
8
15
 
9
16
  cached_finders_for :guid
10
17
  cached_finders_for :guid, :user_guid
11
- cached_finders_for [:user_guid, :client_guid]
12
- cached_finders_for [:derp, :user_guid, :client_guid]
18
+ cached_finders_for %i[user_guid client_guid]
19
+ cached_finders_for %i[derp user_guid client_guid]
13
20
  end
14
21
 
15
22
  describe ExistMethodClass do
16
- describe "API" do
23
+ describe 'API' do
17
24
  it "creates 'cached_exist_find_by_guid'" do
18
- ExistMethodClass.must_respond_to("cached_exist_find_by_guid")
25
+ expect(ExistMethodClass).to respond_to(:cached_exist_find_by_guid)
19
26
  end
20
27
 
21
28
  it "creates 'cached_exist_search_by_guid'" do
22
- ExistMethodClass.must_respond_to("cached_exist_search_by_guid")
29
+ expect(ExistMethodClass).to respond_to(:cached_exist_search_by_guid)
23
30
  end
24
31
 
25
32
  it "creates 'cached_exist_find_by_user_guid'" do
26
- ExistMethodClass.must_respond_to("cached_exist_find_by_user_guid")
33
+ expect(ExistMethodClass).to respond_to(:cached_exist_find_by_user_guid)
27
34
  end
28
35
 
29
36
  it "creates 'cached_exist_search_by_user_guid'" do
30
- ExistMethodClass.must_respond_to("cached_exist_search_by_user_guid")
37
+ expect(ExistMethodClass).to respond_to(:cached_exist_search_by_user_guid)
31
38
  end
32
39
 
33
40
  it "creates 'cached_exist_find_by_user_guid_and_client_guid'" do
34
- ExistMethodClass.must_respond_to("cached_exist_find_by_user_guid_and_client_guid")
41
+ expect(ExistMethodClass).to respond_to(:cached_exist_find_by_user_guid_and_client_guid)
35
42
  end
36
43
 
37
44
  it "creates 'cached_exist_search_by_user_guid_and_client_guid'" do
38
- ExistMethodClass.must_respond_to("cached_exist_search_by_user_guid_and_client_guid")
45
+ expect(ExistMethodClass).to respond_to(:cached_exist_search_by_user_guid_and_client_guid)
39
46
  end
40
47
 
41
48
  it "creates 'cached_exist_find_by_client_guid_and_user_guid'" do
42
- ExistMethodClass.must_respond_to("cached_exist_find_by_client_guid_and_user_guid")
49
+ expect(ExistMethodClass).to respond_to(:cached_exist_find_by_client_guid_and_user_guid)
43
50
  end
44
51
 
45
52
  it "creates 'cached_exist_search_by_client_guid_and_user_guid'" do
46
- ExistMethodClass.must_respond_to("cached_exist_search_by_client_guid_and_user_guid")
53
+ expect(ExistMethodClass).to respond_to(:cached_exist_search_by_client_guid_and_user_guid)
47
54
  end
48
55
 
49
56
  it "creates 'cached_exist_find_by_derp_and_user_guid_and_client_guid'" do
50
- ExistMethodClass.must_respond_to("cached_exist_find_by_derp_and_user_guid_and_client_guid")
57
+ expect(ExistMethodClass).to respond_to(:cached_exist_find_by_derp_and_user_guid_and_client_guid)
51
58
  end
52
59
 
53
60
  it "creates 'cached_exist_search_by_derp_and_user_guid_and_client_guid'" do
54
- ExistMethodClass.must_respond_to("cached_exist_search_by_derp_and_user_guid_and_client_guid")
61
+ expect(ExistMethodClass).to respond_to(:cached_exist_search_by_derp_and_user_guid_and_client_guid)
55
62
  end
56
63
 
57
64
  it "creates 'cached_exist_find_by_client_guid_and_derp_and_user_guid'" do
58
- ExistMethodClass.must_respond_to("cached_exist_find_by_client_guid_and_derp_and_user_guid")
65
+ expect(ExistMethodClass).to respond_to(:cached_exist_find_by_client_guid_and_derp_and_user_guid)
59
66
  end
60
67
 
61
68
  it "creates 'cached_exist_search_by_client_guid_and_derp_and_user_guid'" do
62
- ExistMethodClass.must_respond_to("cached_exist_search_by_client_guid_and_derp_and_user_guid")
69
+ expect(ExistMethodClass).to respond_to(:cached_exist_search_by_client_guid_and_derp_and_user_guid)
63
70
  end
64
71
 
65
72
  it "creates 'cached_exist_find_by_client_guid_and_user_guid_and_derp'" do
66
- ExistMethodClass.must_respond_to("cached_exist_find_by_client_guid_and_user_guid_and_derp")
73
+ expect(ExistMethodClass).to respond_to(:cached_exist_find_by_client_guid_and_user_guid_and_derp)
67
74
  end
68
75
 
69
76
  it "creates 'cached_exist_search_by_client_guid_and_user_guid_and_derp'" do
70
- ExistMethodClass.must_respond_to("cached_exist_search_by_client_guid_and_user_guid_and_derp")
77
+ expect(ExistMethodClass).to respond_to(:cached_exist_search_by_client_guid_and_user_guid_and_derp)
71
78
  end
72
79
 
73
80
  # ? based methods
74
81
  it "creates 'cached_exist_find_by_guid?'" do
75
- ExistMethodClass.must_respond_to("cached_exist_find_by_guid?")
82
+ expect(ExistMethodClass).to respond_to(:cached_exist_find_by_guid?)
76
83
  end
77
84
 
78
85
  it "creates 'cached_exist_search_by_guid?'" do
79
- ExistMethodClass.must_respond_to("cached_exist_search_by_guid?")
86
+ expect(ExistMethodClass).to respond_to(:cached_exist_search_by_guid?)
80
87
  end
81
88
 
82
89
  it "creates 'cached_exist_find_by_user_guid?'" do
83
- ExistMethodClass.must_respond_to("cached_exist_find_by_user_guid?")
90
+ expect(ExistMethodClass).to respond_to(:cached_exist_find_by_user_guid?)
84
91
  end
85
92
 
86
93
  it "creates 'cached_exist_search_by_user_guid?'" do
87
- ExistMethodClass.must_respond_to("cached_exist_search_by_user_guid?")
94
+ expect(ExistMethodClass).to respond_to(:cached_exist_search_by_user_guid?)
88
95
  end
89
96
 
90
97
  it "creates 'cached_exist_find_by_user_guid_and_client_guid?'" do
91
- ExistMethodClass.must_respond_to("cached_exist_find_by_user_guid_and_client_guid?")
98
+ expect(ExistMethodClass).to respond_to(:cached_exist_find_by_user_guid_and_client_guid?)
92
99
  end
93
100
 
94
101
  it "creates 'cached_exist_search_by_user_guid_and_client_guid?'" do
95
- ExistMethodClass.must_respond_to("cached_exist_search_by_user_guid_and_client_guid?")
102
+ expect(ExistMethodClass).to respond_to(:cached_exist_search_by_user_guid_and_client_guid?)
96
103
  end
97
104
 
98
105
  it "creates 'cached_exist_find_by_client_guid_and_user_guid?'" do
99
- ExistMethodClass.must_respond_to("cached_exist_find_by_client_guid_and_user_guid?")
106
+ expect(ExistMethodClass).to respond_to(:cached_exist_find_by_client_guid_and_user_guid?)
100
107
  end
101
108
 
102
109
  it "creates 'cached_exist_search_by_client_guid_and_user_guid?'" do
103
- ExistMethodClass.must_respond_to("cached_exist_search_by_client_guid_and_user_guid?")
110
+ expect(ExistMethodClass).to respond_to(:cached_exist_search_by_client_guid_and_user_guid?)
104
111
  end
105
112
 
106
113
  it "creates 'cached_exist_find_by_derp_and_user_guid_and_client_guid?'" do
107
- ExistMethodClass.must_respond_to("cached_exist_find_by_derp_and_user_guid_and_client_guid?")
114
+ expect(ExistMethodClass).to respond_to(:cached_exist_find_by_derp_and_user_guid_and_client_guid?)
108
115
  end
109
116
 
110
117
  it "creates 'cached_exist_search_by_derp_and_user_guid_and_client_guid?'" do
111
- ExistMethodClass.must_respond_to("cached_exist_search_by_derp_and_user_guid_and_client_guid?")
118
+ expect(ExistMethodClass).to respond_to(:cached_exist_search_by_derp_and_user_guid_and_client_guid?)
112
119
  end
113
120
 
114
121
  it "creates 'cached_exist_find_by_client_guid_and_derp_and_user_guid?'" do
115
- ExistMethodClass.must_respond_to("cached_exist_find_by_client_guid_and_derp_and_user_guid?")
122
+ expect(ExistMethodClass).to respond_to(:cached_exist_find_by_client_guid_and_derp_and_user_guid?)
116
123
  end
117
124
 
118
125
  it "creates 'cached_exist_search_by_client_guid_and_derp_and_user_guid?'" do
119
- ExistMethodClass.must_respond_to("cached_exist_search_by_client_guid_and_derp_and_user_guid?")
126
+ expect(ExistMethodClass).to respond_to(:cached_exist_search_by_client_guid_and_derp_and_user_guid?)
120
127
  end
121
128
 
122
129
  it "creates 'cached_exist_find_by_client_guid_and_user_guid_and_derp?'" do
123
- ExistMethodClass.must_respond_to("cached_exist_find_by_client_guid_and_user_guid_and_derp?")
130
+ expect(ExistMethodClass).to respond_to(:cached_exist_find_by_client_guid_and_user_guid_and_derp?)
124
131
  end
125
132
 
126
133
  it "creates 'cached_exist_search_by_client_guid_and_user_guid_and_derp?'" do
127
- ExistMethodClass.must_respond_to("cached_exist_search_by_client_guid_and_user_guid_and_derp?")
134
+ expect(ExistMethodClass).to respond_to(:cached_exist_search_by_client_guid_and_user_guid_and_derp?)
128
135
  end
129
136
  end
130
137
  end