-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
25 additions
and
22 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 |
---|---|---|
@@ -1,27 +1,30 @@ | ||
# helper functions for tests that use rclone/remote files in files app | ||
# frozen_string_literal: true | ||
|
||
class ActiveSupport::TestCase | ||
# helper functions for tests that use rclone/remote files in files app | ||
|
||
# Avoid using local remote directly to detect cases where the path is valid on both the remote | ||
# and posix file system | ||
def remote_files_conf(root_dir) | ||
{ | ||
OOD_REMOTE_FILES_ENABLED: 'true', | ||
RCLONE_CONFIG_LOCAL_REMOTE_TYPE: 'local', | ||
RCLONE_CONFIG_ALIAS_REMOTE_TYPE: 'alias', | ||
RCLONE_CONFIG_ALIAS_REMOTE_REMOTE: "local_remote:#{root_dir}", | ||
RCLONE_CONFIG: Rails.root.join('test/fixtures/config/rclone/rclone.conf').to_s | ||
} | ||
end | ||
module ActiveSupport | ||
class TestCase | ||
# Avoid using local remote directly to detect cases where the path is valid on both the remote | ||
# and posix file system | ||
def remote_files_conf(root_dir) | ||
{ | ||
OOD_REMOTE_FILES_ENABLED: 'true', | ||
RCLONE_CONFIG_LOCAL_REMOTE_TYPE: 'local', | ||
RCLONE_CONFIG_ALIAS_REMOTE_TYPE: 'alias', | ||
RCLONE_CONFIG_ALIAS_REMOTE_REMOTE: "local_remote:#{root_dir}", | ||
RCLONE_CONFIG: Rails.root.join('test/fixtures/config/rclone/rclone.conf').to_s | ||
} | ||
end | ||
|
||
def with_rclone_conf(root_dir, &block) | ||
conf = remote_files_conf(root_dir) | ||
with_modified_env(conf, &block) | ||
end | ||
def with_rclone_conf(root_dir, &block) | ||
conf = remote_files_conf(root_dir) | ||
with_modified_env(conf, &block) | ||
end | ||
|
||
def with_extra_rclone_conf(root_dir, &block) | ||
conf = remote_files_conf(root_dir) | ||
.merge({OOD_RCLONE_EXTRA_CONFIG: Rails.root.join('test/fixtures/config/rclone/extra_config.conf').to_s}) | ||
with_modified_env(conf, &block) | ||
def with_extra_rclone_conf(root_dir, &block) | ||
conf = remote_files_conf(root_dir) | ||
.merge({ OOD_RCLONE_EXTRA_CONFIG: Rails.root.join('test/fixtures/config/rclone/extra_config.conf').to_s }) | ||
with_modified_env(conf, &block) | ||
end | ||
end | ||
end | ||
end |