This repository was archived by the owner on Oct 22, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +85
-0
lines changed
spec/lib/wpxf/modules/auxiliary/file_download Expand file tree Collapse file tree 2 files changed +85
-0
lines changed Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../../../spec_helper'
4
+ require 'wpxf/modules'
5
+
6
+ describe Wpxf ::Auxiliary ::WpVaultFileDownload do
7
+ let ( :subject ) { described_class . new }
8
+
9
+ before :each , 'setup subject' do
10
+ allow ( subject ) . to receive ( :check_plugin_version_from_readme )
11
+ end
12
+
13
+ it 'should check that the plugin is installed' do
14
+ subject . check
15
+ expect ( subject ) . to have_received ( :check_plugin_version_from_readme )
16
+ . with ( 'wp-vault' )
17
+ . exactly ( 1 ) . times
18
+ end
19
+
20
+ it 'should configure the default remote file path' do
21
+ expected = '../../../../license.txt'
22
+ expect ( subject . default_remote_file_path ) . to eql expected
23
+ end
24
+
25
+ it 'should configure the working directory' do
26
+ expected = 'wp-content/plugins/wp-vault/images/'
27
+ expect ( subject . working_directory ) . to eql expected
28
+ end
29
+
30
+ it 'should configure the downloader url' do
31
+ expect ( subject . downloader_url ) . to eql subject . full_uri
32
+ end
33
+
34
+ it 'should configure the download request parameters' do
35
+ subject . set_option_value ( 'remote_file' , 'license.txt' )
36
+ expect ( subject . download_request_params ) . to eql (
37
+ 'wpv-image' => 'license.txt'
38
+ )
39
+ end
40
+
41
+ it 'should GET the download request' do
42
+ expect ( subject . download_request_method ) . to eql :get
43
+ end
44
+ end
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../../../../spec_helper'
4
+ require 'wpxf/modules'
5
+
6
+ describe Wpxf ::Auxiliary ::WptfImageGalleryArbitraryFileDownload do
7
+ let ( :subject ) { described_class . new }
8
+
9
+ before :each , 'setup subject' do
10
+ allow ( subject ) . to receive ( :check_plugin_version_from_readme )
11
+ end
12
+
13
+ it 'should check that the plugin is installed' do
14
+ subject . check
15
+ expect ( subject ) . to have_received ( :check_plugin_version_from_readme )
16
+ . with ( 'wptf-image-gallery' )
17
+ . exactly ( 1 ) . times
18
+ end
19
+
20
+ it 'should configure the working directory' do
21
+ expected = 'wp-content/plugins/wptf-image-gallery/lib-mbox/'
22
+ expect ( subject . working_directory ) . to eql expected
23
+ end
24
+
25
+ it 'should configure the default remote file path' do
26
+ expected = '../../../../wp-config.php'
27
+ expect ( subject . default_remote_file_path ) . to eql expected
28
+ end
29
+
30
+ it 'should configure the download request parameters' do
31
+ subject . set_option_value ( 'remote_file' , 'wp-config.php' )
32
+ expect ( subject . download_request_params ) . to eql (
33
+ 'url' => 'wp-config.php'
34
+ )
35
+ end
36
+
37
+ it 'should configure the downloader url' do
38
+ expected = %r{plugins/wptf\- image\- gallery/lib\- mbox/ajax_load\. php$}
39
+ expect ( subject . downloader_url ) . to match expected
40
+ end
41
+ end
You can’t perform that action at this time.
0 commit comments