ドキュメントから:
デフォルトでは、Aruba はファイル操作を実行するディレクトリ tmp/aruba を作成します。
ただし、私のアプリケーションはENV["HOME"]
ファイル ( ) の作成と読み取り~/.foorc
に使用するため、偽の を使用するには Aruba が必要ENV["HOME"]
です。
サポートファイルに設定する必要がありますか、それとも Aruba にそのtmp/aruba
for ファイルを指定する方法はありますENV["HOME"]
か?
これは、私がテストしているコードの抜粋です (明らかに、はるかに高いレベルで Cucumber/Aruba を使用してこれをテストしていますが、ここで重要なのは ENV["HOME"] の使用です):
def initialize config_path = ""
if config_path.empty?
@config_path = File.join ENV["HOME"], ".todotxt.cfg"
else
@config_path = config_path
end
if file_exists?
super @config_path
validate
end
end
def file_exists?
File.exists? @config_path
end
#....
ask_to_create unless @config.file_exists?
#...
仕様:
Scenario: todotxt
Given an empty installation
When I run `todotxt`
Then it should pass with:
"""
Should I create a sample config file? [Y/n]
"""