active_mocker 1.2.pre.3 → 1.2.pre.4
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 +5 -4
- data/lib/active_mocker/mock_template.erb +3 -2
- 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: be750c891c7a04f894123057cd32cfec4d4b45a1
|
4
|
+
data.tar.gz: 26d7c1e91f27da7686d49755e2faf9b384b0598e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dda9f9e7429e049aed8e9bdb3fa7988423d6b937c36b23bf3d6bd095977127f5e0238074212c1def697bef93aaa413506c276be31cf8100d0c955a9e14423fe4
|
7
|
+
data.tar.gz: a7da295df01ce4dd6fd58a5bb553c5f1151c64475da0ccc0caddce5439f69efd2e57ca02385b31b6a12e2e398e249cbcc12b60e37266d202d80f1ab67caf4538
|
@@ -21,11 +21,12 @@ class Generate
|
|
21
21
|
config(&block)
|
22
22
|
end
|
23
23
|
|
24
|
-
def self.mock(model_name)
|
25
|
-
load_mock(model_name)
|
24
|
+
def self.mock(model_name, force_reload: false)
|
25
|
+
load_mock(model_name, force_reload: false)
|
26
26
|
end
|
27
27
|
|
28
|
-
def self.load_mock(model_name)
|
28
|
+
def self.load_mock(model_name, force_reload: false)
|
29
|
+
Object.send(:remove_const, model_name) if class_exists? model_name if force_reload
|
29
30
|
load File.join(mock_dir, "#{model_name.tableize.singularize}_mock.rb")
|
30
31
|
"#{model_name}Mock".constantize
|
31
32
|
end
|
@@ -76,7 +77,7 @@ class Generate
|
|
76
77
|
FileUtils::mkdir_p mock_dir unless File.directory? mock_dir
|
77
78
|
File.open(File.join(mock_dir,"#{table.name.singularize}_mock.rb"), 'w').write(klass_str)
|
78
79
|
rescue
|
79
|
-
|
80
|
+
Logger_.debug "failed to load #{table_to_model_file(table.name)} model"
|
80
81
|
next
|
81
82
|
end
|
82
83
|
end
|
@@ -1,7 +1,5 @@
|
|
1
1
|
require 'active_mocker/mock_requires'
|
2
2
|
|
3
|
-
Object.send(:remove_const, '<%= class_name %>') if class_exists? '<%= class_name %>'
|
4
|
-
|
5
3
|
class <%= class_name %> < ::ActiveHash::Base
|
6
4
|
include ActiveMocker::ActiveHash::ARApi
|
7
5
|
include ActiveMocker::MockInstanceMethods
|
@@ -82,3 +80,6 @@ class <%= class_name %> < ::ActiveHash::Base
|
|
82
80
|
<% end %>
|
83
81
|
|
84
82
|
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)
|