active_mocker 1.2.pre.8 → 1.2.pre.9
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/generate.rb +0 -8
- data/lib/active_mocker/mock_requires.rb +2 -1
- data/lib/active_mocker/mock_template.erb +1 -3
- data/lib/active_mocker/version.rb +1 -1
- data/mocks/micropost_mock.rb +1 -2
- data/mocks/relationship_mock.rb +1 -2
- data/mocks/user_mock.rb +1 -2
- data/spec/lib/active_mocker/generate_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45b9761bc197c76245e94949a8d83eef8cadda09
|
4
|
+
data.tar.gz: 83aaf699ed9bb9afe879055470a8bb1f650fd9f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9f48e3db7282327427d44d45564c3b7d32f82601130eca8abad7ae3c7d7ad57430691f2dcb4fe1a093c01dea5000ca611d2faada240d8411f0027b889dcf307
|
7
|
+
data.tar.gz: c44db1fe886afcee86a70edb21ba1d47d703331e23a1d4a2a6ac1986d588375d6b6ec4d244ff3b5449d34fe53d9e976caf9afadfb3a06a1e9cb5116b9276c878
|
@@ -25,15 +25,7 @@ class Generate
|
|
25
25
|
load_mock(model_name, force_reload: force_reload)
|
26
26
|
end
|
27
27
|
|
28
|
-
def self.class_exists?(class_name)
|
29
|
-
klass = Module.const_get(class_name)
|
30
|
-
return klass.is_a?(Class)
|
31
|
-
rescue NameError
|
32
|
-
return false
|
33
|
-
end
|
34
|
-
|
35
28
|
def self.load_mock(model_name, force_reload: false)
|
36
|
-
Object.send(:remove_const, "#{model_name}Mock") if force_reload && class_exists?("#{model_name}Mock")
|
37
29
|
load File.join(mock_dir, "#{model_name.tableize.singularize}_mock.rb")
|
38
30
|
"#{model_name}Mock".constantize
|
39
31
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'active_mocker/mock_requires'
|
2
|
+
Object.send(:remove_const, "#{model_name}Mock") if false && ActiveMocker::Generate.class_exists?("#{model_name}Mock")
|
2
3
|
|
3
4
|
class <%= class_name %> < ::ActiveHash::Base
|
4
5
|
include ActiveMocker::ActiveHash::ARApi
|
@@ -80,6 +81,3 @@ class <%= class_name %> < ::ActiveHash::Base
|
|
80
81
|
<% end %>
|
81
82
|
|
82
83
|
end
|
83
|
-
<%= class_name %>.delete_all
|
84
|
-
<%= class_name %>.instance_variable_set(:@model_instance_methods, nil)
|
85
|
-
<%= class_name %>.instance_variable_set(:@model_class_methods, nil)
|
data/mocks/micropost_mock.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'active_mocker/mock_requires'
|
2
|
-
|
3
|
-
Object.send(:remove_const, 'MicropostMock') if class_exists? 'MicropostMock'
|
2
|
+
Object.send(:remove_const, "#{model_name}Mock") if false && ActiveMocker::Generate.class_exists?("#{model_name}Mock")
|
4
3
|
|
5
4
|
class MicropostMock < ::ActiveHash::Base
|
6
5
|
include ActiveMocker::ActiveHash::ARApi
|
data/mocks/relationship_mock.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'active_mocker/mock_requires'
|
2
|
-
|
3
|
-
Object.send(:remove_const, 'RelationshipMock') if class_exists? 'RelationshipMock'
|
2
|
+
Object.send(:remove_const, "#{model_name}Mock") if false && ActiveMocker::Generate.class_exists?("#{model_name}Mock")
|
4
3
|
|
5
4
|
class RelationshipMock < ::ActiveHash::Base
|
6
5
|
include ActiveMocker::ActiveHash::ARApi
|
data/mocks/user_mock.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'active_mocker/mock_requires'
|
2
|
-
|
3
|
-
Object.send(:remove_const, 'UserMock') if class_exists? 'UserMock'
|
2
|
+
Object.send(:remove_const, "#{model_name}Mock") if false && ActiveMocker::Generate.class_exists?("#{model_name}Mock")
|
4
3
|
|
5
4
|
class UserMock < ::ActiveHash::Base
|
6
5
|
include ActiveMocker::ActiveHash::ARApi
|