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 +4 -4
- data/lib/active_mocker.rb +1 -0
- data/lib/active_mocker/mock/base.rb +10 -1
- data/lib/active_mocker/mock/compatibility/base/ar51.rb +11 -0
- data/lib/active_mocker/mock_creator.rb +1 -0
- data/lib/active_mocker/mock_creator/defined_methods.rb +1 -2
- data/lib/active_mocker/mock_creator/mock_build_version.rb +11 -0
- data/lib/active_mocker/mock_creator/scopes.rb +1 -1
- data/lib/active_mocker/mock_template.erb +1 -2
- data/lib/active_mocker/mock_template/_mock_build_version.erb +1 -0
- data/lib/active_mocker/parent_class.rb +3 -3
- data/lib/active_mocker/version.rb +2 -2
- metadata +35 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7962c909528f17e94410214241e1f587c045d05
|
4
|
+
data.tar.gz: c137fd51a8c1d7addd98b05909266dc6f2ab6946
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
@@ -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
|
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
|
-
|
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
|
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
|
51
|
-
parsed_source.
|
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.
|
3
|
+
VERSION = "2.5.1.pre"
|
4
4
|
module Mock
|
5
|
-
VERSION = "
|
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.
|
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-
|
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:
|
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:
|
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.
|
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.
|
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:
|
300
|
+
version: 1.3.1
|
274
301
|
requirements: []
|
275
302
|
rubyforge_project:
|
276
303
|
rubygems_version: 2.5.1
|