active_mocker 0.3.1 → 0.4.0

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: 088dc755f7c69b012b24059d5dde2327b51c2ac5
4
- data.tar.gz: 056cc0f1af0680b37db122ba36a5c6406550d597
3
+ metadata.gz: efd0c09e9b3b692f45b3b44d3585075fa656c078
4
+ data.tar.gz: 1efef179992c2a8f2f85d713829e31451fc6c021
5
5
  SHA512:
6
- metadata.gz: 16e53701559ce5c97bee5cdef1a2d438bdc4b2dfe0e37fd8008046ec34d5527a224f651ef953adf098dc492d744b6467794fc2695dfc4f0c9599e41828567578
7
- data.tar.gz: e2c885e9ab6358deb98b6ae3f25ffbec50e7b189c2b05dfda687e5c97e657d4655fe45cd4209fcec83120a67e9994905e3b68c7279098afdcd97501983c49839
6
+ metadata.gz: 82951efa29250007b6fda13d228005ef03d84035df9276fb1a48bbb5e08940445bb151e59505dafc9867f79a59b2d10216a1366662b9ef4edfacc22f5a760188
7
+ data.tar.gz: 3d0324bd594d7a2d67b573b14aa61ab161bf4fff5d5eea6bae014d958f22f7f19fd65a768ef1f7db7744f5d5e794fa0852dbec3096402f5ecca23e9cba03e137
data/README.md CHANGED
@@ -49,8 +49,8 @@ Or install it yourself as:
49
49
  require 'active_mocker'
50
50
 
51
51
  ActiveMocker::Base.configure do |config|
52
- config.schema_file = 'file is being inject as string'
53
- config.model_dir = 'file is being inject as string'
52
+ config.schema_file = "#{APP_ROOT}/db/schema.rb"
53
+ config.model_dir = "#{APP_ROOT}/app/models"
54
54
  # Dependency injection
55
55
  config.schema_file_reader = schema_file
56
56
  config.model_file_reader = model_file
@@ -60,6 +60,8 @@ Or install it yourself as:
60
60
  config.model_relationships = true #default
61
61
  config.model_methods = true #default
62
62
  config.mass_assignment = true #default
63
+ # Logging
64
+ config.log_level = Logger::WARN #default
63
65
  end
64
66
 
65
67
  mocker = ActiveMocker::Base.new({schema: {path: [path to schema.rb file]},
@@ -1,16 +1,21 @@
1
1
  require "active_mocker/version"
2
2
  $:.unshift File.expand_path('../../', __FILE__)
3
- require 'string_reader'
3
+ require 'logger'
4
+ require 'active_mocker/logger'
5
+ require 'active_support/all'
4
6
  require 'active_mocker/table'
7
+ require 'active_mocker/field'
8
+ require 'file_reader'
5
9
  require 'active_mocker/config'
6
10
  require 'active_mocker/reparameterize'
7
- require 'active_mocker/field'
8
11
  require 'active_mocker/active_record'
9
12
  require 'active_mocker/model_reader'
10
13
  require 'active_mocker/schema_reader'
11
14
  require 'active_mocker/active_record/schema'
12
15
  require 'active_mocker/base'
13
- require 'active_support/all'
16
+ require 'active_mocker/active_record'
17
+ require 'active_mocker/model_reader'
18
+ require 'active_mocker/reparameterize'
14
19
  module ActiveMocker
15
20
 
16
21
  end
@@ -1,12 +1,14 @@
1
1
  $:.unshift File.expand_path('../../', __FILE__)
2
2
  require 'active_mocker/active_record/scope'
3
3
  require 'active_mocker/active_record/relationships'
4
+ require 'active_mocker/active_record/unknown_class_method'
4
5
 
5
6
  module ActiveMocker
6
7
  module ActiveRecord
7
8
  class Base
8
9
  extend Scope
9
10
  extend Relationships
11
+ extend UnknownClassMethod
10
12
  end
11
13
  end
12
14
  end
@@ -13,22 +13,22 @@ module Relationships
13
13
 
14
14
  def has_many(*args)
15
15
  @has_many ||= []
16
- @has_many.push args
16
+ @has_many.push [args.first]
17
17
  end
18
18
 
19
19
  def has_one(*args)
20
20
  @has_one ||= []
21
- @has_one.push args
21
+ @has_one.push [args.first]
22
22
  end
23
23
 
24
24
  def belongs_to(*args)
25
25
  @belongs_to ||= []
26
- @belongs_to.push args
26
+ @belongs_to.push [args.first]
27
27
  end
28
28
 
29
29
  def has_and_belongs_to_many(*args)
30
30
  @has_and_belongs_to_many ||= []
31
- @has_and_belongs_to_many.push args
31
+ @has_and_belongs_to_many.push [args.first]
32
32
  end
33
33
 
34
34
  end
@@ -0,0 +1,12 @@
1
+ module ActiveMocker
2
+
3
+ module UnknownClassMethod
4
+
5
+ def method_missing(meth, *args)
6
+ Logger_.debug "ActiveMocker ::#{meth} called from class #{self.name} is unknown and will not be available in mock."
7
+ end
8
+
9
+ end
10
+
11
+ end
12
+
@@ -1,5 +1,4 @@
1
1
  module ActiveMocker
2
-
3
2
  class Base
4
3
  extend Config
5
4
  extend Forwardable
@@ -26,6 +26,11 @@ module ActiveMocker
26
26
  model_relationships = true
27
27
  model_methods = true
28
28
  mass_assignment = true
29
+ log_level = Logger::WARN
30
+ end
31
+
32
+ def log_level=(level)
33
+ Logger_.level = level
29
34
  end
30
35
 
31
36
  end
@@ -0,0 +1,3 @@
1
+ module ActiveMocker
2
+ Logger_ = Logger.new(STDOUT)
3
+ end
@@ -1,3 +1,3 @@
1
1
  module ActiveMocker
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -1,5 +1,7 @@
1
1
  require 'rspec'
2
2
  $:.unshift File.expand_path('../../', __FILE__)
3
+ require 'logger'
4
+ require 'active_mocker/logger'
3
5
  require 'string_reader'
4
6
  require 'active_mocker/table'
5
7
  require 'active_mocker/config'
@@ -30,6 +32,8 @@ describe ActiveMocker::Base do
30
32
  config.model_relationships = true #default
31
33
  config.model_methods = true #default
32
34
  config.mass_assignment = true #default
35
+ # Logging
36
+ config.log_level = Logger::WARN #default
33
37
  end
34
38
 
35
39
  end
@@ -2,6 +2,7 @@ require 'rspec'
2
2
  $:.unshift File.expand_path('../../', __FILE__)
3
3
  require 'string_reader'
4
4
  require 'file_reader'
5
+ require 'active_mocker/logger'
5
6
  require 'active_mocker/active_record'
6
7
  require 'active_mocker/model_reader'
7
8
  require 'active_mocker/reparameterize'
@@ -121,5 +122,7 @@ describe ActiveMocker::ModelReader do
121
122
 
122
123
  end
123
124
 
125
+ describe
126
+
124
127
  end
125
128
 
@@ -1,9 +1,11 @@
1
1
  class Model < ActiveRecord::Base
2
2
 
3
- belongs_to :company
3
+ belongs_to :company, class_name: 'PlanServiceCategory'
4
4
  has_many :users
5
5
  has_one :account
6
6
  has_and_belongs_to_many :disclosure
7
+ devise :database_authenticatable, :registerable,
8
+ :recoverable, :rememberable, :trackable, :validatable
7
9
 
8
10
  def self.duper(value, *args)
9
11
 
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: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Zeisler
@@ -115,9 +115,11 @@ files:
115
115
  - lib/active_mocker/active_record/relationships.rb
116
116
  - lib/active_mocker/active_record/schema.rb
117
117
  - lib/active_mocker/active_record/scope.rb
118
+ - lib/active_mocker/active_record/unknown_class_method.rb
118
119
  - lib/active_mocker/base.rb
119
120
  - lib/active_mocker/config.rb
120
121
  - lib/active_mocker/field.rb
122
+ - lib/active_mocker/logger.rb
121
123
  - lib/active_mocker/model_reader.rb
122
124
  - lib/active_mocker/reparameterize.rb
123
125
  - lib/active_mocker/schema_reader.rb