Remove deprecated Capybara.save_and_open_page_path
This commit is contained in:
parent
98b9034842
commit
1ba99e411a
|
@ -731,9 +731,7 @@ module Capybara
|
||||||
#
|
#
|
||||||
# If invoked without arguments it will save file to `Capybara.save_path`
|
# If invoked without arguments it will save file to `Capybara.save_path`
|
||||||
# and file will be given randomly generated filename. If invoked with a relative path
|
# and file will be given randomly generated filename. If invoked with a relative path
|
||||||
# the path will be relative to `Capybara.save_path`, which is different from
|
# the path will be relative to `Capybara.save_path`
|
||||||
# the previous behavior with `Capybara.save_and_open_page_path` where the relative path was
|
|
||||||
# relative to Dir.pwd
|
|
||||||
#
|
#
|
||||||
# @param [String] path the path to where it should be saved
|
# @param [String] path the path to where it should be saved
|
||||||
# @return [String] the path to which the file was saved
|
# @return [String] the path to which the file was saved
|
||||||
|
@ -750,9 +748,7 @@ module Capybara
|
||||||
#
|
#
|
||||||
# If invoked without arguments it will save file to `Capybara.save_path`
|
# If invoked without arguments it will save file to `Capybara.save_path`
|
||||||
# and file will be given randomly generated filename. If invoked with a relative path
|
# and file will be given randomly generated filename. If invoked with a relative path
|
||||||
# the path will be relative to `Capybara.save_path`, which is different from
|
# the path will be relative to `Capybara.save_path`
|
||||||
# the previous behavior with `Capybara.save_and_open_page_path` where the relative path was
|
|
||||||
# relative to Dir.pwd
|
|
||||||
#
|
#
|
||||||
# @param [String] path the path to where it should be saved
|
# @param [String] path the path to where it should be saved
|
||||||
#
|
#
|
||||||
|
@ -767,9 +763,7 @@ module Capybara
|
||||||
#
|
#
|
||||||
# If invoked without arguments it will save file to `Capybara.save_path`
|
# If invoked without arguments it will save file to `Capybara.save_path`
|
||||||
# and file will be given randomly generated filename. If invoked with a relative path
|
# and file will be given randomly generated filename. If invoked with a relative path
|
||||||
# the path will be relative to `Capybara.save_path`, which is different from
|
# the path will be relative to `Capybara.save_path`
|
||||||
# the previous behavior with `Capybara.save_and_open_page_path` where the relative path was
|
|
||||||
# relative to Dir.pwd
|
|
||||||
#
|
#
|
||||||
# @param [String] path the path to where it should be saved
|
# @param [String] path the path to where it should be saved
|
||||||
# @param [Hash] options a customizable set of options
|
# @param [Hash] options a customizable set of options
|
||||||
|
@ -786,9 +780,7 @@ module Capybara
|
||||||
#
|
#
|
||||||
# If invoked without arguments it will save file to `Capybara.save_path`
|
# If invoked without arguments it will save file to `Capybara.save_path`
|
||||||
# and file will be given randomly generated filename. If invoked with a relative path
|
# and file will be given randomly generated filename. If invoked with a relative path
|
||||||
# the path will be relative to `Capybara.save_path`, which is different from
|
# the path will be relative to `Capybara.save_path`
|
||||||
# the previous behavior with `Capybara.save_and_open_page_path` where the relative path was
|
|
||||||
# relative to Dir.pwd
|
|
||||||
#
|
#
|
||||||
# @param [String] path the path to where it should be saved
|
# @param [String] path the path to where it should be saved
|
||||||
# @param [Hash] options a customizable set of options
|
# @param [Hash] options a customizable set of options
|
||||||
|
@ -895,11 +887,7 @@ module Capybara
|
||||||
end
|
end
|
||||||
|
|
||||||
def prepare_path(path, extension)
|
def prepare_path(path, extension)
|
||||||
if config.save_path || config.save_and_open_page_path.nil?
|
|
||||||
path = File.expand_path(path || default_fn(extension), config.save_path)
|
path = File.expand_path(path || default_fn(extension), config.save_path)
|
||||||
else
|
|
||||||
path = File.expand_path(default_fn(extension), config.save_and_open_page_path) if path.nil?
|
|
||||||
end
|
|
||||||
FileUtils.mkdir_p(File.dirname(path))
|
FileUtils.mkdir_p(File.dirname(path))
|
||||||
path
|
path
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,6 @@ Capybara::SpecHelper.spec '#save_page' do
|
||||||
end
|
end
|
||||||
|
|
||||||
after do
|
after do
|
||||||
Capybara.save_and_open_page_path = nil
|
|
||||||
Capybara.save_path = nil
|
Capybara.save_path = nil
|
||||||
Dir.glob("capybara-*.html").each do |file|
|
Dir.glob("capybara-*.html").each do |file|
|
||||||
FileUtils.rm(file)
|
FileUtils.rm(file)
|
||||||
|
@ -104,20 +103,4 @@ Capybara::SpecHelper.spec '#save_page' do
|
||||||
expect(result).to include("Bar")
|
expect(result).to include("Bar")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with deprecated save_and_open_page_path" do
|
|
||||||
it "can store files in a specified directory" do
|
|
||||||
Capybara.save_and_open_page_path = alternative_path
|
|
||||||
@session.save_page
|
|
||||||
path = Dir.glob(alternative_path + "/capybara-*.html").first
|
|
||||||
expect(File.read(path)).to include("Another World")
|
|
||||||
end
|
|
||||||
|
|
||||||
it "returns an absolute path in given directory" do
|
|
||||||
Capybara.save_and_open_page_path = alternative_path
|
|
||||||
result = @session.save_page
|
|
||||||
path = File.expand_path(Dir.glob(alternative_path + "/capybara-*.html").first, alternative_path)
|
|
||||||
expect(result).to eq(path)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,6 @@ Capybara::SpecHelper.spec '#save_screenshot', requires: [:screenshot] do
|
||||||
end
|
end
|
||||||
|
|
||||||
after do
|
after do
|
||||||
Capybara.save_and_open_page_path = nil
|
|
||||||
Capybara.save_path = nil
|
Capybara.save_path = nil
|
||||||
FileUtils.rm_rf alternative_path
|
FileUtils.rm_rf alternative_path
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue