apidae 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +20 -20
- data/README.rdoc +2 -2
- data/Rakefile +38 -38
- data/app/assets/images/apidae/logo-apidae-grey.svg +84 -84
- data/app/assets/javascripts/apidae/application.js +13 -13
- data/app/assets/stylesheets/apidae/application.css +15 -15
- data/app/controllers/apidae/api_controller.rb +25 -25
- data/app/controllers/apidae/application_controller.rb +6 -6
- data/app/controllers/apidae/dashboard_controller.rb +13 -13
- data/app/controllers/apidae/import_controller.rb +68 -68
- data/app/controllers/apidae/objects_controller.rb +59 -59
- data/app/controllers/apidae/projects_controller.rb +35 -35
- data/app/controllers/apidae/references_controller.rb +9 -9
- data/app/controllers/apidae/selections_controller.rb +53 -53
- data/app/helpers/apidae/api_helper.rb +4 -4
- data/app/helpers/apidae/application_helper.rb +4 -4
- data/app/helpers/apidae/dashboard_helper.rb +4 -4
- data/app/helpers/apidae/import_helper.rb +4 -4
- data/app/helpers/apidae/objects_helper.rb +4 -4
- data/app/helpers/apidae/references_helper.rb +4 -4
- data/app/helpers/apidae/selections_helper.rb +4 -4
- data/app/models/apidae/application_record.rb +5 -5
- data/app/models/apidae/export.rb +13 -13
- data/app/models/apidae/file_import.rb +161 -161
- data/app/models/apidae/obj.rb +351 -351
- data/app/models/apidae/project.rb +4 -4
- data/app/models/apidae/reference.rb +45 -45
- data/app/models/apidae/selection.rb +160 -160
- data/app/models/apidae/selection_object.rb +6 -6
- data/app/models/apidae/town.rb +28 -27
- data/app/views/apidae/dashboard/index.html.erb +41 -41
- data/app/views/apidae/import/callback.html.erb +2 -2
- data/app/views/apidae/objects/_form.html.erb +73 -73
- data/app/views/apidae/objects/edit.html.erb +6 -6
- data/app/views/apidae/objects/index.html.erb +34 -34
- data/app/views/apidae/objects/index.json.jbuilder +6 -6
- data/app/views/apidae/objects/new.html.erb +5 -5
- data/app/views/apidae/objects/show.html.erb +74 -74
- data/app/views/apidae/projects/edit.html.erb +32 -32
- data/app/views/apidae/projects/index.html.erb +34 -34
- data/app/views/apidae/references/index.html.erb +34 -34
- data/app/views/apidae/selections/_form.html.erb +29 -29
- data/app/views/apidae/selections/edit.html.erb +6 -6
- data/app/views/apidae/selections/index.html.erb +34 -34
- data/app/views/apidae/selections/new.html.erb +5 -5
- data/app/views/apidae/selections/show.html.erb +19 -19
- data/app/views/layouts/apidae/application.html.erb +14 -14
- data/config/locales/apidae.fr.yml +6 -6
- data/config/routes.rb +14 -14
- data/db/migrate/20170512212941_create_apidae_selections.rb +11 -11
- data/db/migrate/20170512214641_create_apidae_objects.rb +22 -22
- data/db/migrate/20170512221525_create_apidae_objects_apidae_selections.rb +8 -8
- data/db/migrate/20170513114002_create_apidae_towns.rb +15 -15
- data/db/migrate/20170513114409_add_town_insee_code_to_objects.rb +5 -5
- data/db/migrate/20170513115401_add_pictures_data_to_objects.rb +5 -5
- data/db/migrate/20170513121215_create_apidae_attached_files.rb +13 -13
- data/db/migrate/20170513205932_rename_objects_selections_table.rb +5 -5
- data/db/migrate/20170720161134_add_entity_data_to_objects.rb +5 -5
- data/db/migrate/20170730102424_create_apidae_file_imports.rb +13 -13
- data/db/migrate/20171025075304_create_apidae_exports.rb +15 -15
- data/db/migrate/20180217222410_create_apidae_selection_objects.rb +10 -10
- data/db/migrate/20180218172704_change_text_columns_to_json.rb +10 -10
- data/db/migrate/20180218231319_add_service_data_to_apidae_objects.rb +5 -5
- data/db/migrate/20180222104915_add_rates_data_to_apidae_objects.rb +6 -6
- data/db/migrate/20180222105302_rename_openings_to_openings_data.rb +5 -5
- data/db/migrate/20180307164936_add_attachments_data_to_apidae_objects.rb +5 -5
- data/db/migrate/20180307170349_create_apidae_references.rb +12 -12
- data/db/migrate/20180314093512_add_tags_data_to_apidae_objects.rb +5 -5
- data/db/migrate/20180314132631_add_meta_data_to_apidae_objects.rb +5 -5
- data/db/migrate/20180319143954_remove_apidae_id_unicity.rb +6 -6
- data/db/migrate/20180417164604_add_location_data_to_apidae_objects.rb +5 -5
- data/db/migrate/20180417165744_remove_address_from_apidae_objects.rb +5 -5
- data/db/migrate/20180417171344_remove_lat_lng_from_apidae_objects.rb +6 -6
- data/db/migrate/20180418141248_add_description_data_to_apidae_objects.rb +5 -5
- data/db/migrate/20180418141305_remove_desc_columns_from_apidae_objects.rb +6 -6
- data/db/migrate/20180424141656_add_meta_data_to_apidae_references.rb +5 -5
- data/db/migrate/20180519170210_remove_insee_code_unicity.rb +7 -7
- data/db/migrate/20180521211735_destroy_attached_files.rb +5 -5
- data/db/migrate/20180625050400_rename_objects_to_obj.rb +5 -5
- data/db/migrate/20181024072424_add_project_id_to_selections.rb +5 -5
- data/db/migrate/20181024072843_create_apidae_projects.rb +10 -10
- data/db/migrate/20190328122424_add_description_to_apidae_towns.rb +5 -0
- data/lib/apidae.rb +4 -4
- data/lib/apidae/engine.rb +10 -10
- data/lib/apidae/version.rb +3 -3
- data/lib/tasks/apidae_tasks.rake +4 -4
- data/test/apidae_test.rb +7 -7
- data/test/controllers/apidae/api_controller_test.rb +23 -23
- data/test/controllers/apidae/dashboard_controller_test.rb +15 -15
- data/test/controllers/apidae/import_controller_test.rb +15 -15
- data/test/controllers/apidae/objects_controller_test.rb +52 -52
- data/test/controllers/apidae/references_controller_test.rb +13 -13
- data/test/controllers/apidae/selections_controller_test.rb +52 -52
- data/test/data/selections.json +14 -14
- data/test/data/structure.json +64 -64
- data/test/data/update_selections.json +18 -18
- data/test/dummy/README.rdoc +28 -28
- data/test/dummy/Rakefile +6 -6
- data/test/dummy/app/assets/javascripts/application.js +13 -13
- data/test/dummy/app/assets/stylesheets/application.css +15 -15
- data/test/dummy/app/controllers/application_controller.rb +5 -5
- data/test/dummy/app/helpers/application_helper.rb +2 -2
- data/test/dummy/app/views/layouts/application.html.erb +14 -14
- data/test/dummy/bin/bundle +3 -3
- data/test/dummy/bin/rails +4 -4
- data/test/dummy/bin/rake +4 -4
- data/test/dummy/bin/setup +29 -29
- data/test/dummy/config.ru +4 -4
- data/test/dummy/config/application.rb +24 -24
- data/test/dummy/config/boot.rb +5 -5
- data/test/dummy/config/database.yml +20 -20
- data/test/dummy/config/environment.rb +5 -5
- data/test/dummy/config/environments/development.rb +41 -41
- data/test/dummy/config/environments/production.rb +79 -79
- data/test/dummy/config/environments/test.rb +42 -42
- data/test/dummy/config/initializers/apidae.rb +18 -18
- data/test/dummy/config/initializers/assets.rb +11 -11
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -7
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -3
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -4
- data/test/dummy/config/initializers/inflections.rb +16 -16
- data/test/dummy/config/initializers/mime_types.rb +4 -4
- data/test/dummy/config/initializers/session_store.rb +3 -3
- data/test/dummy/config/initializers/to_time_preserves_timezone.rb +10 -10
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -14
- data/test/dummy/config/locales/en.yml +23 -23
- data/test/dummy/config/routes.rb +4 -4
- data/test/dummy/config/secrets.yml +22 -22
- data/test/dummy/db/schema.rb +104 -104
- data/test/dummy/public/404.html +67 -67
- data/test/dummy/public/422.html +67 -67
- data/test/dummy/public/500.html +66 -66
- data/test/fixtures/apidae/exports.yml +15 -15
- data/test/fixtures/apidae/objects.yml +33 -33
- data/test/fixtures/apidae/references.yml +11 -11
- data/test/fixtures/apidae/selection_objects.yml +9 -9
- data/test/fixtures/apidae/selections.yml +11 -11
- data/test/fixtures/apidae/towns.yml +15 -15
- data/test/integration/navigation_test.rb +8 -8
- data/test/models/apidae/export_test.rb +9 -9
- data/test/models/apidae/file_import_test.rb +88 -88
- data/test/models/apidae/object_test.rb +9 -9
- data/test/models/apidae/reference_test.rb +9 -9
- data/test/models/apidae/selection_object_test.rb +9 -9
- data/test/models/apidae/selection_test.rb +9 -9
- data/test/models/apidae/town_test.rb +9 -9
- data/test/test_helper.rb +22 -22
- metadata +49 -50
- data/test/dummy/log/test.log +0 -2109
@@ -1,11 +1,11 @@
|
|
1
|
-
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
2
|
-
|
3
|
-
one:
|
4
|
-
apidae_id: 1
|
5
|
-
apidae_type: MyString
|
6
|
-
label_data:
|
7
|
-
|
8
|
-
two:
|
9
|
-
apidae_id: 1
|
10
|
-
apidae_type: MyString
|
11
|
-
label_data:
|
1
|
+
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
2
|
+
|
3
|
+
one:
|
4
|
+
apidae_id: 1
|
5
|
+
apidae_type: MyString
|
6
|
+
label_data:
|
7
|
+
|
8
|
+
two:
|
9
|
+
apidae_id: 1
|
10
|
+
apidae_type: MyString
|
11
|
+
label_data:
|
@@ -1,9 +1,9 @@
|
|
1
|
-
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
2
|
-
|
3
|
-
one:
|
4
|
-
selection_id: 1
|
5
|
-
object_id: 1
|
6
|
-
|
7
|
-
two:
|
8
|
-
selection_id: 1
|
9
|
-
object_id: 1
|
1
|
+
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
2
|
+
|
3
|
+
one:
|
4
|
+
selection_id: 1
|
5
|
+
object_id: 1
|
6
|
+
|
7
|
+
two:
|
8
|
+
selection_id: 1
|
9
|
+
object_id: 1
|
@@ -1,11 +1,11 @@
|
|
1
|
-
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
2
|
-
|
3
|
-
one:
|
4
|
-
label: MyString
|
5
|
-
reference: MyString
|
6
|
-
apidae_id: 1
|
7
|
-
|
8
|
-
two:
|
9
|
-
label: MyString
|
10
|
-
reference: MyString
|
11
|
-
apidae_id: 1
|
1
|
+
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
2
|
+
|
3
|
+
one:
|
4
|
+
label: MyString
|
5
|
+
reference: MyString
|
6
|
+
apidae_id: 1
|
7
|
+
|
8
|
+
two:
|
9
|
+
label: MyString
|
10
|
+
reference: MyString
|
11
|
+
apidae_id: 1
|
@@ -1,15 +1,15 @@
|
|
1
|
-
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
2
|
-
|
3
|
-
one:
|
4
|
-
country: MyString
|
5
|
-
apidae_id: 1
|
6
|
-
insee_code: MyString
|
7
|
-
name: MyString
|
8
|
-
postal_code: MyString
|
9
|
-
|
10
|
-
two:
|
11
|
-
country: MyString
|
12
|
-
apidae_id: 1
|
13
|
-
insee_code: MyString
|
14
|
-
name: MyString
|
15
|
-
postal_code: MyString
|
1
|
+
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
2
|
+
|
3
|
+
one:
|
4
|
+
country: MyString
|
5
|
+
apidae_id: 1
|
6
|
+
insee_code: MyString
|
7
|
+
name: MyString
|
8
|
+
postal_code: MyString
|
9
|
+
|
10
|
+
two:
|
11
|
+
country: MyString
|
12
|
+
apidae_id: 1
|
13
|
+
insee_code: MyString
|
14
|
+
name: MyString
|
15
|
+
postal_code: MyString
|
@@ -1,8 +1,8 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class NavigationTest < ActionDispatch::IntegrationTest
|
4
|
-
# test "the truth" do
|
5
|
-
# assert true
|
6
|
-
# end
|
7
|
-
end
|
8
|
-
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class NavigationTest < ActionDispatch::IntegrationTest
|
4
|
+
# test "the truth" do
|
5
|
+
# assert true
|
6
|
+
# end
|
7
|
+
end
|
8
|
+
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Apidae
|
4
|
-
class ExportTest < ActiveSupport::TestCase
|
5
|
-
# test "the truth" do
|
6
|
-
# assert true
|
7
|
-
# end
|
8
|
-
end
|
9
|
-
end
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Apidae
|
4
|
+
class ExportTest < ActiveSupport::TestCase
|
5
|
+
# test "the truth" do
|
6
|
+
# assert true
|
7
|
+
# end
|
8
|
+
end
|
9
|
+
end
|
@@ -1,88 +1,88 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Apidae
|
4
|
-
class FileImportTest < ActiveSupport::TestCase
|
5
|
-
setup do
|
6
|
-
Obj.delete_all
|
7
|
-
Selection.delete_all
|
8
|
-
@result = {created: 0, updated: 0, deleted: 0, selections: []}
|
9
|
-
end
|
10
|
-
|
11
|
-
test "new object insertion" do
|
12
|
-
objects_json = File.read('test/data/structure.json')
|
13
|
-
FileImport.add_or_update_objects(objects_json, @result)
|
14
|
-
assert_equal 1, Obj.count
|
15
|
-
new_obj = Obj.first
|
16
|
-
assert_equal 504, new_obj.apidae_id
|
17
|
-
assert_equal({created: 1, updated: 0, deleted: 0, selections: []}, @result)
|
18
|
-
end
|
19
|
-
|
20
|
-
test "existing object update" do
|
21
|
-
Obj.create(apidae_id: 504, title: 'Société des contrebassistes aixois')
|
22
|
-
objects_json = File.read('test/data/structure.json')
|
23
|
-
FileImport.add_or_update_objects(objects_json, @result)
|
24
|
-
assert_equal 1, Obj.count
|
25
|
-
updated_obj = Obj.first
|
26
|
-
assert_equal 504, updated_obj.apidae_id
|
27
|
-
assert_equal 'Société des accordéonistes aixois', updated_obj.title
|
28
|
-
assert_equal({created: 0, updated: 1, deleted: 0, selections: []}, @result)
|
29
|
-
end
|
30
|
-
|
31
|
-
test "existing object deletion" do
|
32
|
-
Obj.create(apidae_id: 504, title: 'Société des contrebassistes aixois')
|
33
|
-
objects_json = File.read('test/data/deletion.json')
|
34
|
-
FileImport.delete_objects(objects_json, @result)
|
35
|
-
assert_equal 0, Obj.count
|
36
|
-
assert_equal({created: 0, updated: 0, deleted: 1, selections: []}, @result)
|
37
|
-
end
|
38
|
-
|
39
|
-
test "new selection insertion" do
|
40
|
-
Obj.create(apidae_id: 504, title: 'Société des contrebassistes aixois')
|
41
|
-
objects_json = File.read('test/data/selections.json')
|
42
|
-
FileImport.add_or_update_selections(objects_json, @result)
|
43
|
-
assert_equal 1, Selection.count
|
44
|
-
new_sel = Selection.first
|
45
|
-
assert_equal 49063, new_sel.apidae_id
|
46
|
-
assert_equal 'Sélection 1', new_sel.label
|
47
|
-
assert_equal 'selection-1', new_sel.reference
|
48
|
-
assert_equal({created: 0, updated: 0, deleted: 0,
|
49
|
-
selections: [{apidae_id: 49063, reference: 'selection-1', objects: 1}]}, @result)
|
50
|
-
end
|
51
|
-
|
52
|
-
test "existing selection update" do
|
53
|
-
obj = Obj.create(apidae_id: 503, title: 'Société des contrebassistes aixois')
|
54
|
-
Obj.create(apidae_id: 504, title: 'Société des contrebassistes aixois')
|
55
|
-
sel = Selection.create(apidae_id: 49063, label: 'Sélection 2', reference: 'selection-2')
|
56
|
-
sel.objects << obj
|
57
|
-
assert_equal 1, sel.objects.count
|
58
|
-
objects_json = File.read('test/data/update_selections.json')
|
59
|
-
FileImport.add_or_update_selections(objects_json, @result)
|
60
|
-
assert_equal 1, Selection.count
|
61
|
-
assert_equal 49063, sel.apidae_id
|
62
|
-
assert_equal 'Sélection 2', sel.label
|
63
|
-
assert_equal 'selection-2', sel.reference
|
64
|
-
assert_equal({created: 0, updated: 0, deleted: 0,
|
65
|
-
selections: [{apidae_id: 49063, reference: 'selection-2', objects: 2}]}, @result)
|
66
|
-
end
|
67
|
-
|
68
|
-
test "existing selection deletion" do
|
69
|
-
Selection.create(apidae_id: 49063, label: 'Sélection 3', reference: 'selection-3')
|
70
|
-
objects_json = File.read('test/data/delete_selections.json')
|
71
|
-
assert_equal 1, Selection.count
|
72
|
-
FileImport.add_or_update_selections(objects_json, @result)
|
73
|
-
assert_equal 0, Selection.count
|
74
|
-
end
|
75
|
-
|
76
|
-
test "full import process" do
|
77
|
-
Obj.create(apidae_id: 123, title: 'Objet à supprimer')
|
78
|
-
Obj.create(apidae_id: 4826186, title: 'Objet à mettre à jour')
|
79
|
-
result = FileImport.import('test/data/json_export.zip')
|
80
|
-
assert_equal 2, Selection.all.count
|
81
|
-
assert_equal 5, Obj.all.count
|
82
|
-
assert_equal({created: 4, updated: 1, deleted: 1, selections: [
|
83
|
-
{apidae_id: 49063, reference: 'selection-1', objects: 2},
|
84
|
-
{apidae_id: 49073, reference: 'selection-2', objects: 3}
|
85
|
-
]}, result)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Apidae
|
4
|
+
class FileImportTest < ActiveSupport::TestCase
|
5
|
+
setup do
|
6
|
+
Obj.delete_all
|
7
|
+
Selection.delete_all
|
8
|
+
@result = {created: 0, updated: 0, deleted: 0, selections: []}
|
9
|
+
end
|
10
|
+
|
11
|
+
test "new object insertion" do
|
12
|
+
objects_json = File.read('test/data/structure.json')
|
13
|
+
FileImport.add_or_update_objects(objects_json, @result)
|
14
|
+
assert_equal 1, Obj.count
|
15
|
+
new_obj = Obj.first
|
16
|
+
assert_equal 504, new_obj.apidae_id
|
17
|
+
assert_equal({created: 1, updated: 0, deleted: 0, selections: []}, @result)
|
18
|
+
end
|
19
|
+
|
20
|
+
test "existing object update" do
|
21
|
+
Obj.create(apidae_id: 504, title: 'Société des contrebassistes aixois')
|
22
|
+
objects_json = File.read('test/data/structure.json')
|
23
|
+
FileImport.add_or_update_objects(objects_json, @result)
|
24
|
+
assert_equal 1, Obj.count
|
25
|
+
updated_obj = Obj.first
|
26
|
+
assert_equal 504, updated_obj.apidae_id
|
27
|
+
assert_equal 'Société des accordéonistes aixois', updated_obj.title
|
28
|
+
assert_equal({created: 0, updated: 1, deleted: 0, selections: []}, @result)
|
29
|
+
end
|
30
|
+
|
31
|
+
test "existing object deletion" do
|
32
|
+
Obj.create(apidae_id: 504, title: 'Société des contrebassistes aixois')
|
33
|
+
objects_json = File.read('test/data/deletion.json')
|
34
|
+
FileImport.delete_objects(objects_json, @result)
|
35
|
+
assert_equal 0, Obj.count
|
36
|
+
assert_equal({created: 0, updated: 0, deleted: 1, selections: []}, @result)
|
37
|
+
end
|
38
|
+
|
39
|
+
test "new selection insertion" do
|
40
|
+
Obj.create(apidae_id: 504, title: 'Société des contrebassistes aixois')
|
41
|
+
objects_json = File.read('test/data/selections.json')
|
42
|
+
FileImport.add_or_update_selections(objects_json, @result)
|
43
|
+
assert_equal 1, Selection.count
|
44
|
+
new_sel = Selection.first
|
45
|
+
assert_equal 49063, new_sel.apidae_id
|
46
|
+
assert_equal 'Sélection 1', new_sel.label
|
47
|
+
assert_equal 'selection-1', new_sel.reference
|
48
|
+
assert_equal({created: 0, updated: 0, deleted: 0,
|
49
|
+
selections: [{apidae_id: 49063, reference: 'selection-1', objects: 1}]}, @result)
|
50
|
+
end
|
51
|
+
|
52
|
+
test "existing selection update" do
|
53
|
+
obj = Obj.create(apidae_id: 503, title: 'Société des contrebassistes aixois')
|
54
|
+
Obj.create(apidae_id: 504, title: 'Société des contrebassistes aixois')
|
55
|
+
sel = Selection.create(apidae_id: 49063, label: 'Sélection 2', reference: 'selection-2')
|
56
|
+
sel.objects << obj
|
57
|
+
assert_equal 1, sel.objects.count
|
58
|
+
objects_json = File.read('test/data/update_selections.json')
|
59
|
+
FileImport.add_or_update_selections(objects_json, @result)
|
60
|
+
assert_equal 1, Selection.count
|
61
|
+
assert_equal 49063, sel.apidae_id
|
62
|
+
assert_equal 'Sélection 2', sel.label
|
63
|
+
assert_equal 'selection-2', sel.reference
|
64
|
+
assert_equal({created: 0, updated: 0, deleted: 0,
|
65
|
+
selections: [{apidae_id: 49063, reference: 'selection-2', objects: 2}]}, @result)
|
66
|
+
end
|
67
|
+
|
68
|
+
test "existing selection deletion" do
|
69
|
+
Selection.create(apidae_id: 49063, label: 'Sélection 3', reference: 'selection-3')
|
70
|
+
objects_json = File.read('test/data/delete_selections.json')
|
71
|
+
assert_equal 1, Selection.count
|
72
|
+
FileImport.add_or_update_selections(objects_json, @result)
|
73
|
+
assert_equal 0, Selection.count
|
74
|
+
end
|
75
|
+
|
76
|
+
test "full import process" do
|
77
|
+
Obj.create(apidae_id: 123, title: 'Objet à supprimer')
|
78
|
+
Obj.create(apidae_id: 4826186, title: 'Objet à mettre à jour')
|
79
|
+
result = FileImport.import('test/data/json_export.zip')
|
80
|
+
assert_equal 2, Selection.all.count
|
81
|
+
assert_equal 5, Obj.all.count
|
82
|
+
assert_equal({created: 4, updated: 1, deleted: 1, selections: [
|
83
|
+
{apidae_id: 49063, reference: 'selection-1', objects: 2},
|
84
|
+
{apidae_id: 49073, reference: 'selection-2', objects: 3}
|
85
|
+
]}, result)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Apidae
|
4
|
-
class ObjectTest < ActiveSupport::TestCase
|
5
|
-
# test "the truth" do
|
6
|
-
# assert true
|
7
|
-
# end
|
8
|
-
end
|
9
|
-
end
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Apidae
|
4
|
+
class ObjectTest < ActiveSupport::TestCase
|
5
|
+
# test "the truth" do
|
6
|
+
# assert true
|
7
|
+
# end
|
8
|
+
end
|
9
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Apidae
|
4
|
-
class ReferenceTest < ActiveSupport::TestCase
|
5
|
-
# test "the truth" do
|
6
|
-
# assert true
|
7
|
-
# end
|
8
|
-
end
|
9
|
-
end
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Apidae
|
4
|
+
class ReferenceTest < ActiveSupport::TestCase
|
5
|
+
# test "the truth" do
|
6
|
+
# assert true
|
7
|
+
# end
|
8
|
+
end
|
9
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Apidae
|
4
|
-
class SelectionObjectTest < ActiveSupport::TestCase
|
5
|
-
# test "the truth" do
|
6
|
-
# assert true
|
7
|
-
# end
|
8
|
-
end
|
9
|
-
end
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Apidae
|
4
|
+
class SelectionObjectTest < ActiveSupport::TestCase
|
5
|
+
# test "the truth" do
|
6
|
+
# assert true
|
7
|
+
# end
|
8
|
+
end
|
9
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Apidae
|
4
|
-
class SelectionTest < ActiveSupport::TestCase
|
5
|
-
# test "the truth" do
|
6
|
-
# assert true
|
7
|
-
# end
|
8
|
-
end
|
9
|
-
end
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Apidae
|
4
|
+
class SelectionTest < ActiveSupport::TestCase
|
5
|
+
# test "the truth" do
|
6
|
+
# assert true
|
7
|
+
# end
|
8
|
+
end
|
9
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Apidae
|
4
|
-
class TownTest < ActiveSupport::TestCase
|
5
|
-
# test "the truth" do
|
6
|
-
# assert true
|
7
|
-
# end
|
8
|
-
end
|
9
|
-
end
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Apidae
|
4
|
+
class TownTest < ActiveSupport::TestCase
|
5
|
+
# test "the truth" do
|
6
|
+
# assert true
|
7
|
+
# end
|
8
|
+
end
|
9
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -1,22 +1,22 @@
|
|
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
|
-
ActiveSupport::TestCase.fixtures []
|
22
|
-
end
|
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
|
+
ActiveSupport::TestCase.fixtures []
|
22
|
+
end
|