fixture_farm 0.2.1 → 0.2.2
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e4fa3f5f217235e3e58daee4b86bdc73ef09e4f76e734aa04febf16a426d582
|
4
|
+
data.tar.gz: f40780e8cce2ea4e2c0cbb9d59bbb7df0023c26d0641ab3c1fa5b60ddb6f9ced
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd1a5b198b030b279fa0db95d823b8b6306866cf4440438eea24d2feb8bb25d034f9e136358ad3875e7d59fce384dfce03271ceb7476262625fe5d178a6a465c
|
7
|
+
data.tar.gz: 66d3463eb28a3e77500307a6cac81ef84a0fccfa977bc3151683685d7c6f7e69f5ee629f3f4c523ff413b3740615fd40a14c8e7bc9b290c4a372699786a7bfa2
|
@@ -7,7 +7,7 @@ module FixtureFarm
|
|
7
7
|
|
8
8
|
return nil unless File.exist?(fixtures_file_path)
|
9
9
|
|
10
|
-
fixtures = YAML.load_file(fixtures_file_path, permitted_classes: [ActiveSupport::HashWithIndifferentAccess])
|
10
|
+
fixtures = YAML.load_file(fixtures_file_path, permitted_classes: [ActiveSupport::HashWithIndifferentAccess]) || {}
|
11
11
|
fixtures.keys.find do |key|
|
12
12
|
ActiveRecord::FixtureSet.identify(key) == id
|
13
13
|
end
|
@@ -157,7 +157,11 @@ module FixtureFarm
|
|
157
157
|
|
158
158
|
fixtures_file_path = model_instance.fixtures_file_path
|
159
159
|
|
160
|
-
fixtures = File.exist?(fixtures_file_path)
|
160
|
+
fixtures = if File.exist?(fixtures_file_path)
|
161
|
+
YAML.load_file(fixtures_file_path, permitted_classes: [ActiveSupport::HashWithIndifferentAccess]) || {}
|
162
|
+
else
|
163
|
+
{}
|
164
|
+
end
|
161
165
|
fixtures[new_fixture_name] = yaml_attributes
|
162
166
|
|
163
167
|
FileUtils.mkdir_p(fixtures_file_path.dirname)
|
data/lib/fixture_farm/version.rb
CHANGED