lopata 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lopata/download_dir.rb +27 -13
- data/lib/lopata/rspec/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56108e1ffcf22287982f8e617e9f9a27778e238c
|
4
|
+
data.tar.gz: f7093a50a727e8bb0c6a740e908518bba6c09f70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fc7790fec095b90370790fd04c8916bd64d6b13c0782caf01d25fbc0d0b9a330b0f1363db872af6992c0c7c3b094f3fc11ea1a3fb9a76dcb155bce810ec8928
|
7
|
+
data.tar.gz: 9b679b7f7c0d03dd4cd13539b471954c3d9a133b72605447566b61b643ec718c96cb8d768fd14393cc77323c8067a08124ede90dfb7592f507db533155ecd4a7
|
data/lib/lopata/download_dir.rb
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
module Lopata
|
2
2
|
module DownloadDir
|
3
|
-
RELATIVE_PATH = '
|
3
|
+
RELATIVE_PATH = File.join('.', 'tmp', 'target')
|
4
4
|
|
5
5
|
extend self
|
6
6
|
|
7
7
|
def path
|
8
|
-
@path ||= File.absolute_path(RELATIVE_PATH)
|
8
|
+
@path ||= File.absolute_path(RELATIVE_PATH)
|
9
9
|
end
|
10
10
|
|
11
11
|
def empty!
|
12
|
-
FileUtils.rm Dir.glob(
|
12
|
+
FileUtils.rm Dir.glob(File.join(path, '*'))
|
13
13
|
end
|
14
14
|
|
15
15
|
def ensure_exist
|
16
|
-
FileUtils::mkdir_p
|
16
|
+
FileUtils::mkdir_p path unless Dir.exist?(path)
|
17
17
|
end
|
18
18
|
|
19
19
|
def has_file?(file_name)
|
20
20
|
require 'timeout'
|
21
|
-
target_file =
|
21
|
+
target_file = filepath(file_name)
|
22
22
|
Timeout.timeout(10) do
|
23
23
|
sleep 0.1 until File.exist?(target_file)
|
24
24
|
true
|
@@ -27,24 +27,38 @@ module Lopata
|
|
27
27
|
false
|
28
28
|
end
|
29
29
|
|
30
|
+
def filepath(name)
|
31
|
+
File.join(path, name)
|
32
|
+
end
|
33
|
+
|
30
34
|
def init_capybara
|
35
|
+
target_path = path
|
36
|
+
target_path = target_path.gsub('/', '\\') if Gem.win_platform?
|
37
|
+
|
31
38
|
profile = Selenium::WebDriver::Firefox::Profile.new
|
32
39
|
profile['browser.download.folderList'] = 2
|
33
40
|
profile['browser.download.manager.showWhenStarting'] = false
|
34
41
|
ensure_exist
|
35
|
-
profile['browser.download.dir'] =
|
36
|
-
profile['browser.download.downloadDir'] =
|
37
|
-
profile['browser.download.defaultFolder'] =
|
42
|
+
profile['browser.download.dir'] = target_path
|
43
|
+
profile['browser.download.downloadDir'] = target_path
|
44
|
+
profile['browser.download.defaultFolder'] = target_path
|
38
45
|
profile['browser.helperApps.alwaysAsk.force'] = false
|
39
46
|
profile['browser.download.useDownloadDir'] = true
|
40
47
|
profile['browser.helperApps.neverAsk.saveToDisk'] =
|
41
|
-
|
48
|
+
%w{
|
49
|
+
application/octet-stream
|
50
|
+
application/msword
|
51
|
+
application/pdf
|
52
|
+
application/x-pdf
|
53
|
+
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
54
|
+
application/vnd.ms-excel
|
55
|
+
}.join(', ')
|
56
|
+
profile['pdfjs.disabled'] = true
|
57
|
+
profile['plugin.scan.Acrobat'] = "99.0"
|
58
|
+
profile['plugin.scan.plid.all'] = false
|
42
59
|
|
43
60
|
Capybara.register_driver :selenium_with_download do |app|
|
44
|
-
Capybara::Selenium::Driver.new(
|
45
|
-
app,
|
46
|
-
{:browser => :firefox, :profile => profile}
|
47
|
-
)
|
61
|
+
Capybara::Selenium::Driver.new(app, browser: :firefox, profile: profile)
|
48
62
|
end
|
49
63
|
|
50
64
|
Capybara.default_driver = :selenium_with_download
|
data/lib/lopata/rspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lopata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey Volochnev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -86,5 +86,5 @@ rubyforge_project:
|
|
86
86
|
rubygems_version: 2.2.5
|
87
87
|
signing_key:
|
88
88
|
specification_version: 4
|
89
|
-
summary: lopata-0.0.
|
89
|
+
summary: lopata-0.0.11
|
90
90
|
test_files: []
|