Sha256: 0eba554b13b39bd22d3f923a9f2bd4b450c877365a6b206b927a8f09baa5b8f8
Contents?: true
Size: 1.88 KB
Versions: 2
Compression:
Stored size: 1.88 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'drbqs/config/config' require 'drbqs/utility/temporary' describe DRbQS::Config::SSHHost do before(:all) do @dir = DRbQS::Temporary.directory end subject do DRbQS::Config::SSHHost.new(@dir) end it "should return empty data" do subject.get_options('host0').should == [nil, {}] end it "should return path with extension '\.yaml'." do path = File.join(@dir, 'host1.yaml') data = { :abc => 123 } open(path, 'w') do |f| f.print YAML.dump(data) end ary = subject.get_options('host1') ary[0].should == path ary[1].should == data FileUtils.rm(path) end it "should return path with extension '\.yml'." do path = File.join(@dir, 'host2.yml') data = { :abc => 123 } open(path, 'w') do |f| f.print YAML.dump(data) end ary = subject.get_options('host2') ary[0].should == path ary[1].should == data FileUtils.rm(path) end it "should return nil for invalid extension." do path = File.join(@dir, 'host3.txt') data = { :abc => 123 } open(path, 'w') do |f| f.print YAML.dump(data) end subject.get_options('host3').should == [nil, {}] FileUtils.rm(path) end it "should return list of names." do names = ['name1', 'name2', 'name3'] files = names.map do |n| File.join(@dir, n + '.yaml') end data = { :abc => 123 } files.each do |path| open(path, 'w') do |f| f.print YAML.dump(data) end end subject.config_names.should == names.sort FileUtils.rm(files) end it "should return only path." do path = File.join(@dir, 'host4.yml') data = { :abc => 123 } open(path, 'w') do |f| f.print YAML.dump(data) end subject.get_path('host4').should == path FileUtils.rm(path) end after(:all) do DRbQS::Temporary.delete end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
drbqs-0.1.1 | spec/config/ssh_host_spec.rb |
drbqs-0.1.0 | spec/config/ssh_host_spec.rb |