apidae 1.3.2 → 1.3.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -166,6 +166,29 @@ module Apidae
166
166
  assert_equal 0, Selection.count
167
167
  end
168
168
 
169
+ test "object deletion cancelled if used by another project" do
170
+ proj = Project.create(apidae_id: 123)
171
+ other_proj = Project.create(apidae_id: 456)
172
+ sel = Selection.create(apidae_id: 49063, apidae_project_id: proj.id, label: 'Sélection 2', reference: 'selection-2')
173
+ other_sel = Selection.create(apidae_id: 49999, apidae_project_id: other_proj.id, label: 'Sélection 99', reference: 'selection-99')
174
+ sel.objects << Obj.create(apidae_id: 503, title: 'Société des violoncellistes aixois')
175
+ sel.objects << Obj.create(apidae_id: 504, title: 'Société des contrebassistes aixois')
176
+ other_sel.objects << Obj.find_by_apidae_id(504)
177
+
178
+ assert_equal 2, sel.objects.count
179
+ assert_equal 1, other_sel.objects.count
180
+
181
+ selections_json = File.read('test/data/shared_selections.json')
182
+ FileImport.add_or_update_selections(proj, selections_json, @result)
183
+ deletion_json = File.read('test/data/deletion.json')
184
+ FileImport.delete_objects(deletion_json, @result)
185
+
186
+ assert_equal 2, Obj.count
187
+ assert_equal({created: 0, updated: 0, deleted: 1, selections:
188
+ [{:apidae_id=>49063, :reference=>"selection-2", :objects=>1}]}, @result)
189
+ assert_equal 1, other_sel.objects.count
190
+ end
191
+
169
192
  test "full import process" do
170
193
  Obj.create(apidae_id: 123, title: 'Objet à supprimer')
171
194
  Obj.create(apidae_id: 4826186, title: 'Objet à mettre à jour')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apidae
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean-Baptiste Vilain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-02 00:00:00.000000000 Z
11
+ date: 2021-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -190,6 +190,7 @@ files:
190
190
  - db/migrate/20200522124205_rename_objs_contact_to_contact_data.rb
191
191
  - db/migrate/20200528101957_add_is_active_to_apidae_references.rb
192
192
  - db/migrate/20201112080847_create_apidae_territories.rb
193
+ - db/migrate/20210607214647_add_apidae_type_to_apidae_territories.rb
193
194
  - lib/apidae.rb
194
195
  - lib/apidae/engine.rb
195
196
  - lib/apidae/version.rb
@@ -208,10 +209,12 @@ files:
208
209
  - test/data/hot_fr_en.json
209
210
  - test/data/json_export.zip
210
211
  - test/data/selections.json
212
+ - test/data/shared_selections.json
211
213
  - test/data/structure.json
212
214
  - test/data/update_selections.json
213
215
  - test/dummy/README.rdoc
214
216
  - test/dummy/Rakefile
217
+ - test/dummy/app/assets/config/manifest.js
215
218
  - test/dummy/app/assets/javascripts/application.js
216
219
  - test/dummy/app/assets/stylesheets/application.css
217
220
  - test/dummy/app/controllers/application_controller.rb
@@ -284,13 +287,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
284
287
  version: '0'
285
288
  requirements: []
286
289
  rubyforge_project:
287
- rubygems_version: 2.6.13
290
+ rubygems_version: 2.7.6.2
288
291
  signing_key:
289
292
  specification_version: 4
290
293
  summary: A Ruby on Rails engine for projects that involve Apidae data
291
294
  test_files:
292
295
  - test/dummy/app/controllers/application_controller.rb
293
296
  - test/dummy/app/views/layouts/application.html.erb
297
+ - test/dummy/app/assets/config/manifest.js
294
298
  - test/dummy/app/assets/javascripts/application.js
295
299
  - test/dummy/app/assets/stylesheets/application.css
296
300
  - test/dummy/app/helpers/application_helper.rb
@@ -350,6 +354,7 @@ test_files:
350
354
  - test/controllers/apidae/dashboard_controller_test.rb
351
355
  - test/controllers/apidae/references_controller_test.rb
352
356
  - test/controllers/apidae/import_controller_test.rb
357
+ - test/data/shared_selections.json
353
358
  - test/data/equ_groups.json
354
359
  - test/data/update_selections.json
355
360
  - test/data/json_export.zip