active_mocker 2.2.2 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e14ca018eff8f1c0f6c575322ae1cf79d48a3c9
4
- data.tar.gz: 71fd81a8740ccd5d08a71186b096a1bef03a0b97
3
+ metadata.gz: 4daac0cc1807887b124c87e1b99c2dd18c8200f4
4
+ data.tar.gz: 055f5ad3ecbc226db9a1f922fe17ad860f8a2c6c
5
5
  SHA512:
6
- metadata.gz: 4c9e9c1b8bfd686ed562218d52f8324fd50f642ce29f105a61ea384745dcadf99d4764a18352771e1b387232d056186aba8b5bc62f5623078cba43ec86db7185
7
- data.tar.gz: 217ec8087dedb24510a5ecd6e95b2b1e1da24853b830c922292fe8f74ccdafc7c23bde72a0e788e2dfa8c6e6c559d1c094540574f521e73f3f4500af614bc152
6
+ metadata.gz: b384f744eb831ef0523a00e7dc98cf81e79338a1b669b2e97a995a05c67c40e266a7e9315f756cc34708a7939711435fa8877c9f0fa44ea929b4e8da291bbdca
7
+ data.tar.gz: 35f13e27556125d9df82dd831692a27dc5435f7312b5b716428d1daae17ab7305d44abbcf231971142c27c2439bf1d17f37a4c8aab096096ed4d055917ad9ee3
@@ -1,6 +1,18 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## 2.2.2 - 2016-06-27
5
+ ### Fix
6
+ - Constant values assigned to non sudo primitives objects causing issues. https://github.com/zeisler/active_mocker/issues/72
7
+
8
+ ## Enhancement
9
+ - Tested support for Rails RC2
10
+
11
+ ## 2.2.2 - 2016-05-05
12
+ ### Fix
13
+ - When using "active_mocker/rspec_helper" with active_mocker:true tag, subclassed mocks were not getting auto stubbed.
14
+ - colorize gem was not being required.
15
+
4
16
  ## 2.2.1 - 2016-05-03
5
17
  ### Fix
6
18
  - Remove hack for String#colorize that would cause the error: "NoMethodError: super: no superclass method `colorize' for #<String>"
data/README.md CHANGED
@@ -67,8 +67,8 @@ Or install it yourself as:
67
67
  $ gem install active_mocker
68
68
 
69
69
  ## Dependencies
70
- * Tested with Rails 4.0, 4.1, 4.2
71
- * Requires Ruby MRI >= 2.1.
70
+ * Tested with Rails 4.1, 4.2, 5.0
71
+ * Requires Ruby MRI >= 2.1.x
72
72
 
73
73
 
74
74
  ## Setup
@@ -26,4 +26,5 @@ require "active_mocker/mock/do_nothing_active_record_methods"
26
26
  require "active_mocker/mock/records"
27
27
  require "active_mocker/mock/object_inspect"
28
28
  require "active_mocker/mock/alias_attribute"
29
+ require "active_mocker/mock/unrepresentable_const_value"
29
30
  require "active_mocker/mock/base"
@@ -0,0 +1,3 @@
1
+ module ActiveMocker
2
+ UNREPRESENTABLE_CONST_VALUE = "ActiveMocker can not determine the value, if needed stub this const with a valid test value".freeze
3
+ end
@@ -145,10 +145,25 @@ module ActiveMocker
145
145
  end
146
146
 
147
147
  module ModulesConstants
148
+ require "active_mocker/mock/unrepresentable_const_value"
149
+
150
+ class Inspectable
151
+ attr_reader :inspect
152
+
153
+ def initialize(inspect)
154
+ @inspect = inspect
155
+ end
156
+ end
157
+
148
158
  def constants
149
159
  class_introspector.get_class.constants.each_with_object({}) do |v, const|
150
- c = class_introspector.get_class.const_get(v)
151
- const[v] = c unless c.class == Module || c.class == Class
160
+ c = class_introspector.get_class.const_get(v)
161
+ next if [Module, Class].include?(c.class)
162
+ if /\A#</ =~ c.inspect
163
+ const[v] = Inspectable.new("ActiveMocker::UNREPRESENTABLE_CONST_VALUE")
164
+ else
165
+ const[v] = c
166
+ end
152
167
  end
153
168
  end
154
169
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ActiveMocker
3
- VERSION = "2.2.2"
3
+ VERSION = "2.2.3"
4
4
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_mocker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Zeisler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-05 00:00:00.000000000 Z
11
+ date: 2016-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
@@ -213,6 +213,7 @@ files:
213
213
  - lib/active_mocker/mock/relation.rb
214
214
  - lib/active_mocker/mock/single_relation.rb
215
215
  - lib/active_mocker/mock/template_methods.rb
216
+ - lib/active_mocker/mock/unrepresentable_const_value.rb
216
217
  - lib/active_mocker/mock_creator.rb
217
218
  - lib/active_mocker/mock_template.erb
218
219
  - lib/active_mocker/mock_template/_associations.erb
@@ -252,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
252
253
  version: '0'
253
254
  requirements: []
254
255
  rubyforge_project:
255
- rubygems_version: 2.2.5
256
+ rubygems_version: 2.5.1
256
257
  signing_key:
257
258
  specification_version: 4
258
259
  summary: Creates mocks from Active Record models. Allows your test suite to run very