fixation 1.1.1 → 1.2.0
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 +4 -4
- data/README.md +1 -1
- data/lib/fixation.rb +12 -12
- data/lib/fixation/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b9b89848ceefd67ecc8243402e8a739f088dc14
|
4
|
+
data.tar.gz: 782f9e638b36c56c45e74e842795da2349386936
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23a58a4aac7dcea633e894cdb79c01b830f24257e5a1ef3ef7cfc2180a5d185ac7ae93089a0bf6a3f57342beb709db07cb5f0bf0e821947ac81d641e6bab26cc
|
7
|
+
data.tar.gz: 5b97553515160b6baaca85486a0322cd75e94320e358ee4de553d7df98170c1614839e1686f65168e8db58728935198d7524c28f62fbb1a2a2eb7a041c0c59f3
|
data/README.md
CHANGED
data/lib/fixation.rb
CHANGED
@@ -192,9 +192,10 @@ module Fixation
|
|
192
192
|
|
193
193
|
def compile_fixture_file(filename, basename, connection, now)
|
194
194
|
fixture_table = FixtureTable.new(filename, basename, connection, now)
|
195
|
-
|
196
|
-
@
|
197
|
-
@
|
195
|
+
fixture_name = basename.gsub('/', '_')
|
196
|
+
@fixture_ids[fixture_name] = fixture_table.fixture_ids
|
197
|
+
@statements[fixture_name] = fixture_table.statements
|
198
|
+
@class_names[fixture_name] = fixture_table.class_name
|
198
199
|
end
|
199
200
|
|
200
201
|
def apply_fixtures(connection = ActiveRecord::Base.connection)
|
@@ -227,30 +228,29 @@ module Fixation
|
|
227
228
|
super
|
228
229
|
end
|
229
230
|
|
230
|
-
fixture_ids.each do |
|
231
|
+
fixture_ids.each do |fixture_name, fixtures|
|
231
232
|
begin
|
232
|
-
klass = class_names[
|
233
|
+
klass = class_names[fixture_name].constantize
|
233
234
|
rescue NameError
|
234
235
|
next
|
235
236
|
end
|
236
237
|
|
237
|
-
|
238
|
-
define_method(accessor_name) do |*fixture_names|
|
238
|
+
define_method(fixture_name) do |*fixture_names|
|
239
239
|
force_reload = fixture_names.pop if fixture_names.last == true || fixture_names.last == :reload
|
240
240
|
|
241
|
-
@fixture_cache[
|
241
|
+
@fixture_cache[fixture_name] ||= {}
|
242
242
|
|
243
243
|
instances = fixture_names.map do |name|
|
244
244
|
id = fixtures[name.to_s]
|
245
|
-
raise StandardError, "No fixture named '#{name}' found for fixture set '#{
|
245
|
+
raise StandardError, "No fixture named '#{name}' found for fixture set '#{fixture_name}'" if id.nil?
|
246
246
|
|
247
|
-
@fixture_cache[
|
248
|
-
@fixture_cache[
|
247
|
+
@fixture_cache[fixture_name].delete(name) if force_reload
|
248
|
+
@fixture_cache[fixture_name][name] ||= klass.find(id)
|
249
249
|
end
|
250
250
|
|
251
251
|
instances.size == 1 ? instances.first : instances
|
252
252
|
end
|
253
|
-
private
|
253
|
+
private fixture_name
|
254
254
|
end
|
255
255
|
end
|
256
256
|
end
|
data/lib/fixation/version.rb
CHANGED
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: 1.
|
4
|
+
version: 1.2.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: 2016-04-
|
11
|
+
date: 2016-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|