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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e3687d045557f81abe6f16cca3e7472c6786005
4
- data.tar.gz: d60e0497901f5fff8f5a07fd483c758395fcd4e0
3
+ metadata.gz: 45b9761bc197c76245e94949a8d83eef8cadda09
4
+ data.tar.gz: 83aaf699ed9bb9afe879055470a8bb1f650fd9f1
5
5
  SHA512:
6
- metadata.gz: e683ee12ff201ece1df9006fec71e79ce382390fb5f862c216abaf05b0a66eecb824d4f817c0e3f41a723b8a621d1296f91e72006eb77d3b24d650a635fdd6c1
7
- data.tar.gz: bc4b1c45bdd815e88c91247e2da4d25ed474da468b2264a140e047b5c8cd190d73094aab1eab5138e795f7b1f9e9b3cc70afe4ff2ca123d79d26dc8378ff9a63
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
@@ -2,4 +2,5 @@ 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'
5
+ require 'active_hash/ar_api'
6
+ require 'active_mocker/class_exists'
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module ActiveMocker
2
- VERSION = "1.2.pre.8"
2
+ VERSION = "1.2.pre.9"
3
3
  end
@@ -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
@@ -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
@@ -21,7 +21,7 @@ require 'active_hash/ar_api'
21
21
  require 'active_mocker/generate'
22
22
  require 'erb'
23
23
 
24
- describe ActiveMocker::Generate, pending: true do
24
+ describe ActiveMocker::Generate do
25
25
 
26
26
  before(:each) do
27
27
  spec_root = File.expand_path('../../../../', __FILE__)
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.8
4
+ version: 1.2.pre.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Zeisler