snapbot 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/snapbot/diagram/dot_generator.rb +1 -1
- data/lib/snapbot/reflector.rb +4 -2
- data/lib/snapbot/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e57537e104190501dc2c47d19b8f76a95e91dd2b7f189f2686b4159c171ad101
|
4
|
+
data.tar.gz: d8dfe6118e506a0a10ad5d8dc86c8a8ba041e3fa99253d64c2a29062026f853f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c3d84a4445afa197bafa704cb1d2ac1535b8bdf12c8a19155734af415ca03aa9bc1fa2c28ba44903ddbcfd15fea0e1bcee244bdd0d99e4aaada3c6fbbcbb0c0
|
7
|
+
data.tar.gz: 3f19483aa69878acbdf035ef05d65be3db10f0d5f0bb4a79658020b86e6ed5580f2f366b4bb204fa312d99a7f197c021b1717852be828591f5fb74bb525a4a17
|
@@ -40,7 +40,7 @@ module Snapbot
|
|
40
40
|
def collect_lets(example)
|
41
41
|
@lets_by_value = RSpec::Lets.new(example).collect.each_with_object({}) do |sym, lets_by_value|
|
42
42
|
value = example.send(sym) unless @ignore_lets.include?(sym)
|
43
|
-
lets_by_value[value] = sym if value.is_a?(
|
43
|
+
lets_by_value[value] = sym if value.is_a?(reflector.base_activerecord_class)
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
data/lib/snapbot/reflector.rb
CHANGED
@@ -5,12 +5,14 @@ require "active_record"
|
|
5
5
|
module Snapbot
|
6
6
|
# Reflect models and instances in a way that's useful for generating a diagram
|
7
7
|
class Reflector
|
8
|
-
|
8
|
+
def base_activerecord_class
|
9
|
+
defined?(ApplicationRecord) ? ApplicationRecord : ActiveRecord::Base
|
10
|
+
end
|
9
11
|
|
10
12
|
def models(only_with_records: true)
|
11
13
|
@models ||= begin
|
12
14
|
Rails.application.eager_load! if defined?(Rails)
|
13
|
-
|
15
|
+
base_activerecord_class.descendants.reject do |c|
|
14
16
|
c.to_s == "Schema" || (only_with_records && c.count.zero?)
|
15
17
|
end
|
16
18
|
end
|
data/lib/snapbot/version.rb
CHANGED