-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #500 from slovensko-digital/GO-150/do_automatic_bo…
…xify_on_fs_api_connection GO-150 Do automatic boxify on Fs::ApiConnections
- Loading branch information
Showing
7 changed files
with
61 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Fs | ||
class BoxifyAllApiConnectionsJob < ApplicationJob | ||
def perform | ||
Fs::ApiConnection.find_each do |api_connection| | ||
Fs::BoxifyApiConnectionJob.perform_later(api_connection) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Fs | ||
class BoxifyApiConnectionJob < ApplicationJob | ||
def perform(api_connection) | ||
Box.transaction do | ||
api_connection.boxify | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# frozen_string_literal: true | ||
|
||
require "test_helper" | ||
|
||
class Fs::BoxTest < ActiveSupport::TestCase | ||
test "#after_create callback sets syncable value to true if tenant fs_sync feature is enabled" do | ||
tenant = tenants(:accountants) | ||
tenant.enable_feature(:fs_sync) | ||
|
||
box = tenant.boxes.create( | ||
name: 'Test box', | ||
short_name: 'FS TB', | ||
uri: 'dic://sk/0246802', | ||
type: 'Fs::Box', | ||
api_connection: api_connections(:fs_api_connection1) | ||
) | ||
|
||
assert box.reload.syncable | ||
end | ||
|
||
test "#after_create callback sets syncable value to false if tenant fs_sync feature is disabled" do | ||
tenant = tenants(:solver) | ||
|
||
box = tenant.boxes.create( | ||
name: 'Test box', | ||
short_name: 'FS TB', | ||
uri: 'dic://sk/0246802', | ||
type: 'Fs::Box', | ||
api_connection: api_connections(:fs_api_connection2) | ||
) | ||
|
||
assert_not box.reload.syncable | ||
end | ||
end |