Class: Capybara::HeadlessChrome::Downloads
- Inherits:
-
Object
- Object
- Capybara::HeadlessChrome::Downloads
- Defined in:
- lib/capybara/headless_chrome/downloads.rb
Defined Under Namespace
Classes: NotFound
Instance Method Summary collapse
Instance Method Details
#[](filename) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/capybara/headless_chrome/downloads.rb', line 22 def [] filename Capybara.current_session.document.synchronize do begin File.open(pathname.join(filename)) rescue Errno::ENOENT raise NotFound.new("Couldn't find #{filename} in #{filenames}") end end end |
#dir ⇒ Object
9 10 11 |
# File 'lib/capybara/headless_chrome/downloads.rb', line 9 def dir pathname.to_s end |
#filenames ⇒ Object
18 19 20 |
# File 'lib/capybara/headless_chrome/downloads.rb', line 18 def filenames pathname.entries.reject(&:directory?).map(&:to_s) end |
#reset ⇒ Object
13 14 15 16 |
# File 'lib/capybara/headless_chrome/downloads.rb', line 13 def reset FileUtils.rm_rf(dir) FileUtils.mkdir_p(dir) end |