fixation 2.3.0 → 2.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
  SHA256:
3
- metadata.gz: 151ea3c40b12fc39c767101d6a5c31594d1f4bf18db09c6185d9c0761a13390f
4
- data.tar.gz: be61abe2ac1a24349c0e20743b77c36754a786b135a4fc962be318bb0a61e4b3
3
+ metadata.gz: '08d3f0b4a0bebfaae98d5ff58865a6c2836d24a8739ab8de176cbcf752eec6fe'
4
+ data.tar.gz: 1a326185780f5fbaecff539b4e21f13f9a4ed1c245e93f2f1e38e10c1391b40e
5
5
  SHA512:
6
- metadata.gz: '076234591186bc2ecf779c89378905d43585b4b0c127f0a1f190e146c11a6b158e0d14a4860726f7cc8d49655b28ec5f8b42cd5cd27656ea0e03133329ecd137'
7
- data.tar.gz: 787a3bec0d590b865245eb2dc1b4df1e913faeb4814fa7de357019503489614722454f4e4c88d39cd459b95a1eb09f0a5c2140264dec687044cfd9b539e545fe
6
+ metadata.gz: d243dbc5164455511a2c103bccf4d90b98657b1cb5a2a2e5a965e05490e78771f0cb7d19276cef42821cd3184c040c4ea1a2db642298dd160ff77bd2bf37fd5f
7
+ data.tar.gz: 1d87ce1996a76958674f106f17f20cfe736d07d04bc907b5375ee895c34818e268d31ca9d3c2f63cd3d64101ade95c59b3e54f8c6ff3edfee29b5f585057d364
@@ -2,6 +2,12 @@ module Fixation
2
2
  class FixtureTable
3
3
  attr_reader :filename, :fixture_name, :class_name, :table_name, :connection, :loaded_at
4
4
 
5
+ def self.erb_content(filename)
6
+ template = File.read(filename)
7
+ render_context = ActiveRecord::FixtureSet::RenderContext.create_subclass.new.get_binding
8
+ ERB.new(template).result(render_context)
9
+ end
10
+
5
11
  def initialize(filename, basename, connection, loaded_at)
6
12
  @filename = filename
7
13
  @connection = connection
@@ -31,14 +37,8 @@ module Fixation
31
37
  @columns_hash ||= connection.columns(table_name).index_by(&:name)
32
38
  end
33
39
 
34
- def content
35
- template = File.read(filename)
36
- render_context = ActiveRecord::FixtureSet::RenderContext.create_subclass.new.get_binding
37
- ERB.new(template).result(render_context)
38
- end
39
-
40
40
  def parsed_rows
41
- result = YAML.load(content)
41
+ result = YAML.load(self.class.erb_content(filename))
42
42
  result ||= {} # for completely empty files
43
43
 
44
44
  unless (result.is_a?(Hash) || result.is_a?(YAML::Omap)) && result.all? { |name, attributes| name.is_a?(String) && attributes.is_a?(Hash) }
@@ -1,3 +1,3 @@
1
1
  module Fixation
2
- VERSION = "2.3.0"
2
+ VERSION = "2.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fixation
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Will Bryant
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-11 00:00:00.000000000 Z
11
+ date: 2019-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler