fixturies 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fixturies.rb +11 -0
  3. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 02d91937e41679e4804b8d8d7d626c431e988edd
4
- data.tar.gz: d1cb12c8c6eb33db75519055c0ff31d72a33a7a4
3
+ metadata.gz: d0c0f13f16997f6ea9705cdcf02ecbe3df5177ca
4
+ data.tar.gz: 49464f7dda3f08ee94a64d02ac151dfea707ca9b
5
5
  SHA512:
6
- metadata.gz: aaa46d44632beec2b9f110974ed3eeedbb7b861786818949857db4b34a23f4239ab75960063e94c956d3faa03d05305eae6056c01ee7f4be10b82ec914af80bb
7
- data.tar.gz: d6382d8700c90d14612536b1d8ac27265193347fbb38545a14976368daf549d7eb6ea1ed8e449df0327cd0a76df71bbc326efa55d72483849caac271729e68d9
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.1
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: 2015-01-22 00:00:00.000000000 Z
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.2.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