active_mocker 1.1.3 → 1.1.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/active_record.rb +2 -0
- data/lib/active_mocker/active_record/const_missing.rb +7 -0
- data/lib/active_mocker/const_sets.rb +24 -0
- data/lib/active_mocker/model_reader.rb +2 -1
- data/lib/active_mocker/version.rb +1 -1
- data/spec/lib/active_mocker/base_spec.rb +1 -1
- data/spec/lib/active_mocker/model_reader_spec.rb +0 -2
- data/spec/lib/model.rb +3 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a3268d9fa30c6109ba4c78ab54b492d0a8ef89e
|
4
|
+
data.tar.gz: b1ba4cf8f3f36aeb5a7fd9ed2c8adeba74658a81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f3ef827652f153155be2d83947f10d256d2a7976bc12ca6fd0cc54985abe202a60ea3ce32a55b760576f8e5689e8c184d395f6c10dc4b5fb5926232085dae3a
|
7
|
+
data.tar.gz: df400dbb048cb3f4f5a5b92ea00423088156ceddf63f4c282e2a77ae07d0dcf1b8cb6a60e3be348189d0aff48c454019c0036b8deabfcb3e51f932cde6009733
|
@@ -3,6 +3,7 @@ require 'active_mocker/active_record/scope'
|
|
3
3
|
require 'active_mocker/active_record/relationships'
|
4
4
|
require 'active_mocker/active_record/unknown_class_method'
|
5
5
|
require 'active_mocker/active_record/unknown_module'
|
6
|
+
require 'active_mocker/active_record/const_missing'
|
6
7
|
|
7
8
|
module ActiveMocker
|
8
9
|
module ActiveRecord
|
@@ -11,6 +12,7 @@ module ActiveMocker
|
|
11
12
|
extend Relationships
|
12
13
|
extend UnknownClassMethod
|
13
14
|
extend UnknownModule
|
15
|
+
extend ConstMissing
|
14
16
|
end
|
15
17
|
end
|
16
18
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module ActiveMocker
|
2
|
+
|
3
|
+
class ConstSets
|
4
|
+
|
5
|
+
def initialize(string_of_consts, base_const=nil)
|
6
|
+
|
7
|
+
Object.const_set('Foo','Foo')
|
8
|
+
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.const_exists?(class_name)
|
13
|
+
klass = Module.const_get(class_name)
|
14
|
+
return klass.is_a?(Class)
|
15
|
+
rescue NameError
|
16
|
+
return false
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
|
@@ -26,10 +26,11 @@ module ActiveMocker
|
|
26
26
|
m = Module.new
|
27
27
|
m.module_eval(read_file)
|
28
28
|
rescue NameError => e
|
29
|
+
raise e
|
29
30
|
result = e.to_s.scan /::(\w*)$/ # gets the Constant name from error
|
30
31
|
const_name = result.flatten.first
|
31
32
|
Logger_.debug "ActiveMocker :: Can't can't find Constant #{const_name} from class #{model_name}..\n #{caller}"
|
32
|
-
Object.const_set(const_name,const_name)
|
33
|
+
# Object.const_set(const_name,const_name)
|
33
34
|
next
|
34
35
|
end
|
35
36
|
failure = false
|
data/spec/lib/model.rb
CHANGED
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.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dustin Zeisler
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- lib/active_hash/update.rb
|
117
117
|
- lib/active_mocker.rb
|
118
118
|
- lib/active_mocker/active_record.rb
|
119
|
+
- lib/active_mocker/active_record/const_missing.rb
|
119
120
|
- lib/active_mocker/active_record/relationships.rb
|
120
121
|
- lib/active_mocker/active_record/schema.rb
|
121
122
|
- lib/active_mocker/active_record/scope.rb
|
@@ -123,6 +124,7 @@ files:
|
|
123
124
|
- lib/active_mocker/active_record/unknown_module.rb
|
124
125
|
- lib/active_mocker/base.rb
|
125
126
|
- lib/active_mocker/config.rb
|
127
|
+
- lib/active_mocker/const_sets.rb
|
126
128
|
- lib/active_mocker/field.rb
|
127
129
|
- lib/active_mocker/logger.rb
|
128
130
|
- lib/active_mocker/model_reader.rb
|