Sha256: c5ae1ac89a684475d1704a26213d3658dba8a736e09861da39f33bd024798b90
Contents?: true
Size: 1.95 KB
Versions: 9
Compression:
Stored size: 1.95 KB
Contents
require 'simplecov' SimpleCov.start require 'tmpdir' require 'rbatch/variables' describe RBatch::Variables do before :all do @home = File.join(Dir.tmpdir, "rbatch_test_" + Time.now.strftime("%Y%m%d%H%M%S")) end before :each do ENV["RB_HOME"]=@home end it "default" do @vars = RBatch::Variables.new() #expect(@vars[:host_name]).to eq "" #expect(@vars[:program_name]).to eq "rspec" #expect(@vars[:program_path]).to eq "rspec" expect(@vars[:program_base]).to eq "rspec" expect(@vars[:home_dir]).to eq @home expect(@vars[:log_dir]).to eq File.join(@home,"log") expect(@vars[:conf_dir]).to eq File.join(@home,"conf") expect(@vars[:lib_dir]).to eq File.join(@home,"lib") expect(@vars[:run_conf_path]).to eq File.join(@home,".rbatchrc") expect(@vars[:config_path]).to eq File.join(@home,"conf","rspec.yaml") expect(@vars[:common_config_path]).to eq File.join(@home,"conf","common.yaml") expect(@vars.run_conf[:log_dir]).to eq "<home>/log" expect(@vars.run_conf[:conf_dir]).to eq "<home>/conf" expect(@vars.run_conf[:lib_dir]).to eq "<home>/lib" expect(@vars.run_conf[:log_name]).to eq "<date>_<time>_<prog>.log" expect(@vars[:log_name]).to_not eq "<date>_<time>_<prog>.log" end it "success when ENV Change" do ENV["RB_HOME"]="/var" @vars = RBatch::Variables.new() expect(@vars[:home_dir]).to eq "/var" expect(@vars[:log_dir]).to eq File.join("/var","log") end describe "merge!" do it "success" do @vars = RBatch::Variables.new() @vars.merge!({:log_name => "hoge"}) expect(@vars[:log_name]).to eq "hoge" end end describe "run conf" do it "return runconf value via method missing" do @vars = RBatch::Variables.new() expect(@vars[:log_level]).to eq "info" end it "raise when key does not exist in run_conf" do @vars = RBatch::Variables.new() expect{@vars[:hoge]}.to raise_error RBatch::VariablesException end end end
Version data entries
9 entries across 9 versions & 1 rubygems