active_mocker 1.1.10 → 1.1.11

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: 7bb54273c96a7bc0bd3734d3193ec1993f6a6336
4
- data.tar.gz: abf486f0dc2c983059a4a2a82eac5061b333430a
3
+ metadata.gz: 461b70e002570b08fb40fd4f3bbfeeedaac59672
4
+ data.tar.gz: c1a570d233029b13813e61ba849b388edc417183
5
5
  SHA512:
6
- metadata.gz: 36401322a2d363a592d8c3cfa6fc7b322765103680b02a0e14e2391bfa0dc70deca69cf247d2ff2cd673c12dd01d119996d69711599af8e555996f41ca0c3859
7
- data.tar.gz: 17c97729cfe75f2a46ec1bb97f4a751e67a9dd8b12bc8462922f2b549d87a273cf135c20ae22d2b325de67e308c039ea6da97b278fe16b8423a545b1bf6c7d5a
6
+ metadata.gz: 80063db1732dec862301ce306b77a63b8097cb27f1b23d07d9c11ad25532b31c24f17ba5054410ec50b6fbd0677684bc91337a206b2045bf56cf981183efd171
7
+ data.tar.gz: d336a09d187f76d1eec2fc3220cd277e5da941649bd378ad14e253b2be826b95f1ff5a317c0fce1edf1a17bd5b6c8ae80e8adff41b9232a14cd42745e56599b1
@@ -18,23 +18,24 @@ module ActiveMocker
18
18
  end
19
19
 
20
20
  def self.add_to_cache(table)
21
- @@tables_cache ||= []
22
- @@tables_cache << table unless table.nil?
21
+ @tables_cache ||= []
22
+ @tables_cache << table unless table.nil?
23
23
  end
24
24
 
25
25
  def self.search_cache(table_name)
26
- @@tables_cache ||= []
27
- @@tables_cache.find do |h|
26
+ @tables_cache ||= []
27
+ @tables_cache.find do |h|
28
28
  h.name == table_name
29
29
  end
30
30
  end
31
31
 
32
32
  def self.clear_cache
33
- @@tables_cache = []
33
+ @tables_cache = []
34
34
  end
35
35
 
36
36
  def self.search(table_name)
37
37
  @table_search = table_name
38
+ search_cache(table_name)
38
39
  end
39
40
 
40
41
  end
@@ -13,7 +13,7 @@ module ActiveMocker
13
13
  def search(model_name)
14
14
  @model_name = model_name
15
15
  @table = search_schema_file
16
- @table.fields.unshift Field.new('id', :integer, {})
16
+ @table
17
17
  @table
18
18
  end
19
19
 
@@ -23,16 +23,13 @@ module ActiveMocker
23
23
  model_name
24
24
  end
25
25
 
26
- def not_found
27
- raise "#{table_name} table not found." if @schema_result.nil?
28
- end
29
-
30
26
  def search_schema_file
31
27
  ActiveMocker::ActiveRecord::Schema.clear_cache if clear_cache
32
- ActiveMocker::ActiveRecord::Schema.search(table_name)
33
- @schema_result = eval_file
34
- not_found
35
- @schema_result
28
+ search_result = ActiveMocker::ActiveRecord::Schema.search(table_name)
29
+ return search_result if search_result
30
+ schema_result = eval_file
31
+ raise "#{table_name} table not found." if schema_result.nil?
32
+ schema_result
36
33
  end
37
34
 
38
35
  def eval_file
@@ -7,6 +7,7 @@ module ActiveMocker
7
7
  def initialize(name, fields=[])
8
8
  @name = name
9
9
  @fields = fields
10
+ fields.unshift Field.new('id', :integer, {})
10
11
  end
11
12
 
12
13
  def to_h
@@ -1,3 +1,3 @@
1
1
  module ActiveMocker
2
- VERSION = "1.1.10"
2
+ VERSION = "1.1.11"
3
3
  end
@@ -57,7 +57,7 @@ describe ActiveMocker::SchemaReader do
57
57
 
58
58
  context 'inject string_reader as file_reader' do
59
59
 
60
- let(:subject){described_class.new({schema_file:nil, file_reader: example_schema})}
60
+ let(:subject){described_class.new({schema_file:nil, file_reader: example_schema, clear_cache: true})}
61
61
 
62
62
  let(:search){subject.search('people')}
63
63
 
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.10
4
+ version: 1.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Zeisler