active_mocker 1.2.pre.6 → 1.2.pre.7
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 +8 -10
- data/lib/active_mocker/mock_requires.rb +1 -8
- data/lib/active_mocker/version.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: 5c5ae070a394af78e5ef29cb2aca45e533a563d9
|
4
|
+
data.tar.gz: 43bd1f13cadc658c3cd239982ec0afac2366ea27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcbb42e246ec580c8d89715e517f76a30a6f0e956442f0a10237ee57655f56d78c53c151bfe0237c791f5e0a88eb01c73939aa873368a70eaab135c4119b0a3f
|
7
|
+
data.tar.gz: f79d2dd0efc6d711f4a7f2ac797a232c5418b066a14f079884567d108aea18c131fd299bc08808b862d19f141cf7f3db5bcdaa34b2b85906494e5545ebe740ee
|
@@ -25,21 +25,19 @@ 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
|
+
|
28
35
|
def self.load_mock(model_name, force_reload: false)
|
29
|
-
Object.send(:remove_const, model_name) if class_exists?
|
36
|
+
Object.send(:remove_const, model_name) if force_reload && class_exists?(model_name)
|
30
37
|
load File.join(mock_dir, "#{model_name.tableize.singularize}_mock.rb")
|
31
38
|
"#{model_name}Mock".constantize
|
32
39
|
end
|
33
40
|
|
34
|
-
def class_exists?(class_name)
|
35
|
-
begin
|
36
|
-
klass = Module.const_get(class_name)
|
37
|
-
return klass.is_a?(Class)
|
38
|
-
rescue NameError
|
39
|
-
return false
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
41
|
def model_definition(table)
|
44
42
|
return @model_definition if @model_definition_table == table
|
45
43
|
@model_definition_table = table
|
@@ -2,11 +2,4 @@ require 'active_mocker/collection_association'
|
|
2
2
|
require 'active_mocker/mock_class_methods'
|
3
3
|
require 'active_mocker/mock_instance_methods'
|
4
4
|
require 'active_hash'
|
5
|
-
require 'active_hash/ar_api'
|
6
|
-
|
7
|
-
def class_exists?(class_name)
|
8
|
-
klass = Module.const_get(class_name)
|
9
|
-
return klass.is_a?(Class)
|
10
|
-
rescue NameError
|
11
|
-
return false
|
12
|
-
end
|
5
|
+
require 'active_hash/ar_api'
|