polymorphic_integer_type 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/polymorphic_integer_type/extensions.rb +1 -0
- data/lib/polymorphic_integer_type/version.rb +1 -1
- data/spec/polymorphic_integer_type_spec.rb +10 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/support/dog.rb +4 -0
- data/spec/support/migrations/2_create_animal_table.rb +1 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Y2I3YWE0OWMwZDNkZWM0MzkyZjY0NGQyNTJmMGUyZjdmY2UxYzIzNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTFkNWRmNjhiMTkwNWJmZGVhMjFkZmJiZWU5ZDQzZTRmY2ZhZGRlNg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NGVkMWNlN2Y5MmRlNzNlMmM2NTkwMTEzNTcyNGNmYTMzOTdlYmRlYjU1YTAy
|
10
|
+
MDQyOWI4YTEyNmQ4MzIzNDFhMGIzZjAxMTNkMGI1MzMzY2ZkZDUzMzNhODg5
|
11
|
+
NmE0MTBkYWJkOGE5NTdmODEwY2YwMGFjMjkwY2JiNWNhZDk4MGI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YzM1NDAzOTg5YjY5MjQyNGQ0MGU2ZDFhZDZjYWEyMmNjMjhjZTEyZGM4OTgw
|
14
|
+
N2NiZTk5Y2ZmODE0N2NjOGU2ZWJkY2JkMGRmMzc5ZWRhNzc0MjBhMTgzMjQy
|
15
|
+
Y2NlMzY5NDEzZGM0ZGNkNGYwYWQ4Y2U3Y2NlZTk1ZGQ3OTM1MjI=
|
@@ -131,5 +131,15 @@ describe PolymorphicIntegerType do
|
|
131
131
|
|
132
132
|
end
|
133
133
|
|
134
|
+
context "when the association is an STI table" do
|
135
|
+
let(:link) { Link.create(:source => source, :target => whiskey) }
|
136
|
+
let(:source) { Dog.create(:name => "Bela", :kind => "Dog", :owner => owner) }
|
137
|
+
it "should have the proper id, type and object for the source" do
|
138
|
+
expect(link.source_id).to eql source.id
|
139
|
+
expect(link.source_type).to eql "Animal"
|
140
|
+
expect(link.source).to eql source
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
134
144
|
|
135
145
|
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/dog.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polymorphic_integer_type
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle d'Oliveira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- spec/support/active_record.rb
|
117
117
|
- spec/support/animal.rb
|
118
118
|
- spec/support/configuration.rb
|
119
|
+
- spec/support/dog.rb
|
119
120
|
- spec/support/drink.rb
|
120
121
|
- spec/support/food.rb
|
121
122
|
- spec/support/link.rb
|
@@ -145,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
146
|
version: '0'
|
146
147
|
requirements: []
|
147
148
|
rubyforge_project:
|
148
|
-
rubygems_version: 2.
|
149
|
+
rubygems_version: 2.2.2
|
149
150
|
signing_key:
|
150
151
|
specification_version: 4
|
151
152
|
summary: Use integers rather than strings for the _type field
|
@@ -155,6 +156,7 @@ test_files:
|
|
155
156
|
- spec/support/active_record.rb
|
156
157
|
- spec/support/animal.rb
|
157
158
|
- spec/support/configuration.rb
|
159
|
+
- spec/support/dog.rb
|
158
160
|
- spec/support/drink.rb
|
159
161
|
- spec/support/food.rb
|
160
162
|
- spec/support/link.rb
|