m2m_fast_insert 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 88cc29cf46fc6b132382cef73f80a838acf590c1
4
+ data.tar.gz: 5b02bcd3776e2c7f20fcc4ec763614f306f314c8
5
+ SHA512:
6
+ metadata.gz: 08c0b19bd37edbc50374241d3ef3131513fd88dc0667c156e27055f39fd39158be79a0fd9ff6e386e3a735cff1f2df38f1aa0e16696607bfc0ff50482d142da4
7
+ data.tar.gz: cea1737b0b637ede9126770d2fededee51b79d00a5ae9a791c0fe0789964e134f393d3e54d1e382df07126f542f0a796daf4230d355b9f8f5c53b91323b5cef4
data/.gitignore CHANGED
@@ -5,3 +5,5 @@ spec/dummy/db/*.sqlite3
5
5
  spec/dummy/log/*.log
6
6
  spec/dummy/tmp/
7
7
  spec/dummy/.sass-cache
8
+ coverage/
9
+ Gemfile.lock
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.2.4
data/.travis.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.2
4
- - 1.9.3
3
+ - 2.1.10
4
+ - 2.2.5
5
5
  # uncomment this line if your project needs to run something other than `rake`:
6
6
  # script: bundle exec rspec spec
@@ -1,20 +1,11 @@
1
1
  module M2MFastInsert
2
2
  module HasAndBelongsToManyOverride
3
- extend ActiveSupport::Concern
4
- included do
5
- class_eval do
6
- # Create Method chain if habtm is defined - This is because it goes down to AR::Base
7
- # and errors because at the time of inclusion, there is none defined
8
- alias_method_chain :has_and_belongs_to_many, :fast_inserts if self.method_defined? :has_and_belongs_to_many
9
- end
10
- end
11
-
12
- # Rig the original habtm to call our method definition
3
+ # Decorate the original habtm to call our method definition
13
4
  #
14
5
  # name - Plural name of the model we're associating with
15
6
  # options - see ActiveRecord docs
16
- def has_and_belongs_to_many_with_fast_inserts(name, options = {})
17
- has_and_belongs_to_many_without_fast_inserts(name, options)
7
+ def has_and_belongs_to_many(name, options = {})
8
+ super
18
9
  define_fast_methods_for_model(name, options)
19
10
  end
20
11
 
@@ -35,4 +26,5 @@ module M2MFastInsert
35
26
  end
36
27
  end
37
28
  end
38
- ActiveRecord::Associations::ClassMethods.send :include, M2MFastInsert::HasAndBelongsToManyOverride
29
+
30
+ ActiveRecord::Base.send :extend, M2MFastInsert::HasAndBelongsToManyOverride
@@ -1,3 +1,3 @@
1
1
  module M2MFastInsert
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -13,6 +13,7 @@ Gem::Specification.new do |s|
13
13
  s.homepage = ""
14
14
  s.summary = %q{Fast Inserts for Rails Many to Many relations}
15
15
  s.description = %q{}
16
+ s.license = "MIT"
16
17
 
17
18
  s.rubyforge_project = "m2m_fast_insert"
18
19
 
@@ -28,4 +29,5 @@ Gem::Specification.new do |s|
28
29
  s.add_development_dependency "rake"
29
30
  s.add_development_dependency "rspec-rails"
30
31
  s.add_development_dependency "sqlite3"
32
+ s.add_development_dependency "simplecov"
31
33
  end
@@ -32,7 +32,7 @@ module M2MFastInsert
32
32
  end
33
33
 
34
34
  it "executes SQL" do
35
- ActiveRecord::Base.connection.should_receive(:execute).with(subject.sql)
35
+ expect(ActiveRecord::Base.connection).to receive(:execute).with(subject.sql)
36
36
  subject.fast_insert
37
37
  end
38
38
  end
@@ -46,7 +46,7 @@ module M2MFastInsert
46
46
  end
47
47
 
48
48
  it "doesn't execute with an empty id list" do
49
- ActiveRecord::Base.connection.should_not_receive(:execute)
49
+ expect(ActiveRecord::Base.connection).to_not receive(:execute)
50
50
  Base.new(id, join_column_name, table_name, join_table, []).fast_insert
51
51
  end
52
52
  end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'simplecov'
2
+ SimpleCov.start
1
3
  RSpec.configure do |config|
2
4
  config.requires = %w[m2m_fast_insert sqlite3]
3
5
 
@@ -7,8 +9,8 @@ RSpec.configure do |config|
7
9
  # in spec/support/ and its subdirectories.
8
10
  Dir.glob(File.expand_path('../support/**/*.rb', __FILE__)).each { |file| require file }
9
11
 
10
- config.treat_symbols_as_metadata_keys_with_true_values = true
11
12
  config.run_all_when_everything_filtered = true
12
13
  config.filter_run :focus
13
14
  config.color = true
15
+ config.expect_with(:rspec) { |c| c.syntax = [:should, :expect] }
14
16
  end
metadata CHANGED
@@ -1,128 +1,129 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: m2m_fast_insert
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
5
- prerelease:
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jon Phenow
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-11-13 00:00:00.000000000 Z
11
+ date: 2016-05-12 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: 3.0.0
22
- - - <
20
+ - - "<"
23
21
  - !ruby/object:Gem::Version
24
22
  version: 4.0.0
25
23
  type: :runtime
26
24
  prerelease: false
27
25
  version_requirements: !ruby/object:Gem::Requirement
28
- none: false
29
26
  requirements:
30
- - - ! '>='
27
+ - - ">="
31
28
  - !ruby/object:Gem::Version
32
29
  version: 3.0.0
33
- - - <
30
+ - - "<"
34
31
  - !ruby/object:Gem::Version
35
32
  version: 4.0.0
36
33
  - !ruby/object:Gem::Dependency
37
34
  name: activerecord
38
35
  requirement: !ruby/object:Gem::Requirement
39
- none: false
40
36
  requirements:
41
- - - ! '>='
37
+ - - ">="
42
38
  - !ruby/object:Gem::Version
43
39
  version: 3.0.0
44
- - - <
40
+ - - "<"
45
41
  - !ruby/object:Gem::Version
46
42
  version: 4.0.0
47
43
  type: :runtime
48
44
  prerelease: false
49
45
  version_requirements: !ruby/object:Gem::Requirement
50
- none: false
51
46
  requirements:
52
- - - ! '>='
47
+ - - ">="
53
48
  - !ruby/object:Gem::Version
54
49
  version: 3.0.0
55
- - - <
50
+ - - "<"
56
51
  - !ruby/object:Gem::Version
57
52
  version: 4.0.0
58
53
  - !ruby/object:Gem::Dependency
59
54
  name: activesupport
60
55
  requirement: !ruby/object:Gem::Requirement
61
- none: false
62
56
  requirements:
63
- - - ! '>='
57
+ - - ">="
64
58
  - !ruby/object:Gem::Version
65
59
  version: 3.0.0
66
- - - <
60
+ - - "<"
67
61
  - !ruby/object:Gem::Version
68
62
  version: 4.0.0
69
63
  type: :runtime
70
64
  prerelease: false
71
65
  version_requirements: !ruby/object:Gem::Requirement
72
- none: false
73
66
  requirements:
74
- - - ! '>='
67
+ - - ">="
75
68
  - !ruby/object:Gem::Version
76
69
  version: 3.0.0
77
- - - <
70
+ - - "<"
78
71
  - !ruby/object:Gem::Version
79
72
  version: 4.0.0
80
73
  - !ruby/object:Gem::Dependency
81
74
  name: rake
82
75
  requirement: !ruby/object:Gem::Requirement
83
- none: false
84
76
  requirements:
85
- - - ! '>='
77
+ - - ">="
86
78
  - !ruby/object:Gem::Version
87
79
  version: '0'
88
80
  type: :development
89
81
  prerelease: false
90
82
  version_requirements: !ruby/object:Gem::Requirement
91
- none: false
92
83
  requirements:
93
- - - ! '>='
84
+ - - ">="
94
85
  - !ruby/object:Gem::Version
95
86
  version: '0'
96
87
  - !ruby/object:Gem::Dependency
97
88
  name: rspec-rails
98
89
  requirement: !ruby/object:Gem::Requirement
99
- none: false
100
90
  requirements:
101
- - - ! '>='
91
+ - - ">="
102
92
  - !ruby/object:Gem::Version
103
93
  version: '0'
104
94
  type: :development
105
95
  prerelease: false
106
96
  version_requirements: !ruby/object:Gem::Requirement
107
- none: false
108
97
  requirements:
109
- - - ! '>='
98
+ - - ">="
110
99
  - !ruby/object:Gem::Version
111
100
  version: '0'
112
101
  - !ruby/object:Gem::Dependency
113
102
  name: sqlite3
114
103
  requirement: !ruby/object:Gem::Requirement
115
- none: false
116
104
  requirements:
117
- - - ! '>='
105
+ - - ">="
118
106
  - !ruby/object:Gem::Version
119
107
  version: '0'
120
108
  type: :development
121
109
  prerelease: false
122
110
  version_requirements: !ruby/object:Gem::Requirement
123
- none: false
124
111
  requirements:
125
- - - ! '>='
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ - !ruby/object:Gem::Dependency
116
+ name: simplecov
117
+ requirement: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ type: :development
123
+ prerelease: false
124
+ version_requirements: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
126
127
  - !ruby/object:Gem::Version
127
128
  version: '0'
128
129
  description: ''
@@ -132,12 +133,11 @@ executables: []
132
133
  extensions: []
133
134
  extra_rdoc_files: []
134
135
  files:
135
- - .gitignore
136
- - .rspec
137
- - .rvmrc
138
- - .travis.yml
136
+ - ".gitignore"
137
+ - ".rspec"
138
+ - ".ruby-version"
139
+ - ".travis.yml"
139
140
  - Gemfile
140
- - Gemfile.lock
141
141
  - MIT-LICENSE
142
142
  - README.markdown
143
143
  - Rakefile
@@ -153,34 +153,28 @@ files:
153
153
  - spec/spec_helper.rb
154
154
  - spec/support/test_model.rb
155
155
  homepage: ''
156
- licenses: []
156
+ licenses:
157
+ - MIT
158
+ metadata: {}
157
159
  post_install_message:
158
160
  rdoc_options: []
159
161
  require_paths:
160
162
  - lib
161
163
  required_ruby_version: !ruby/object:Gem::Requirement
162
- none: false
163
164
  requirements:
164
- - - ! '>='
165
+ - - ">="
165
166
  - !ruby/object:Gem::Version
166
167
  version: '0'
167
- segments:
168
- - 0
169
- hash: -1663646844121288765
170
168
  required_rubygems_version: !ruby/object:Gem::Requirement
171
- none: false
172
169
  requirements:
173
- - - ! '>='
170
+ - - ">="
174
171
  - !ruby/object:Gem::Version
175
172
  version: '0'
176
- segments:
177
- - 0
178
- hash: -1663646844121288765
179
173
  requirements: []
180
174
  rubyforge_project: m2m_fast_insert
181
- rubygems_version: 1.8.24
175
+ rubygems_version: 2.4.8
182
176
  signing_key:
183
- specification_version: 3
177
+ specification_version: 4
184
178
  summary: Fast Inserts for Rails Many to Many relations
185
179
  test_files:
186
180
  - spec/m2m_fast_insert/base_spec.rb
data/.rvmrc DELETED
@@ -1,5 +0,0 @@
1
- rvm --create ruby-1.9.3-p448@m2m_fast_insert
2
- # Ensure that Bundler is installed, install it if it is not.
3
- if ! command -v bundle > /dev/null; then
4
- gem install bundler
5
- fi
data/Gemfile.lock DELETED
@@ -1,109 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- m2m_fast_insert (0.1.0)
5
- activerecord (>= 3.0.0, < 4.0.0)
6
- activesupport (>= 3.0.0, < 4.0.0)
7
- rails (>= 3.0.0, < 4.0.0)
8
-
9
- GEM
10
- remote: http://rubygems.org/
11
- specs:
12
- actionmailer (3.2.15)
13
- actionpack (= 3.2.15)
14
- mail (~> 2.5.4)
15
- actionpack (3.2.15)
16
- activemodel (= 3.2.15)
17
- activesupport (= 3.2.15)
18
- builder (~> 3.0.0)
19
- erubis (~> 2.7.0)
20
- journey (~> 1.0.4)
21
- rack (~> 1.4.5)
22
- rack-cache (~> 1.2)
23
- rack-test (~> 0.6.1)
24
- sprockets (~> 2.2.1)
25
- activemodel (3.2.15)
26
- activesupport (= 3.2.15)
27
- builder (~> 3.0.0)
28
- activerecord (3.2.15)
29
- activemodel (= 3.2.15)
30
- activesupport (= 3.2.15)
31
- arel (~> 3.0.2)
32
- tzinfo (~> 0.3.29)
33
- activeresource (3.2.15)
34
- activemodel (= 3.2.15)
35
- activesupport (= 3.2.15)
36
- activesupport (3.2.15)
37
- i18n (~> 0.6, >= 0.6.4)
38
- multi_json (~> 1.0)
39
- arel (3.0.2)
40
- builder (3.0.4)
41
- diff-lcs (1.2.5)
42
- erubis (2.7.0)
43
- hike (1.2.3)
44
- i18n (0.6.5)
45
- journey (1.0.4)
46
- json (1.8.1)
47
- mail (2.5.4)
48
- mime-types (~> 1.16)
49
- treetop (~> 1.4.8)
50
- mime-types (1.25)
51
- multi_json (1.8.2)
52
- polyglot (0.3.3)
53
- rack (1.4.5)
54
- rack-cache (1.2)
55
- rack (>= 0.4)
56
- rack-ssl (1.3.3)
57
- rack
58
- rack-test (0.6.2)
59
- rack (>= 1.0)
60
- rails (3.2.15)
61
- actionmailer (= 3.2.15)
62
- actionpack (= 3.2.15)
63
- activerecord (= 3.2.15)
64
- activeresource (= 3.2.15)
65
- activesupport (= 3.2.15)
66
- bundler (~> 1.0)
67
- railties (= 3.2.15)
68
- railties (3.2.15)
69
- actionpack (= 3.2.15)
70
- activesupport (= 3.2.15)
71
- rack-ssl (~> 1.3.2)
72
- rake (>= 0.8.7)
73
- rdoc (~> 3.4)
74
- thor (>= 0.14.6, < 2.0)
75
- rake (10.1.0)
76
- rdoc (3.12.2)
77
- json (~> 1.4)
78
- rspec-core (2.14.7)
79
- rspec-expectations (2.14.4)
80
- diff-lcs (>= 1.1.3, < 2.0)
81
- rspec-mocks (2.14.4)
82
- rspec-rails (2.14.0)
83
- actionpack (>= 3.0)
84
- activesupport (>= 3.0)
85
- railties (>= 3.0)
86
- rspec-core (~> 2.14.0)
87
- rspec-expectations (~> 2.14.0)
88
- rspec-mocks (~> 2.14.0)
89
- sprockets (2.2.2)
90
- hike (~> 1.2)
91
- multi_json (~> 1.0)
92
- rack (~> 1.0)
93
- tilt (~> 1.1, != 1.3.0)
94
- sqlite3 (1.3.8)
95
- thor (0.18.1)
96
- tilt (1.4.1)
97
- treetop (1.4.15)
98
- polyglot
99
- polyglot (>= 0.3.1)
100
- tzinfo (0.3.38)
101
-
102
- PLATFORMS
103
- ruby
104
-
105
- DEPENDENCIES
106
- m2m_fast_insert!
107
- rake
108
- rspec-rails
109
- sqlite3