forceps 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/forceps/acts_as_copyable_model.rb +3 -3
- data/lib/forceps/client.rb +16 -9
- data/lib/forceps/version.rb +1 -1
- data/test/clone_structures_test.rb +0 -8
- data/test/dummy/db/remote.sqlite3 +0 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +24820 -0
- data/test/sti_test.rb +25 -0
- data/test/test_helper.rb +2 -0
- metadata +7 -5
data/test/sti_test.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class StiTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
Forceps.configure
|
7
|
+
create_remote_car(name: 'audi')
|
8
|
+
end
|
9
|
+
|
10
|
+
test "should instantiate the proper remote record when fetching a record through the parent class" do
|
11
|
+
remote_car = Forceps::Remote::Product.find_by_name('audi')
|
12
|
+
assert_instance_of Forceps::Remote::Car, remote_car
|
13
|
+
end
|
14
|
+
|
15
|
+
test "should download child objects when using single table inheritance" do
|
16
|
+
Forceps::Remote::Product.find_by_name('audi').copy_to_local
|
17
|
+
assert_not_nil Product.find_by_name('CAR: audi')
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_remote_car(attributes)
|
21
|
+
RemoteProduct.create!(attributes).tap do |car|
|
22
|
+
car.update_column :type, 'Car'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -25,6 +25,8 @@ DatabaseCleaner::ActiveRecord.config_file_location = File.expand_path("../dummy/
|
|
25
25
|
DatabaseCleaner.strategy = :truncation
|
26
26
|
DatabaseCleaner[:active_record, connection: :remote].strategy = :truncation
|
27
27
|
|
28
|
+
Rails.application.eager_load!
|
29
|
+
|
28
30
|
class ActiveSupport::TestCase
|
29
31
|
setup do
|
30
32
|
DatabaseCleaner.start
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forceps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-01-
|
12
|
+
date: 2014-01-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -184,6 +184,7 @@ files:
|
|
184
184
|
- test/fixtures/invoices.yml
|
185
185
|
- test/fixtures/users.yml
|
186
186
|
- test/reuse_existing_records_test.rb
|
187
|
+
- test/sti_test.rb
|
187
188
|
- test/support/minitest_ext.rb
|
188
189
|
- test/support/remote_address.rb
|
189
190
|
- test/support/remote_invoice.rb
|
@@ -206,7 +207,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
206
207
|
version: '0'
|
207
208
|
segments:
|
208
209
|
- 0
|
209
|
-
hash:
|
210
|
+
hash: 885039435604686087
|
210
211
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
211
212
|
none: false
|
212
213
|
requirements:
|
@@ -215,13 +216,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
215
216
|
version: '0'
|
216
217
|
segments:
|
217
218
|
- 0
|
218
|
-
hash:
|
219
|
+
hash: 885039435604686087
|
219
220
|
requirements: []
|
220
221
|
rubyforge_project:
|
221
222
|
rubygems_version: 1.8.23
|
222
223
|
signing_key:
|
223
224
|
specification_version: 3
|
224
|
-
summary: Copy active record models from
|
225
|
+
summary: Copy active record models from remote databases
|
225
226
|
test_files:
|
226
227
|
- test/callbacks_test.rb
|
227
228
|
- test/clone_structures_test.rb
|
@@ -286,6 +287,7 @@ test_files:
|
|
286
287
|
- test/fixtures/invoices.yml
|
287
288
|
- test/fixtures/users.yml
|
288
289
|
- test/reuse_existing_records_test.rb
|
290
|
+
- test/sti_test.rb
|
289
291
|
- test/support/minitest_ext.rb
|
290
292
|
- test/support/remote_address.rb
|
291
293
|
- test/support/remote_invoice.rb
|