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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1a796d710cbcb83848cc552cb0657e314031cebf
4
- data.tar.gz: c06f3fc31cf166d2644eff939f670b99c3f48558
3
+ metadata.gz: 56108e1ffcf22287982f8e617e9f9a27778e238c
4
+ data.tar.gz: f7093a50a727e8bb0c6a740e908518bba6c09f70
5
5
  SHA512:
6
- metadata.gz: 6c2affa91affebc39420090bcf36172d2dbea6d3f0b0be30dc5058f633378683209d99b7a71d2ef977f0af6b5d489a035607e125c52a2fca2725da788937c652
7
- data.tar.gz: e49d0b8d09115cc7b5e8ceb3926c9073938efc666440d87ed02317272ef683ed980dc48721b4720f430f3c1e722a5ff41b245412ff384e68f1424b2879ee4280
6
+ metadata.gz: 5fc7790fec095b90370790fd04c8916bd64d6b13c0782caf01d25fbc0d0b9a330b0f1363db872af6992c0c7c3b094f3fc11ea1a3fb9a76dcb155bce810ec8928
7
+ data.tar.gz: 9b679b7f7c0d03dd4cd13539b471954c3d9a133b72605447566b61b643ec718c96cb8d768fd14393cc77323c8067a08124ede90dfb7592f507db533155ecd4a7
@@ -1,24 +1,24 @@
1
1
  module Lopata
2
2
  module DownloadDir
3
- RELATIVE_PATH = './tmp/target'
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).gsub("/", '\\')
8
+ @path ||= File.absolute_path(RELATIVE_PATH)
9
9
  end
10
10
 
11
11
  def empty!
12
- FileUtils.rm Dir.glob("#{RELATIVE_PATH}/*")
12
+ FileUtils.rm Dir.glob(File.join(path, '*'))
13
13
  end
14
14
 
15
15
  def ensure_exist
16
- FileUtils::mkdir_p RELATIVE_PATH unless Dir.exist?(RELATIVE_PATH)
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 = File.join(RELATIVE_PATH, file_name)
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'] = path
36
- profile['browser.download.downloadDir'] = path
37
- profile['browser.download.defaultFolder'] = path
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
- "application/octet-stream, application/msword, application/pdf, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
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
@@ -1,7 +1,7 @@
1
1
  module Lopata
2
2
  module RSpec
3
3
  module Version
4
- STRING = '0.0.10'
4
+ STRING = '0.0.11'
5
5
  end
6
6
  end
7
7
  end
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.10
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-09-12 00:00:00.000000000 Z
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.10
89
+ summary: lopata-0.0.11
90
90
  test_files: []