Sha256: 0a2ac400b38fe204210615a0e80bc7bfbaf6804618d40f42306af5250d511d99

Contents?: true

Size: 1.5 KB

Versions: 1

Compression:

Stored size: 1.5 KB

Contents

require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
require 'albacore/albacoremodel'

class YamlTest
  include AlbacoreModel
  attr_accessor :some_name, :another_name, :a_hash, :what_ever
end

describe YAMLConfig, "when configuring with yaml" do
  before :all do
    @yml = YamlTest.new
    @yml.configure File.join(File.dirname(__FILE__), 'support', 'test.yml')
  end
  
  it "should set the value of some_name" do
    @yml.some_name.should == "some value"
  end
  
  it "should create and set the value of another_name" do
    @yml.another_name.should == "another value"
  end
      
  it "should allow hash tables" do
    @yml.a_hash.length.should == 2
    @yml.a_hash['name'].should == "value"
    @yml.a_hash['foo'].should == "bar"
  end
  
  it "should allow symbols" do
    @yml.what_ever.should == :a_symbol
  end  
end

describe YAMLConfig, "when specifying a yaml config folder and configuring" do
  class YAML_AutoConfig_Test
  	include AlbacoreModel
    attr_accessor :some_attribute
  end
  
  before :all do
  	Albacore.configure.yaml_config_folder = File.join(File.dirname(__FILE__), 'support', 'yamlconfig')
    @yamltest = YAML_AutoConfig_Test.new
    @yamltest.load_config_by_task_name("yaml_autoconfig_test")
  end
  
  it "should automatically configure the class from the yaml file in the specified folder" do
    @yamltest.some_attribute.should == "this value was loaded from a folder, specified by Albacore.configure.yaml_config_folder"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
albacore-0.2.0.preview1 spec/yamlconfig_spec.rb