active_mocker 2.5.0 → 2.5.1.pre

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: 9471f85889f657625b27471d107dacf1f2a1e356
4
- data.tar.gz: 36ca7ce095b75166f8148a11a39ab8f0ce502dd1
3
+ metadata.gz: a7962c909528f17e94410214241e1f587c045d05
4
+ data.tar.gz: c137fd51a8c1d7addd98b05909266dc6f2ab6946
5
5
  SHA512:
6
- metadata.gz: 7cf121a9c56ed305c01c1b5445cb855f95e807f8475f1993e6f6e664da8b1cbfa9c648c553476aa1cca7bcc2ae6bd7e9277d13d6388ceec4379e21f8aed3f09a
7
- data.tar.gz: f9d5c52020ae381bab78685780d0eeefa784de91348643196e5f5053539b0e7d59679e1c786372e1e6d0058b275dcb83f7d652c48f29adf97805692fc210dae2
6
+ metadata.gz: f56e50145e6ce4f414a5c7e3cf80957d845ddda72eb1b248af08d98c7a377734850852b12e837dc666554d24001b3806871e54a19c133fbd7b09aad4482f61dd
7
+ data.tar.gz: ce774fc0e3c8259881c5b2b356e7238355c01d749204d179d222b3b28d719be1ee624c50e2c881f2df97b60efb4b897af18d9b9721588eced4052c642b48c2d8
data/lib/active_mocker.rb CHANGED
@@ -32,6 +32,7 @@ require "active_mocker/mock_creator/defined_methods"
32
32
  require "active_mocker/mock_creator/modules_constants"
33
33
  require "active_mocker/mock_creator/recreate_class_method_calls"
34
34
  require "active_mocker/mock_creator/scopes"
35
+ require "active_mocker/mock_creator/mock_build_version"
35
36
  require "active_mocker/error_object"
36
37
  require "active_mocker/display_errors"
37
38
  require "active_mocker/generate"
@@ -141,9 +141,18 @@ module ActiveMocker
141
141
  associations.each_with_object({}) { |(k, _), h| h[k.to_s] = nil }
142
142
  end
143
143
 
144
+ def __active_record_build_version__
145
+ @active_record_build_version
146
+ end
147
+
144
148
  private
145
149
 
146
- def mock_build_version(version)
150
+ def mock_build_version(version, active_record: nil)
151
+ @active_record_build_version = Gem::Version.create(active_record)
152
+ if __active_record_build_version__ >= Gem::Version.create("5.1")
153
+ require "active_mocker/mock/compatibility/base/ar51"
154
+ extend AR51
155
+ end
147
156
  raise UpdateMocksError.new(name, version, ActiveMocker::Mock::VERSION) if version != ActiveMocker::Mock::VERSION
148
157
  end
149
158
 
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: tru
2
+
3
+ module ActiveMocker
4
+ class Base
5
+ module AR51
6
+ def delete_all
7
+ super
8
+ end
9
+ end
10
+ end
11
+ end
@@ -5,6 +5,7 @@ module ActiveMocker
5
5
  class MockCreator
6
6
  using ActiveMocker::Inspectable
7
7
  ENABLED_PARTIALS_DEFAULT = [
8
+ :mock_build_version,
8
9
  :modules_constants,
9
10
  :class_methods,
10
11
  :attributes,
@@ -36,8 +36,7 @@ module ActiveMocker
36
36
  Method.new(
37
37
  m,
38
38
  ReverseParameters.new(
39
- class_introspector.get_class.send(type, m).parameters,
40
- blocks_as_values: true
39
+ class_introspector.get_class.send(type, m).parameters
41
40
  ).parameters,
42
41
  "call_mock_method(method: __method__, caller: Kernel.caller, arguments: [])"
43
42
  )
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveMocker
4
+ class MockCreator
5
+ module MockBuildVersion
6
+ def mock_build_version
7
+ "mock_build_version #{ActiveMocker::Mock::VERSION.inspect}, active_record: '#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}'"
8
+ end
9
+ end
10
+ end
11
+ end
@@ -9,7 +9,7 @@ module ActiveMocker
9
9
  def scope_methods
10
10
  class_introspector.class_macros.select { |h| h.keys.first == :scope }.map do |h|
11
11
  name, args = h.values.first.first
12
- arguments = ReverseParameters.new(args, blocks_as_values: true)
12
+ arguments = ReverseParameters.new(args)
13
13
  body = scope_body(arguments, name)
14
14
  Method.new(name, arguments, body)
15
15
  end
@@ -2,8 +2,7 @@ require 'active_mocker/mock'
2
2
 
3
3
  class <%= class_name + mock_append_name %> < <%= parent_class_inspector.parent_mock_name %>
4
4
 
5
- mock_build_version('<%= ActiveMocker::Mock::VERSION %>')
6
-
5
+ <%= partials.mock_build_version %>
7
6
  <%= partials.modules_constants %>
8
7
  <%= partials.class_methods %>
9
8
  <%= partials.attributes %>
@@ -0,0 +1 @@
1
+ <%= mock_build_version %>
@@ -11,7 +11,7 @@ module ActiveMocker
11
11
  attr_reader :error
12
12
 
13
13
  def call
14
- if has_parent_class?
14
+ if parent_class?
15
15
  deal_with_parent
16
16
  else
17
17
  create_error("#{class_name} is missing a parent class.")
@@ -47,8 +47,8 @@ module ActiveMocker
47
47
  message: message)
48
48
  end
49
49
 
50
- def has_parent_class?
51
- parsed_source.has_parent_class?
50
+ def parent_class?
51
+ parsed_source.parent_class?
52
52
  end
53
53
 
54
54
  def parent_class_name
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  module ActiveMocker
3
- VERSION = "2.5.0"
3
+ VERSION = "2.5.1.pre"
4
4
  module Mock
5
- VERSION = "1" # This increments when breaking changes happen in the generated mocks
5
+ VERSION = "2" # This increments when breaking changes happen in the generated mocks
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_mocker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.5.1.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Zeisler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-17 00:00:00.000000000 Z
11
+ date: 2017-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -59,6 +59,9 @@ dependencies:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0.7'
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0.7'
62
65
  type: :runtime
63
66
  prerelease: false
64
67
  version_requirements: !ruby/object:Gem::Requirement
@@ -66,6 +69,9 @@ dependencies:
66
69
  - - "~>"
67
70
  - !ruby/object:Gem::Version
68
71
  version: '0.7'
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0.7'
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: rake
71
77
  requirement: !ruby/object:Gem::Requirement
@@ -86,19 +92,28 @@ dependencies:
86
92
  requirements:
87
93
  - - "~>"
88
94
  - !ruby/object:Gem::Version
89
- version: 0.4.0
95
+ version: '1.1'
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: 1.1.1
90
99
  type: :runtime
91
100
  prerelease: false
92
101
  version_requirements: !ruby/object:Gem::Requirement
93
102
  requirements:
94
103
  - - "~>"
95
104
  - !ruby/object:Gem::Version
96
- version: 0.4.0
105
+ version: '1.1'
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: 1.1.1
97
109
  - !ruby/object:Gem::Dependency
98
110
  name: active_record_schema_scrapper
99
111
  requirement: !ruby/object:Gem::Requirement
100
112
  requirements:
101
113
  - - "~>"
114
+ - !ruby/object:Gem::Version
115
+ version: '0.6'
116
+ - - ">="
102
117
  - !ruby/object:Gem::Version
103
118
  version: 0.6.0
104
119
  type: :runtime
@@ -106,6 +121,9 @@ dependencies:
106
121
  version_requirements: !ruby/object:Gem::Requirement
107
122
  requirements:
108
123
  - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '0.6'
126
+ - - ">="
109
127
  - !ruby/object:Gem::Version
110
128
  version: 0.6.0
111
129
  - !ruby/object:Gem::Dependency
@@ -114,14 +132,20 @@ dependencies:
114
132
  requirements:
115
133
  - - "~>"
116
134
  - !ruby/object:Gem::Version
117
- version: 0.7.1
135
+ version: '0.8'
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 0.8.2
118
139
  type: :runtime
119
140
  prerelease: false
120
141
  version_requirements: !ruby/object:Gem::Requirement
121
142
  requirements:
122
143
  - - "~>"
123
144
  - !ruby/object:Gem::Version
124
- version: 0.7.1
145
+ version: '0.8'
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ version: 0.8.2
125
149
  - !ruby/object:Gem::Dependency
126
150
  name: bundler
127
151
  requirement: !ruby/object:Gem::Requirement
@@ -212,6 +236,7 @@ files:
212
236
  - lib/active_mocker/mock/base.rb
213
237
  - lib/active_mocker/mock/belongs_to.rb
214
238
  - lib/active_mocker/mock/collection.rb
239
+ - lib/active_mocker/mock/compatibility/base/ar51.rb
215
240
  - lib/active_mocker/mock/do_nothing_active_record_methods.rb
216
241
  - lib/active_mocker/mock/exceptions.rb
217
242
  - lib/active_mocker/mock/has_and_belongs_to_many.rb
@@ -231,6 +256,7 @@ files:
231
256
  - lib/active_mocker/mock_creator/attributes.rb
232
257
  - lib/active_mocker/mock_creator/class_methods.rb
233
258
  - lib/active_mocker/mock_creator/defined_methods.rb
259
+ - lib/active_mocker/mock_creator/mock_build_version.rb
234
260
  - lib/active_mocker/mock_creator/modules_constants.rb
235
261
  - lib/active_mocker/mock_creator/recreate_class_method_calls.rb
236
262
  - lib/active_mocker/mock_creator/safe_methods.rb
@@ -240,6 +266,7 @@ files:
240
266
  - lib/active_mocker/mock_template/_attributes.erb
241
267
  - lib/active_mocker/mock_template/_class_methods.erb
242
268
  - lib/active_mocker/mock_template/_defined_methods.erb
269
+ - lib/active_mocker/mock_template/_mock_build_version.erb
243
270
  - lib/active_mocker/mock_template/_modules_constants.erb
244
271
  - lib/active_mocker/mock_template/_recreate_class_method_calls.erb
245
272
  - lib/active_mocker/mock_template/_scopes.erb
@@ -268,9 +295,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
268
295
  version: '2.1'
269
296
  required_rubygems_version: !ruby/object:Gem::Requirement
270
297
  requirements:
271
- - - ">="
298
+ - - ">"
272
299
  - !ruby/object:Gem::Version
273
- version: '0'
300
+ version: 1.3.1
274
301
  requirements: []
275
302
  rubyforge_project:
276
303
  rubygems_version: 2.5.1