active_mocker 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_mock/base.rb +2 -2
- data/lib/active_mock/next_id.rb +2 -0
- data/lib/active_mock/object_inspect.rb +2 -0
- data/lib/active_mock/records.rb +2 -0
- data/lib/active_mocker/mock_template.erb +2 -2
- data/lib/active_mocker/version.rb +1 -1
- data/sample_app_rails_4/spec/mocks/micropost_mock.rb +2 -2
- data/sample_app_rails_4/spec/mocks/user_mock.rb +6 -6
- data/sample_app_rails_4/spec/user_mock_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6369f2b909f9690d9294add97ecaeb74166e64d
|
4
|
+
data.tar.gz: 57d0325c6e6f3e63d09871b8faee78c5b6c0c007
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdd6ab3f988e0e279c5badebe532bc097ba0416d8d8876f427b0252318b755ef064a3ad047288e903d74c1f902e666d17fb47af4c12612110c0f3758bd8afe18
|
7
|
+
data.tar.gz: 230af5efe3fe3c0c7de30156009135aec0d93fd3f0f8c1ae83dab5e4a5e154978bcd83bb9d636747671537b0118f01cb6fb853f43803fdfec6451f17f2195431
|
data/lib/active_mock/base.rb
CHANGED
@@ -150,7 +150,7 @@ class Base
|
|
150
150
|
end
|
151
151
|
|
152
152
|
def inspect
|
153
|
-
ObjectInspect.new(self.class.name, attributes)
|
153
|
+
ObjectInspect.new(self.class.name, attributes).to_s
|
154
154
|
end
|
155
155
|
|
156
156
|
def hash
|
@@ -247,4 +247,4 @@ class Base
|
|
247
247
|
include MockAbilities
|
248
248
|
|
249
249
|
end
|
250
|
-
end
|
250
|
+
end
|
data/lib/active_mock/next_id.rb
CHANGED
data/lib/active_mock/records.rb
CHANGED
@@ -150,14 +150,14 @@ class <%= class_name + @mock_append_name %> < ActiveMock::Base
|
|
150
150
|
def <%= method.name %>(<%= method.arguments %>)
|
151
151
|
block = model_instance_methods['<%= method.name %>']
|
152
152
|
self.class.is_implemented(block, '#<%= method.name %>')
|
153
|
-
|
153
|
+
block.call(*[<%= method.arguments.passable %>])
|
154
154
|
end
|
155
155
|
<% end -%>
|
156
156
|
<% class_methods.each do |method| %>
|
157
157
|
def self.<%= method.name %>(<%= method.arguments %>)
|
158
158
|
block = model_class_methods['<%= method.name %>']
|
159
159
|
is_implemented(block, '::<%= method.name %>')
|
160
|
-
|
160
|
+
block.call(*[<%= method.arguments.passable %>])
|
161
161
|
end
|
162
162
|
<% end -%>
|
163
163
|
|
@@ -135,13 +135,13 @@ class MicropostMock < ActiveMock::Base
|
|
135
135
|
def display_name()
|
136
136
|
block = model_instance_methods['display_name']
|
137
137
|
self.class.is_implemented(block, '#display_name')
|
138
|
-
|
138
|
+
block.call(*[])
|
139
139
|
end
|
140
140
|
|
141
141
|
def self.from_users_followed_by(user=nil)
|
142
142
|
block = model_class_methods['from_users_followed_by']
|
143
143
|
is_implemented(block, '::from_users_followed_by')
|
144
|
-
|
144
|
+
block.call(*[user])
|
145
145
|
end
|
146
146
|
|
147
147
|
private
|
@@ -173,37 +173,37 @@ class UserMock < ActiveMock::Base
|
|
173
173
|
def feed()
|
174
174
|
block = model_instance_methods['feed']
|
175
175
|
self.class.is_implemented(block, '#feed')
|
176
|
-
|
176
|
+
block.call(*[])
|
177
177
|
end
|
178
178
|
|
179
179
|
def following?(other_user)
|
180
180
|
block = model_instance_methods['following?']
|
181
181
|
self.class.is_implemented(block, '#following?')
|
182
|
-
|
182
|
+
block.call(*[other_user])
|
183
183
|
end
|
184
184
|
|
185
185
|
def follow!(other_user)
|
186
186
|
block = model_instance_methods['follow!']
|
187
187
|
self.class.is_implemented(block, '#follow!')
|
188
|
-
|
188
|
+
block.call(*[other_user])
|
189
189
|
end
|
190
190
|
|
191
191
|
def unfollow!(other_user)
|
192
192
|
block = model_instance_methods['unfollow!']
|
193
193
|
self.class.is_implemented(block, '#unfollow!')
|
194
|
-
|
194
|
+
block.call(*[other_user])
|
195
195
|
end
|
196
196
|
|
197
197
|
def self.new_remember_token()
|
198
198
|
block = model_class_methods['new_remember_token']
|
199
199
|
is_implemented(block, '::new_remember_token')
|
200
|
-
|
200
|
+
block.call(*[])
|
201
201
|
end
|
202
202
|
|
203
203
|
def self.digest(token)
|
204
204
|
block = model_class_methods['digest']
|
205
205
|
is_implemented(block, '::digest')
|
206
|
-
|
206
|
+
block.call(*[token])
|
207
207
|
end
|
208
208
|
|
209
209
|
private
|
@@ -90,7 +90,7 @@ describe 'UserMock' do
|
|
90
90
|
|
91
91
|
end
|
92
92
|
|
93
|
-
it 'can reference another mock' do
|
93
|
+
it 'can not reference another method within the mock' do
|
94
94
|
|
95
95
|
UserMock.mock_instance_method(:following?) do |person|
|
96
96
|
true
|
@@ -100,7 +100,7 @@ describe 'UserMock' do
|
|
100
100
|
following?(person)
|
101
101
|
end
|
102
102
|
|
103
|
-
expect
|
103
|
+
expect{UserMock.new.follow!("name") }.to raise_error
|
104
104
|
expect(UserMock.new.following?(1)).to eq true
|
105
105
|
end
|
106
106
|
|
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: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dustin Zeisler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|