has_many_polymorphic 2.0.4 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MDZhNTE2MzEzYjM0NWVkNTBiYTEwYmQ3OWViYjBjYmI2MzQ5MjM5NA==
5
- data.tar.gz: !binary |-
6
- OTBiZWEyMGU2YTY4NzMwYjdlYmY4NDc1NjdhMGFhZGRlYWRjZmIwMQ==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- NGYzMDVkYTBlZDQxNDZmMTM4ZTI5YTUzMGI0YjZhYjg4MzZiZTQzODEyMTI5
10
- ODk4YmNiMThjZWJhYzdjNDhmZjVhY2FhYzczMWNkOTAwNzgyNDlmMDgzZjg3
11
- NzNhZGQyNjA1MDgyZGJlYTdjNThiMTlmNGM3NDJiN2ZlMjY5ZGU=
12
- data.tar.gz: !binary |-
13
- ZGU4YWFlZTNhOWZlMzU2Y2EwYTkyM2FjYjgzNWIzMzdiNDNmMTdlMTA0ZmIy
14
- NWZlNzgyYWQ2NzYwZTgwYmI5NzBlMzdjZjY4NWYwYTlmM2YyYjJiMjdjMTcx
15
- NjIyZTJhOGE0ZGNmNTQ2MzU2MDFiNTRkNTg1MmVjMDMxM2IyYTI=
2
+ SHA1:
3
+ metadata.gz: 1f025bcad9a6c1eab7e3d8a7519deaf2ba6153fc
4
+ data.tar.gz: e50000fe55f8f96393430120304acefb0a3b40d6
5
+ SHA512:
6
+ metadata.gz: 82570f84a270a17f1dc3911006d7cb5d8efbd7eebf447c1c31fbf76b723846b6e497885b89bc301613a2d8de7b6680025291b3885467c1d81c814e084d0515a2
7
+ data.tar.gz: 4fc56f8d714a3dc4a2a3f8b7295526bbbc03383409d169e833d7807d6b0141732fa33ce808bc0de13223f3f802708859db2dc9b6cdab83db55ad7427a24d05a0
@@ -1,7 +1,7 @@
1
1
  module RussellEdge
2
2
  module HasManyPolymorphic
3
3
  class Engine < Rails::Engine
4
-
4
+ isolate_namespace HasManyPolymorphic
5
5
  DEFAULT_OPTIONS = {:models => %w()}
6
6
  @@options = HashWithIndifferentAccess.new(DEFAULT_OPTIONS)
7
7
 
@@ -70,7 +70,7 @@ module RussellEdge #:nodoc:
70
70
 
71
71
  #create the has_many relationship for each model
72
72
  options[:models].each do |model|
73
- has_many model.to_sym, :through => options[:through], :source => model.to_s.singularize,
73
+ has_many model, :through => options[:through], :source => model.to_s.singularize,
74
74
  :conditions => ["#{options[:through]}.#{name.to_s.singularize}_type = ?", model.to_s.classify], :dependent => :destroy
75
75
  end
76
76
 
@@ -122,7 +122,7 @@ module RussellEdge #:nodoc:
122
122
  options[:models].each do |model|
123
123
  model.to_s.classify.constantize.class_exec do
124
124
  has_many options[:through], :as => name.to_s.singularize, :dependent => :destroy
125
- has_many target_class_name.tableize.to_sym, :through => options[:through], :dependent => :destroy
125
+ has_many target_class_name.tableize, :through => options[:through], :dependent => :destroy
126
126
  end
127
127
  end
128
128
 
@@ -1,3 +1,3 @@
1
1
  module HasManyPolymorphic
2
- VERSION = '2.0.4' unless defined?(::HasManyPolymorphic::VERSION)
3
- end
2
+ VERSION = '2.0.5' unless defined?(::HasManyPolymorphic::VERSION)
3
+ end
@@ -1,55 +1,55 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "HasManyPolymorphic" do
4
- before(:all) do
5
- Zoo.create(:name => 'Zoo Lander')
6
- Bear.create(:name => 'Smokey')
7
- Bird.create(:name => 'Big Bird')
8
- Monkey.create(:name => 'George')
9
- end
10
-
11
- it "should have created the animals and zoo" do
12
- Zoo.first.name.should eq 'Zoo Lander'
13
- Monkey.find_by_name('George').name.should eq 'George'
14
- Bird.find_by_name('Big Bird').name.should eq 'Big Bird'
15
- Bear.find_by_name('Smokey').name.should eq 'Smokey'
16
- end
17
-
18
- it "should allow you to add animals to a zoo" do
19
- zoo = Zoo.first
20
- zoo.animals.count.should eq 0
21
- zoo.monkeys << Monkey.find_by_name('George')
22
- zoo.birds << Bird.find_by_name('Big Bird')
23
- zoo.bears << Bear.find_by_name('Smokey')
24
- zoo.save
25
-
26
- zoo.monkeys.count.should eq 1
27
- zoo.monkeys.first.name.should eq 'George'
28
-
29
- zoo.birds.count.should eq 1
30
- zoo.birds.first.name.should eq 'Big Bird'
31
-
32
- zoo.bears.count.should eq 1
33
- zoo.bears.first.name.should eq 'Smokey'
34
-
35
- zoo.animals.count.should eq 3
36
- end
37
-
38
- it "should allow you to get the zoo from an animal" do
39
- zoo = Zoo.first
40
-
41
- zoo.monkeys << Monkey.find_by_name('George')
42
- zoo.birds << Bird.find_by_name('Big Bird')
43
- zoo.bears << Bear.find_by_name('Smokey')
44
- zoo.save
45
-
46
- monkey = Monkey.find_by_name('George')
47
- monkey.zoos.first.id.should eq zoo.id
48
-
49
- bird = Bird.find_by_name('Big Bird')
50
- bird.zoos.first.id.should eq zoo.id
51
-
52
- bear = Bear.find_by_name('Smokey')
53
- bear.zoos.first.id.should eq zoo.id
54
- end
55
- end
4
+ before(:all) do
5
+ Zoo.create(:name => 'Zoo Lander')
6
+ Bear.create(:name => 'Smokey')
7
+ Bird.create(:name => 'Big Bird')
8
+ Monkey.create(:name => 'George')
9
+ end
10
+
11
+ it "have created the animals and zoo" do
12
+ expect(Zoo.first.name).eql?'Zoo Lander'
13
+ expect(Monkey.find_by_name('George').name).eql? 'George'
14
+ expect(Bird.find_by_name('Big Bird').name).eql? 'Big Bird'
15
+ expect(Bear.find_by_name('Smokey').name).eql? 'Smokey'
16
+ end
17
+
18
+ it "allow you to add animals to a zoo" do
19
+ zoo = Zoo.first
20
+ expect(zoo.animals.count).eql? 0
21
+ zoo.monkeys << Monkey.find_by_name('George')
22
+ zoo.birds << Bird.find_by_name('Big Bird')
23
+ zoo.bears << Bear.find_by_name('Smokey')
24
+ zoo.save
25
+
26
+ expect(zoo.monkeys.count).eql? 1
27
+ expect(zoo.monkeys.first.name).eql? 'George'
28
+
29
+ expect(zoo.birds.count).eql? 1
30
+ expect(zoo.birds.first.name).eql? 'Big Bird'
31
+
32
+ expect(zoo.bears.count).eql? 1
33
+ expect(zoo.bears.first.name).eql? 'Smokey'
34
+
35
+ expect(zoo.animals.count).eql? 3
36
+ end
37
+
38
+ it "allow you to get the zoo from an animal" do
39
+ zoo = Zoo.first
40
+
41
+ zoo.monkeys << Monkey.find_by_name('George')
42
+ zoo.birds << Bird.find_by_name('Big Bird')
43
+ zoo.bears << Bear.find_by_name('Smokey')
44
+ zoo.save
45
+
46
+ monkey = Monkey.find_by_name('George')
47
+ expect(monkey.zoos.first.id).eql? zoo.id
48
+
49
+ bird = Bird.find_by_name('Big Bird')
50
+ expect(bird.zoos.first.id).eql? zoo.id
51
+
52
+ bear = Bear.find_by_name('Smokey')
53
+ expect(bear.zoos.first.id).eql? zoo.id
54
+ end
55
+ end
metadata CHANGED
@@ -1,69 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_many_polymorphic
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Russell Holmes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-19 00:00:00.000000000 Z
11
+ date: 2017-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: test-unit
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
18
32
  - !ruby/object:Gem::Version
19
33
  version: '3.0'
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
- - - ! '>='
38
+ - - "~>"
25
39
  - !ruby/object:Gem::Version
26
40
  version: '3.0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rspec-rails
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
- - - ~>
45
+ - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: '2.7'
47
+ version: '3.6'
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - ~>
52
+ - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: '2.7'
54
+ version: '3.6'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: simplecov
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - ~>
59
+ - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: '0.5'
61
+ version: '0.15'
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - ~>
66
+ - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '0.5'
68
+ version: '0.15'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: sqlite3
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - ! '>='
73
+ - - ">="
60
74
  - !ruby/object:Gem::Version
61
75
  version: '0'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - ! '>='
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  description: Simple replacement for has_many_polymorphs
@@ -72,19 +86,19 @@ executables: []
72
86
  extensions: []
73
87
  extra_rdoc_files: []
74
88
  files:
89
+ - MIT-LICENSE
90
+ - README.md
91
+ - Rakefile
92
+ - lib/has_many_polymorphic.rb
75
93
  - lib/has_many_polymorphic/engine.rb
76
94
  - lib/has_many_polymorphic/has_many_polymorphic.rb
77
95
  - lib/has_many_polymorphic/version.rb
78
- - lib/has_many_polymorphic.rb
79
96
  - spec/db/database.yml
80
97
  - spec/db/schema.rb
81
98
  - spec/debug.log
82
99
  - spec/has_many_polymorphic_spec.rb
83
100
  - spec/spec_helper.rb
84
101
  - spec/support/models.rb
85
- - MIT-LICENSE
86
- - Rakefile
87
- - README.md
88
102
  homepage: https://github.com/russ1985/has_many_polymorphic
89
103
  licenses: []
90
104
  metadata: {}
@@ -94,17 +108,17 @@ require_paths:
94
108
  - lib
95
109
  required_ruby_version: !ruby/object:Gem::Requirement
96
110
  requirements:
97
- - - ! '>='
111
+ - - ">="
98
112
  - !ruby/object:Gem::Version
99
113
  version: '0'
100
114
  required_rubygems_version: !ruby/object:Gem::Requirement
101
115
  requirements:
102
- - - ! '>='
116
+ - - ">="
103
117
  - !ruby/object:Gem::Version
104
118
  version: '0'
105
119
  requirements: []
106
120
  rubyforge_project:
107
- rubygems_version: 2.0.7
121
+ rubygems_version: 2.4.8
108
122
  signing_key:
109
123
  specification_version: 4
110
124
  summary: Simple replacement for has_many_polymorphs