syncable_models 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +1 -1
- data/Rakefile +4 -14
- data/app/models/syncable_models/sync.rb +22 -0
- data/db/migrate/20160225141153_create_syncs.rb +5 -1
- data/lib/syncable_models/active_record.rb +20 -7
- data/lib/syncable_models/controller.rb +25 -6
- data/lib/syncable_models/engine.rb +5 -0
- data/lib/syncable_models/importer.rb +54 -23
- data/lib/syncable_models/syncable.rb +20 -0
- data/lib/syncable_models/version.rb +1 -1
- data/lib/syncable_models.rb +1 -0
- data/lib/tasks/syncable_models.rake +2 -2
- data/spec/controllers/syncable_models/import_api_controller_spec.rb +101 -0
- data/{test → spec}/dummy/README.rdoc +0 -0
- data/{test → spec}/dummy/Rakefile +0 -0
- data/{test → spec}/dummy/app/assets/javascripts/application.js +0 -0
- data/{test → spec}/dummy/app/assets/stylesheets/application.css +0 -0
- data/{test → spec}/dummy/app/controllers/application_controller.rb +0 -0
- data/spec/dummy/app/controllers/import_api_controller.rb +6 -0
- data/{test → spec}/dummy/app/helpers/application_helper.rb +0 -0
- data/spec/dummy/app/models/project.rb +12 -0
- data/spec/dummy/app/models/team.rb +12 -0
- data/{test → spec}/dummy/app/views/layouts/application.html.erb +0 -0
- data/{test → spec}/dummy/bin/bundle +0 -0
- data/{test → spec}/dummy/bin/rails +0 -0
- data/{test → spec}/dummy/bin/rake +0 -0
- data/{test → spec}/dummy/bin/setup +0 -0
- data/{test → spec}/dummy/config/application.rb +7 -1
- data/{test → spec}/dummy/config/boot.rb +0 -0
- data/{test → spec}/dummy/config/database.yml +0 -0
- data/{test → spec}/dummy/config/environment.rb +0 -0
- data/{test → spec}/dummy/config/environments/development.rb +0 -0
- data/{test → spec}/dummy/config/environments/production.rb +0 -0
- data/{test → spec}/dummy/config/environments/test.rb +0 -0
- data/{test → spec}/dummy/config/initializers/assets.rb +0 -0
- data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
- data/{test → spec}/dummy/config/initializers/cookies_serializer.rb +0 -0
- data/{test → spec}/dummy/config/initializers/filter_parameter_logging.rb +0 -0
- data/{test → spec}/dummy/config/initializers/inflections.rb +0 -0
- data/{test → spec}/dummy/config/initializers/mime_types.rb +0 -0
- data/{test → spec}/dummy/config/initializers/session_store.rb +0 -0
- data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +0 -0
- data/{test → spec}/dummy/config/locales/en.yml +0 -0
- data/spec/dummy/config/routes.rb +11 -0
- data/{test → spec}/dummy/config/secrets.yml +0 -0
- data/{test → spec}/dummy/config.ru +0 -0
- data/spec/dummy/db/migrate/20160327104327_create_projects.rb +13 -0
- data/spec/dummy/db/migrate/20160327111225_create_teams.rb +9 -0
- data/spec/dummy/db/migrate/20160327154807_create_syncs.syncable_models.rb +19 -0
- data/{test → spec}/dummy/db/schema.rb +23 -2
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +819 -0
- data/{test → spec}/dummy/public/404.html +0 -0
- data/{test → spec}/dummy/public/422.html +0 -0
- data/{test → spec}/dummy/public/500.html +0 -0
- data/{test → spec}/dummy/public/favicon.ico +0 -0
- data/spec/dummy/spec/factories/projects.rb +21 -0
- data/spec/dummy/spec/factories/teams.rb +17 -0
- data/spec/models/syncable_models/importer/import_spec.rb +104 -0
- data/spec/models/syncable_models/sync_spec.rb +106 -0
- data/spec/rails_helper.rb +19 -0
- data/spec/spec_helper.rb +85 -0
- data/{test → spec}/syncable_models_test.rb +0 -0
- metadata +106 -80
- data/test/dummy/config/routes.rb +0 -4
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +0 -22
- data/test/test_helper.rb +0 -21
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :first_project, class: Project do
|
3
|
+
name "First"
|
4
|
+
uuid SecureRandom.uuid
|
5
|
+
end
|
6
|
+
|
7
|
+
factory :second_project, class: Project do
|
8
|
+
name "Second"
|
9
|
+
uuid SecureRandom.uuid
|
10
|
+
end
|
11
|
+
|
12
|
+
factory :third_project, class: Project do
|
13
|
+
name "Third"
|
14
|
+
uuid SecureRandom.uuid
|
15
|
+
end
|
16
|
+
|
17
|
+
factory :fourth_project, class: Project do
|
18
|
+
name "fourth"
|
19
|
+
uuid SecureRandom.uuid
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :first_team, class: Team do
|
3
|
+
name "First"
|
4
|
+
end
|
5
|
+
|
6
|
+
factory :second_team, class: Team do
|
7
|
+
name "Second"
|
8
|
+
end
|
9
|
+
|
10
|
+
factory :third_team, class: Team do
|
11
|
+
name "Third"
|
12
|
+
end
|
13
|
+
|
14
|
+
factory :fourth_team, class: Team do
|
15
|
+
name "fourth"
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
module SyncableModels
|
4
|
+
module Importer
|
5
|
+
class TestResponse
|
6
|
+
def initialize(response)
|
7
|
+
@response = response
|
8
|
+
end
|
9
|
+
|
10
|
+
def body
|
11
|
+
@response.to_json
|
12
|
+
end
|
13
|
+
|
14
|
+
def success?
|
15
|
+
true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def set_fetch_request_response(response)
|
22
|
+
SyncableModels::Importer::Import
|
23
|
+
.send(:define_method,
|
24
|
+
:fetch_request,
|
25
|
+
Proc.new{ |params| SyncableModels::Importer::TestResponse.new(response) })
|
26
|
+
end
|
27
|
+
|
28
|
+
RSpec.describe SyncableModels::Importer::Import, type: :model do
|
29
|
+
before :all do
|
30
|
+
SyncableModels::Importer::Import.send(:define_method, :sync_request, Proc.new{ |params, ids| { status: 200 } })
|
31
|
+
set_fetch_request_response({ status: 200, for_sync: [], for_destroy: [] })
|
32
|
+
@import = SyncableModels::Importer::Import.new :test
|
33
|
+
@import.api_url = 'http://test.dev'
|
34
|
+
end
|
35
|
+
|
36
|
+
describe 'when importing permanent objects' do
|
37
|
+
before do
|
38
|
+
@project = create(:first_project, external_id: '8e9d12b3-5df0-46c3-ae19-6ac7d10879a4')
|
39
|
+
@imported_uuid = SecureRandom.uuid
|
40
|
+
@imported_name = 'ImportedProject'
|
41
|
+
set_fetch_request_response({ status: 200,
|
42
|
+
for_sync: [{ uuid: @imported_uuid, name: @imported_name }],
|
43
|
+
for_destroy: ['8e9d12b3-5df0-46c3-ae19-6ac7d10879a4']
|
44
|
+
})
|
45
|
+
@import.import_model Project, id_key: :uuid
|
46
|
+
@import.import [Project]
|
47
|
+
end
|
48
|
+
|
49
|
+
describe 'subject for sync' do
|
50
|
+
it 'imports correctly' do
|
51
|
+
expect(Project.where(external_id: @imported_uuid).first).not_to be_nil
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'has a correct name' do
|
55
|
+
expect(Project.last.name).to eq(@imported_name)
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'has a correct external_id' do
|
59
|
+
expect(Project.last.external_id).to eq(@imported_uuid)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe 'subject for destroy' do
|
64
|
+
it 'import correctly' do
|
65
|
+
expect(Project.where(uuid: @project.uuid).first.deleted_at).not_to be_nil
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe 'when importing non-permanent objects' do
|
71
|
+
before do
|
72
|
+
@team = create(:first_team, external_id: 73)
|
73
|
+
@imported_id = 42
|
74
|
+
@imported_name = 'ImportedTeam'
|
75
|
+
set_fetch_request_response({ status: 200,
|
76
|
+
for_sync: [{ id: @imported_id, name: @imported_name }],
|
77
|
+
for_destroy: ['73']
|
78
|
+
})
|
79
|
+
@import.import_model Team, id_key: :id
|
80
|
+
@import.import [Team]
|
81
|
+
end
|
82
|
+
|
83
|
+
describe 'subject for sync' do
|
84
|
+
it 'imports correctly' do
|
85
|
+
puts Team.all.count.inspect
|
86
|
+
expect(Team.where(external_id: @imported_id).first).not_to be_nil
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'has a correct name' do
|
90
|
+
expect(Team.last.name).to eq(@imported_name)
|
91
|
+
end
|
92
|
+
|
93
|
+
it 'has a correct external_id' do
|
94
|
+
expect(Team.last.external_id).to eq(@imported_id.to_s)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe 'subject for destroy' do
|
99
|
+
it 'import correctly' do
|
100
|
+
expect(Team.find_by_id(@team.id)).to be_nil
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe SyncableModels::Sync, type: :model do
|
4
|
+
it 'it syncs subject succesfully' do
|
5
|
+
project = create(:first_project)
|
6
|
+
project.sync(:test)
|
7
|
+
expect(project.syncs.count).to eq(1)
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#subject_external_id initializing' do
|
11
|
+
it 'initializes with uuid' do
|
12
|
+
project = create(:first_project)
|
13
|
+
project.sync(:test)
|
14
|
+
expect(project.syncs.first.subject_external_id).to eq(project.uuid.to_s)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'initializes with id' do
|
18
|
+
team = create(:first_team)
|
19
|
+
team.sync(:test)
|
20
|
+
expect(team.syncs.first.subject_external_id).to eq(team.id.to_s)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#subject' do
|
25
|
+
it 'points to it\'s subject' do
|
26
|
+
project = create(:first_project)
|
27
|
+
project.sync(:test)
|
28
|
+
sync = project.syncs.first
|
29
|
+
expect(sync.subject).to eq(project)
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'points to it\'s subject by subject_external_id when uuid' do
|
33
|
+
project = create(:first_project)
|
34
|
+
project.sync(:test)
|
35
|
+
sync = project.syncs.first
|
36
|
+
sync.update_attribute :subject_id, nil
|
37
|
+
expect(sync.subject).to eq(project)
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'points to it\'s subject by subject_external_id when id' do
|
41
|
+
team = create(:first_team)
|
42
|
+
team.sync(:test)
|
43
|
+
sync = team.syncs.first
|
44
|
+
sync.update_attribute :subject_id, nil
|
45
|
+
expect(sync.subject).to eq(team)
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'points to it\'s subject when direct association destroyed' do
|
49
|
+
project = create(:first_project)
|
50
|
+
project.sync(:test)
|
51
|
+
sync = project.syncs.first
|
52
|
+
project.destroy
|
53
|
+
sync.reload
|
54
|
+
expect(sync.subject).to eq(project)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe 'subject destroying' do
|
59
|
+
before do
|
60
|
+
@team = create(:first_team)
|
61
|
+
@team.sync(:test)
|
62
|
+
@id = @team.id
|
63
|
+
@sync = @team.syncs.first
|
64
|
+
@team.destroy
|
65
|
+
@sync.reload
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'not destroys sync' do
|
69
|
+
expect(@sync).to_not be_nil
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'clears sync subject_id' do
|
73
|
+
expect(@sync.subject_id).to be_nil
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'cannot point to the subject' do
|
77
|
+
expect(@sync.subject).to be_nil
|
78
|
+
end
|
79
|
+
|
80
|
+
it '#subject_destroyed has false value' do
|
81
|
+
expect(@sync.subject_destroyed).to be_truthy
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'stores subject\'s id' do
|
85
|
+
expect(@sync.subject_external_id).to eq(@id.to_s)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe '#sync_destruction!' do
|
90
|
+
it 'updates sync when subject persisted' do
|
91
|
+
project = create(:first_project)
|
92
|
+
project.sync(:test)
|
93
|
+
project.destroy
|
94
|
+
SyncableModels::Sync.first.sync_destruction!
|
95
|
+
expect(SyncableModels::Sync.first.try(&:subject_destroyed)).to be false
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'destroys sync when subject not persisted' do
|
99
|
+
team = create(:first_team)
|
100
|
+
team.sync(:test)
|
101
|
+
team.destroy
|
102
|
+
SyncableModels::Sync.first.sync_destruction!
|
103
|
+
expect(SyncableModels::Sync.first).to be_nil
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
ENV["RAILS_ENV"] ||= 'test'
|
3
|
+
|
4
|
+
require 'spec_helper'
|
5
|
+
require File.expand_path("../../spec/dummy/config/environment.rb", __FILE__)
|
6
|
+
require 'rspec/rails'
|
7
|
+
require 'factory_girl_rails'
|
8
|
+
|
9
|
+
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../spec/dummy/db/migrate", __FILE__)]
|
10
|
+
ActiveRecord::Migration.maintain_test_schema!
|
11
|
+
|
12
|
+
RSpec.configure do |config|
|
13
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
14
|
+
config.use_transactional_fixtures = true
|
15
|
+
config.infer_spec_type_from_file_location!
|
16
|
+
config.infer_base_class_for_anonymous_controllers = false
|
17
|
+
|
18
|
+
config.include FactoryGirl::Syntax::Methods
|
19
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
4
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
5
|
+
#
|
6
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
7
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
8
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
9
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
10
|
+
# a separate helper file that requires the additional dependencies and performs
|
11
|
+
# the additional setup, and require it from the spec files that actually need it.
|
12
|
+
#
|
13
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
14
|
+
# users commonly want.
|
15
|
+
#
|
16
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
17
|
+
RSpec.configure do |config|
|
18
|
+
# rspec-expectations config goes here. You can use an alternate
|
19
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
20
|
+
# assertions if you prefer.
|
21
|
+
config.expect_with :rspec do |expectations|
|
22
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
23
|
+
# and `failure_message` of custom matchers include text for helper methods
|
24
|
+
# defined using `chain`, e.g.:
|
25
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
26
|
+
# # => "be bigger than 2 and smaller than 4"
|
27
|
+
# ...rather than:
|
28
|
+
# # => "be bigger than 2"
|
29
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
30
|
+
end
|
31
|
+
|
32
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
33
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
34
|
+
config.mock_with :rspec do |mocks|
|
35
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
36
|
+
# a real object. This is generally recommended, and will default to
|
37
|
+
# `true` in RSpec 4.
|
38
|
+
mocks.verify_partial_doubles = true
|
39
|
+
end
|
40
|
+
|
41
|
+
# The settings below are suggested to provide a good initial experience
|
42
|
+
# with RSpec, but feel free to customize to your heart's content.
|
43
|
+
=begin
|
44
|
+
# These two settings work together to allow you to limit a spec run
|
45
|
+
# to individual examples or groups you care about by tagging them with
|
46
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
47
|
+
# get run.
|
48
|
+
config.filter_run :focus
|
49
|
+
config.run_all_when_everything_filtered = true
|
50
|
+
|
51
|
+
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
52
|
+
# For more details, see:
|
53
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
54
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
55
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
56
|
+
config.disable_monkey_patching!
|
57
|
+
|
58
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
59
|
+
# file, and it's useful to allow more verbose output when running an
|
60
|
+
# individual spec file.
|
61
|
+
if config.files_to_run.one?
|
62
|
+
# Use the documentation formatter for detailed output,
|
63
|
+
# unless a formatter has already been configured
|
64
|
+
# (e.g. via a command-line flag).
|
65
|
+
config.default_formatter = 'doc'
|
66
|
+
end
|
67
|
+
|
68
|
+
# Print the 10 slowest examples and example groups at the
|
69
|
+
# end of the spec run, to help surface which specs are running
|
70
|
+
# particularly slow.
|
71
|
+
config.profile_examples = 10
|
72
|
+
|
73
|
+
# Run specs in random order to surface order dependencies. If you find an
|
74
|
+
# order dependency and want to debug it, you can fix the order by providing
|
75
|
+
# the seed, which is printed after each run.
|
76
|
+
# --seed 1234
|
77
|
+
config.order = :random
|
78
|
+
|
79
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
80
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
81
|
+
# test failures related to randomization by passing the same `--seed` value
|
82
|
+
# as the one that triggered the failure.
|
83
|
+
Kernel.srand config.seed
|
84
|
+
=end
|
85
|
+
end
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: syncable_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Serafim Nenarokov
|
8
|
+
- Sergey Gnuskov
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
12
|
+
date: 2016-03-29 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: activerecord
|
@@ -102,47 +103,60 @@ files:
|
|
102
103
|
- lib/syncable_models/controller.rb
|
103
104
|
- lib/syncable_models/engine.rb
|
104
105
|
- lib/syncable_models/importer.rb
|
106
|
+
- lib/syncable_models/syncable.rb
|
105
107
|
- lib/syncable_models/version.rb
|
106
108
|
- lib/tasks/syncable_models.rake
|
107
|
-
-
|
108
|
-
-
|
109
|
-
-
|
110
|
-
-
|
111
|
-
-
|
112
|
-
-
|
113
|
-
-
|
114
|
-
-
|
115
|
-
-
|
116
|
-
-
|
117
|
-
-
|
118
|
-
-
|
119
|
-
-
|
120
|
-
-
|
121
|
-
-
|
122
|
-
-
|
123
|
-
-
|
124
|
-
-
|
125
|
-
-
|
126
|
-
-
|
127
|
-
-
|
128
|
-
-
|
129
|
-
-
|
130
|
-
-
|
131
|
-
-
|
132
|
-
-
|
133
|
-
-
|
134
|
-
-
|
135
|
-
-
|
136
|
-
-
|
137
|
-
-
|
138
|
-
-
|
139
|
-
-
|
140
|
-
-
|
141
|
-
-
|
142
|
-
-
|
143
|
-
-
|
144
|
-
-
|
145
|
-
- test
|
109
|
+
- spec/controllers/syncable_models/import_api_controller_spec.rb
|
110
|
+
- spec/dummy/README.rdoc
|
111
|
+
- spec/dummy/Rakefile
|
112
|
+
- spec/dummy/app/assets/javascripts/application.js
|
113
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
114
|
+
- spec/dummy/app/controllers/application_controller.rb
|
115
|
+
- spec/dummy/app/controllers/import_api_controller.rb
|
116
|
+
- spec/dummy/app/helpers/application_helper.rb
|
117
|
+
- spec/dummy/app/models/project.rb
|
118
|
+
- spec/dummy/app/models/team.rb
|
119
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
120
|
+
- spec/dummy/bin/bundle
|
121
|
+
- spec/dummy/bin/rails
|
122
|
+
- spec/dummy/bin/rake
|
123
|
+
- spec/dummy/bin/setup
|
124
|
+
- spec/dummy/config.ru
|
125
|
+
- spec/dummy/config/application.rb
|
126
|
+
- spec/dummy/config/boot.rb
|
127
|
+
- spec/dummy/config/database.yml
|
128
|
+
- spec/dummy/config/environment.rb
|
129
|
+
- spec/dummy/config/environments/development.rb
|
130
|
+
- spec/dummy/config/environments/production.rb
|
131
|
+
- spec/dummy/config/environments/test.rb
|
132
|
+
- spec/dummy/config/initializers/assets.rb
|
133
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
134
|
+
- spec/dummy/config/initializers/cookies_serializer.rb
|
135
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
136
|
+
- spec/dummy/config/initializers/inflections.rb
|
137
|
+
- spec/dummy/config/initializers/mime_types.rb
|
138
|
+
- spec/dummy/config/initializers/session_store.rb
|
139
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
140
|
+
- spec/dummy/config/locales/en.yml
|
141
|
+
- spec/dummy/config/routes.rb
|
142
|
+
- spec/dummy/config/secrets.yml
|
143
|
+
- spec/dummy/db/migrate/20160327104327_create_projects.rb
|
144
|
+
- spec/dummy/db/migrate/20160327111225_create_teams.rb
|
145
|
+
- spec/dummy/db/migrate/20160327154807_create_syncs.syncable_models.rb
|
146
|
+
- spec/dummy/db/schema.rb
|
147
|
+
- spec/dummy/db/test.sqlite3
|
148
|
+
- spec/dummy/log/test.log
|
149
|
+
- spec/dummy/public/404.html
|
150
|
+
- spec/dummy/public/422.html
|
151
|
+
- spec/dummy/public/500.html
|
152
|
+
- spec/dummy/public/favicon.ico
|
153
|
+
- spec/dummy/spec/factories/projects.rb
|
154
|
+
- spec/dummy/spec/factories/teams.rb
|
155
|
+
- spec/models/syncable_models/importer/import_spec.rb
|
156
|
+
- spec/models/syncable_models/sync_spec.rb
|
157
|
+
- spec/rails_helper.rb
|
158
|
+
- spec/spec_helper.rb
|
159
|
+
- spec/syncable_models_test.rb
|
146
160
|
homepage: https://github.com/flant/syncable_models
|
147
161
|
licenses:
|
148
162
|
- MIT
|
@@ -168,42 +182,54 @@ signing_key:
|
|
168
182
|
specification_version: 4
|
169
183
|
summary: Sync your models easily.
|
170
184
|
test_files:
|
171
|
-
-
|
172
|
-
-
|
173
|
-
-
|
174
|
-
-
|
175
|
-
-
|
176
|
-
-
|
177
|
-
-
|
178
|
-
-
|
179
|
-
-
|
180
|
-
-
|
181
|
-
-
|
182
|
-
-
|
183
|
-
-
|
184
|
-
-
|
185
|
-
-
|
186
|
-
-
|
187
|
-
-
|
188
|
-
-
|
189
|
-
-
|
190
|
-
-
|
191
|
-
-
|
192
|
-
-
|
193
|
-
-
|
194
|
-
-
|
195
|
-
-
|
196
|
-
-
|
197
|
-
-
|
198
|
-
-
|
199
|
-
-
|
200
|
-
-
|
201
|
-
-
|
202
|
-
-
|
203
|
-
-
|
204
|
-
-
|
205
|
-
-
|
206
|
-
-
|
207
|
-
-
|
208
|
-
-
|
209
|
-
- test
|
185
|
+
- spec/controllers/syncable_models/import_api_controller_spec.rb
|
186
|
+
- spec/dummy/README.rdoc
|
187
|
+
- spec/dummy/Rakefile
|
188
|
+
- spec/dummy/app/assets/javascripts/application.js
|
189
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
190
|
+
- spec/dummy/app/controllers/application_controller.rb
|
191
|
+
- spec/dummy/app/controllers/import_api_controller.rb
|
192
|
+
- spec/dummy/app/helpers/application_helper.rb
|
193
|
+
- spec/dummy/app/models/project.rb
|
194
|
+
- spec/dummy/app/models/team.rb
|
195
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
196
|
+
- spec/dummy/bin/bundle
|
197
|
+
- spec/dummy/bin/rails
|
198
|
+
- spec/dummy/bin/rake
|
199
|
+
- spec/dummy/bin/setup
|
200
|
+
- spec/dummy/config.ru
|
201
|
+
- spec/dummy/config/application.rb
|
202
|
+
- spec/dummy/config/boot.rb
|
203
|
+
- spec/dummy/config/database.yml
|
204
|
+
- spec/dummy/config/environment.rb
|
205
|
+
- spec/dummy/config/environments/development.rb
|
206
|
+
- spec/dummy/config/environments/production.rb
|
207
|
+
- spec/dummy/config/environments/test.rb
|
208
|
+
- spec/dummy/config/initializers/assets.rb
|
209
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
210
|
+
- spec/dummy/config/initializers/cookies_serializer.rb
|
211
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
212
|
+
- spec/dummy/config/initializers/inflections.rb
|
213
|
+
- spec/dummy/config/initializers/mime_types.rb
|
214
|
+
- spec/dummy/config/initializers/session_store.rb
|
215
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
216
|
+
- spec/dummy/config/locales/en.yml
|
217
|
+
- spec/dummy/config/routes.rb
|
218
|
+
- spec/dummy/config/secrets.yml
|
219
|
+
- spec/dummy/db/migrate/20160327104327_create_projects.rb
|
220
|
+
- spec/dummy/db/migrate/20160327111225_create_teams.rb
|
221
|
+
- spec/dummy/db/migrate/20160327154807_create_syncs.syncable_models.rb
|
222
|
+
- spec/dummy/db/schema.rb
|
223
|
+
- spec/dummy/db/test.sqlite3
|
224
|
+
- spec/dummy/log/test.log
|
225
|
+
- spec/dummy/public/404.html
|
226
|
+
- spec/dummy/public/422.html
|
227
|
+
- spec/dummy/public/500.html
|
228
|
+
- spec/dummy/public/favicon.ico
|
229
|
+
- spec/dummy/spec/factories/projects.rb
|
230
|
+
- spec/dummy/spec/factories/teams.rb
|
231
|
+
- spec/models/syncable_models/importer/import_spec.rb
|
232
|
+
- spec/models/syncable_models/sync_spec.rb
|
233
|
+
- spec/rails_helper.rb
|
234
|
+
- spec/spec_helper.rb
|
235
|
+
- spec/syncable_models_test.rb
|
data/test/dummy/config/routes.rb
DELETED
data/test/dummy/db/test.sqlite3
DELETED
Binary file
|
data/test/dummy/log/test.log
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
[1m[36m (3.0ms)[0m [1mCREATE TABLE "syncs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "subject_id" integer, "subject_type" varchar, "destination" varchar, "created_at" datetime, "updated_at" datetime) [0m
|
2
|
-
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
3
|
-
[1m[36m (1.9ms)[0m [1mCREATE INDEX "index_syncs_on_destination" ON "syncs" ("destination")[0m
|
4
|
-
[1m[35m (0.1ms)[0m SELECT sql
|
5
|
-
FROM sqlite_master
|
6
|
-
WHERE name='index_syncs_on_destination' AND type='index'
|
7
|
-
UNION ALL
|
8
|
-
SELECT sql
|
9
|
-
FROM sqlite_temp_master
|
10
|
-
WHERE name='index_syncs_on_destination' AND type='index'
|
11
|
-
|
12
|
-
[1m[36m (2.1ms)[0m [1mCREATE INDEX "index_syncs_on_subject_id_and_subject_type_and_destination" ON "syncs" ("subject_id", "subject_type", "destination")[0m
|
13
|
-
[1m[35m (1.8ms)[0m CREATE TABLE "schema_migrations" ("version" varchar NOT NULL)
|
14
|
-
[1m[36m (2.0ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
15
|
-
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
16
|
-
[1m[36m (1.4ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20160225141153')[0m
|
17
|
-
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
18
|
-
[1m[35m (0.2ms)[0m begin transaction
|
19
|
-
------------------------------
|
20
|
-
SyncableModelsTest: test_truth
|
21
|
-
------------------------------
|
22
|
-
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
data/test/test_helper.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# Configure Rails Environment
|
2
|
-
ENV["RAILS_ENV"] = "test"
|
3
|
-
|
4
|
-
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
|
5
|
-
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
|
6
|
-
ActiveRecord::Migrator.migrations_paths << File.expand_path('../../db/migrate', __FILE__)
|
7
|
-
require "rails/test_help"
|
8
|
-
|
9
|
-
# Filter out Minitest backtrace while allowing backtrace from other libraries
|
10
|
-
# to be shown.
|
11
|
-
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
|
12
|
-
|
13
|
-
# Load support files
|
14
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
15
|
-
|
16
|
-
# Load fixtures from the engine
|
17
|
-
if ActiveSupport::TestCase.respond_to?(:fixture_path=)
|
18
|
-
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
19
|
-
ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path
|
20
|
-
ActiveSupport::TestCase.fixtures :all
|
21
|
-
end
|