fixturies 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fixturies.rb +11 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0c0f13f16997f6ea9705cdcf02ecbe3df5177ca
|
4
|
+
data.tar.gz: 49464f7dda3f08ee94a64d02ac151dfea707ca9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b83a2d56b74d0b5d13c1d0cc169a255173aa24a57b3540d2751ebbe27336708825c1820299e554bf657dd4fc272cd1517a855cacd344679e2cda1049c3c4c1f
|
7
|
+
data.tar.gz: 61559265b9adde4649f1a24b5595f3a21c731395dfdfc738fdb548114f07dde7753072329e095e5e0821266e11f9a9ca8d1ae9dfe27702a15285d6413078a637
|
data/lib/fixturies.rb
CHANGED
@@ -67,6 +67,17 @@ class Fixturies
|
|
67
67
|
if record.id.nil?
|
68
68
|
raise ArgumentError.new("No id for record. Must be saved before calling identify")
|
69
69
|
end
|
70
|
+
|
71
|
+
# ensure that we are not assigning the same name to two
|
72
|
+
# different records
|
73
|
+
@records_by_name ||= {}
|
74
|
+
@records_by_name[record.class.table_name] ||= {}
|
75
|
+
existing_entry = @records_by_name[record.class.table_name][name]
|
76
|
+
if existing_entry && existing_entry != record
|
77
|
+
raise "Cannot assign the name #{name.inspect} to two different #{record.class.table_name}"
|
78
|
+
end
|
79
|
+
@records_by_name[record.class.table_name][name] = record
|
80
|
+
|
70
81
|
record_identifiers[record_key(record)] = name
|
71
82
|
end
|
72
83
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fixturies
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nate Brustein
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: The speed of fixtures meets the maintanability of factories
|
14
14
|
email: nate@pedago.com
|
@@ -27,17 +27,17 @@ require_paths:
|
|
27
27
|
- lib
|
28
28
|
required_ruby_version: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
30
|
-
- -
|
30
|
+
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '0'
|
33
33
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
34
|
requirements:
|
35
|
-
- -
|
35
|
+
- - ">="
|
36
36
|
- !ruby/object:Gem::Version
|
37
37
|
version: '0'
|
38
38
|
requirements: []
|
39
39
|
rubyforge_project:
|
40
|
-
rubygems_version: 2.
|
40
|
+
rubygems_version: 2.4.8
|
41
41
|
signing_key:
|
42
42
|
specification_version: 4
|
43
43
|
summary: The speed of fixtures meets the maintanability of factories
|