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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd140facc45978c16690d5960e7163d87d943355
4
- data.tar.gz: 22f4b8e3387f8eef35af328d062dac4c84f67807
3
+ metadata.gz: be750c891c7a04f894123057cd32cfec4d4b45a1
4
+ data.tar.gz: 26d7c1e91f27da7686d49755e2faf9b384b0598e
5
5
  SHA512:
6
- metadata.gz: ad5d6e76d2c5fae2a38f595c4a15bee4de97d04755833f58f3f7f7af11a409cafe8d79d213f1e7bbd2a0357102477dbed034d34fb37ba1fe760f4bfc9a8a278e
7
- data.tar.gz: e50c7525cc7e49a6a968800123675e5d72ee0e4f822fe3904cbd57ee23e5412ebe27c555127f672be33063945a999e3b13fbd9d44997d250b58c2a101a586362
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
- puts "failed to load #{table_to_model_file(table.name)} model"
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)
@@ -1,3 +1,3 @@
1
1
  module ActiveMocker
2
- VERSION = "1.2.pre.3"
2
+ VERSION = "1.2.pre.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_mocker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.pre.3
4
+ version: 1.2.pre.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Zeisler