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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6dee4f02b727c2c89ef5d4c74de74b6fa308b1cf
4
- data.tar.gz: 4943e1fc8b417dfd2afbd4239a2d50bed8cca98f
3
+ metadata.gz: d6369f2b909f9690d9294add97ecaeb74166e64d
4
+ data.tar.gz: 57d0325c6e6f3e63d09871b8faee78c5b6c0c007
5
5
  SHA512:
6
- metadata.gz: 8a844dd82570b6c67170723113f883c0270c273bf89467b349c99141fe28b00be4bbf8093228b4dbd72f10534e400a0960bef18430a0158dfeb3e6cc8bbc9b52
7
- data.tar.gz: 44e29ca9c8da2cb8db4901bd92993ca1ab0ecd45196a29d1e79cfec05688e3c99595601cb5b41a4abab9dfa91d08d5cff0af8141710d120e604111fb486d051a
6
+ metadata.gz: fdd6ab3f988e0e279c5badebe532bc097ba0416d8d8876f427b0252318b755ef064a3ad047288e903d74c1f902e666d17fb47af4c12612110c0f3758bd8afe18
7
+ data.tar.gz: 230af5efe3fe3c0c7de30156009135aec0d93fd3f0f8c1ae83dab5e4a5e154978bcd83bb9d636747671537b0118f01cb6fb853f43803fdfec6451f17f2195431
@@ -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
@@ -1,3 +1,4 @@
1
+ module ActiveMock
1
2
  class NextId
2
3
 
3
4
  def initialize(records)
@@ -13,4 +14,5 @@ class NextId
13
14
  @max_record ||= @records.max { |a, b| a.id <=> b.id }
14
15
  end
15
16
 
17
+ end
16
18
  end
@@ -1,3 +1,4 @@
1
+ module ActiveMock
1
2
  class ObjectInspect
2
3
 
3
4
  def initialize(class_name, attributes)
@@ -36,4 +37,5 @@ class ObjectInspect
36
37
  end
37
38
  end
38
39
 
40
+ end
39
41
  end
@@ -1,3 +1,4 @@
1
+ module ActiveMock
1
2
  class Records
2
3
 
3
4
  attr_reader :records
@@ -78,4 +79,5 @@ class Records
78
79
  records.map(&:id).include?(id)
79
80
  end
80
81
 
82
+ end
81
83
  end
@@ -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
- instance_exec(*[<%= method.arguments.passable %>], &block)
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
- instance_exec(*[<%= method.arguments.passable %>], &block)
160
+ block.call(*[<%= method.arguments.passable %>])
161
161
  end
162
162
  <% end -%>
163
163
 
@@ -1,3 +1,3 @@
1
1
  module ActiveMocker
2
- VERSION = "1.4.1"
2
+ VERSION = "1.4.2"
3
3
  end
@@ -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
- instance_exec(*[], &block)
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
- instance_exec(*[user], &block)
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
- instance_exec(*[], &block)
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
- instance_exec(*[other_user], &block)
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
- instance_exec(*[other_user], &block)
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
- instance_exec(*[other_user], &block)
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
- instance_exec(*[], &block)
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
- instance_exec(*[token], &block)
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(UserMock.new.follow!("name")).to eq true
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.1
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-15 00:00:00.000000000 Z
11
+ date: 2014-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport