canvas_sync 0.17.0.beta1 → 0.17.0.beta6

Sign up to get free protection for your applications and to get access to all the features.
@@ -182,12 +182,12 @@ RSpec.describe CanvasSync::JobBatches::Batch do
182
182
  context 'complete' do
183
183
  before { batch.on(:complete, Object) }
184
184
  # before { batch.increment_job_queue(bid) }
185
- before { batch.jobs do TestWorker.perform_async end }
186
- before { CanvasSync::JobBatches::Batch.process_failed_job(bid, 'failed-job-id') }
185
+ # before { batch.jobs do TestWorker.perform_async end }
186
+ # before { CanvasSync::JobBatches::Batch.process_failed_job(bid, 'failed-job-id') }
187
187
 
188
188
  it 'tries to call complete callback' do
189
189
  expect(CanvasSync::JobBatches::Batch).to receive(:enqueue_callbacks).with(:complete, bid)
190
- CanvasSync::JobBatches::Batch.process_successful_job(bid, 'failed-job-id')
190
+ CanvasSync::JobBatches::Batch.process_failed_job(bid, 'failed-job-id')
191
191
  end
192
192
  end
193
193
 
@@ -199,6 +199,15 @@ RSpec.describe CanvasSync::JobBatches::Batch do
199
199
  CanvasSync::JobBatches::Batch.process_successful_job(bid, jid)
200
200
  end
201
201
 
202
+ it 'tries to call success callback after a previous failure' do
203
+ expect(CanvasSync::JobBatches::Batch).to receive(:enqueue_callbacks).with(:complete, bid).ordered
204
+ CanvasSync::JobBatches::Batch.process_failed_job(bid, jid)
205
+
206
+ expect(CanvasSync::JobBatches::Batch).to receive(:enqueue_callbacks).with(:complete, bid).ordered
207
+ expect(CanvasSync::JobBatches::Batch).to receive(:enqueue_callbacks).with(:success, bid).ordered
208
+ CanvasSync::JobBatches::Batch.process_successful_job(bid, jid)
209
+ end
210
+
202
211
  it 'cleanups redis key' do
203
212
  CanvasSync::JobBatches::Batch.process_successful_job(bid, jid)
204
213
  expect(CanvasSync::JobBatches::Batch.redis { |r| r.get("BID-#{bid}-pending") }.to_i).to eq(0)
@@ -2,19 +2,16 @@ require 'spec_helper'
2
2
 
3
3
  class WorkerA < BatchTestJobBase
4
4
  def perform
5
- puts 'A'
6
5
  end
7
6
  end
8
7
 
9
8
  class WorkerB < BatchTestJobBase
10
9
  def perform
11
- puts 'B'
12
10
  end
13
11
  end
14
12
 
15
13
  class WorkerC < BatchTestJobBase
16
14
  def perform
17
- puts 'C'
18
15
  end
19
16
  end
20
17
 
@@ -19,6 +19,13 @@ Sidekiq::Testing.fake!
19
19
  require 'fakeredis/rspec'
20
20
  Dir[File.dirname(__FILE__) + "/job_batching/support/**/*.rb"].each {|f| require f }
21
21
 
22
+ # Fix an issue with fakeredis with Redis >=4.2
23
+ class Redis::Connection::Memory
24
+ def exists(*keys)
25
+ keys.count { |key| data.key?(key) }
26
+ end
27
+ end
28
+
22
29
  ActiveRecord::Migration.maintain_test_schema!
23
30
 
24
31
  RSpec.configure do |config|
@@ -0,0 +1,3 @@
1
+ canvas_course_id,course_id,integration_id,short_name,long_name,canvas_account_id,account_id,canvas_term_id,term_id,status,start_date,end_date,course_format,created_by_sis
2
+ 1,course_sis_id_1,,C1,Course #1,1,,1,term_sis_id_1,active,2017-03-27T15:53:18-06:00,2017-04-27T06:21:18-06:00,,FALSE
3
+ 2,course_sis_id_2,,C2,Course #2,1,,1,term_sis_id_2,unpublished,2017-03-27T15:53:18-06:00,2017-04-27T06:21:18-06:00,,FALSE
@@ -0,0 +1,4 @@
1
+ canvas_user_id,user_id,integration_id,authentication_provider_id,login_id,first_name,last_name,full_name,sortable_name,short_name,email,status,created_by_sis
2
+ 1,sis_id_1,,123,spiderdude1337,Patches,the Spider,Patches the Spider,"the Spider, Patches",,poorbastard@yharnam.com,active,FALSE
3
+ 2,sis_id_2,,1234,retireddude109,Hunter,Djura,Hunter Djura,"Djura, Hunter",,dreamer@yharnam.com,active,FALSE
4
+ 2,sis_id_2,,1234,retireddude110,Hunter,Djura,Hunter Djura,"Djura, Hunter",,dreamer@yharnam.com,active,FALSE
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canvas_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0.beta1
4
+ version: 0.17.0.beta6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nate Collings
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-20 00:00:00.000000000 Z
11
+ date: 2020-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -280,14 +280,14 @@ dependencies:
280
280
  name: redis
281
281
  requirement: !ruby/object:Gem::Requirement
282
282
  requirements:
283
- - - "<"
283
+ - - ">="
284
284
  - !ruby/object:Gem::Version
285
285
  version: '4.2'
286
286
  type: :runtime
287
287
  prerelease: false
288
288
  version_requirements: !ruby/object:Gem::Requirement
289
289
  requirements:
290
- - - "<"
290
+ - - ">="
291
291
  - !ruby/object:Gem::Version
292
292
  version: '4.2'
293
293
  - !ruby/object:Gem::Dependency
@@ -346,7 +346,7 @@ dependencies:
346
346
  - - ">="
347
347
  - !ruby/object:Gem::Version
348
348
  version: '0'
349
- description:
349
+ description:
350
350
  email:
351
351
  - ncollings@instructure.com
352
352
  executables: []
@@ -576,6 +576,9 @@ files:
576
576
  - spec/dummy/db/migrate/20200416214248_create_group_memberships.rb
577
577
  - spec/dummy/db/migrate/20201016181346_create_pseudonyms.rb
578
578
  - spec/dummy/db/schema.rb
579
+ - spec/dummy/db/test.sqlite3
580
+ - spec/dummy/log/development.log
581
+ - spec/dummy/log/test.log
579
582
  - spec/factories/account_factory.rb
580
583
  - spec/factories/admin_factory.rb
581
584
  - spec/factories/assignment_factory.rb
@@ -620,6 +623,8 @@ files:
620
623
  - spec/support/fixtures/reports/group_memberships.csv
621
624
  - spec/support/fixtures/reports/groups.csv
622
625
  - spec/support/fixtures/reports/provisioning_csv
626
+ - spec/support/fixtures/reports/provisioning_csv_unzipped/courses.csv
627
+ - spec/support/fixtures/reports/provisioning_csv_unzipped/users.csv
623
628
  - spec/support/fixtures/reports/sections.csv
624
629
  - spec/support/fixtures/reports/submissions.csv
625
630
  - spec/support/fixtures/reports/users.csv
@@ -627,7 +632,7 @@ files:
627
632
  homepage: https://instructure.com
628
633
  licenses: []
629
634
  metadata: {}
630
- post_install_message:
635
+ post_install_message:
631
636
  rdoc_options: []
632
637
  require_paths:
633
638
  - lib
@@ -642,9 +647,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
642
647
  - !ruby/object:Gem::Version
643
648
  version: 1.3.1
644
649
  requirements: []
645
- rubyforge_project:
646
- rubygems_version: 2.5.2.1
647
- signing_key:
650
+ rubygems_version: 3.1.2
651
+ signing_key:
648
652
  specification_version: 4
649
653
  summary: Gem for generating Canvas models and migrations and syncing data from Canvas
650
654
  test_files:
@@ -765,6 +769,9 @@ test_files:
765
769
  - spec/dummy/db/migrate/20200416214248_create_group_memberships.rb
766
770
  - spec/dummy/db/migrate/20201016181346_create_pseudonyms.rb
767
771
  - spec/dummy/db/schema.rb
772
+ - spec/dummy/db/test.sqlite3
773
+ - spec/dummy/log/development.log
774
+ - spec/dummy/log/test.log
768
775
  - spec/factories/account_factory.rb
769
776
  - spec/factories/admin_factory.rb
770
777
  - spec/factories/assignment_factory.rb
@@ -809,6 +816,8 @@ test_files:
809
816
  - spec/support/fixtures/reports/group_memberships.csv
810
817
  - spec/support/fixtures/reports/groups.csv
811
818
  - spec/support/fixtures/reports/provisioning_csv
819
+ - spec/support/fixtures/reports/provisioning_csv_unzipped/courses.csv
820
+ - spec/support/fixtures/reports/provisioning_csv_unzipped/users.csv
812
821
  - spec/support/fixtures/reports/sections.csv
813
822
  - spec/support/fixtures/reports/submissions.csv
814
823
  - spec/support/fixtures/reports/users.csv