Sha256: 77d7e814be7381f3b186f792fd8dd4dc58141bf12e2966dd4ab3c361d2d46c55

Contents?: true

Size: 814 Bytes

Versions: 3

Compression:

Stored size: 814 Bytes

Contents

require 'spec_helper'

module MyModule
  extend YmlReader

  def self.default_directory
    'default_directory'
  end
end

describe YmlReader do
  context "when configuring the yml directory" do
    before(:each) do
      MyModule.yml_directory = nil
    end
    
    it "should store a yml directory" do
      MyModule.yml_directory = 'some_directory'
      MyModule.yml_directory.should == 'some_directory'
    end

    it "should default to a directory specified by the containing class" do
      MyModule.yml_directory.should == 'default_directory'
    end
  end

  context "when reading yml files" do
    it "should read files from the yml_directory" do
      MyModule.yml_directory = 'conf'
      YAML.should_receive(:load_file).with('conf/test').and_return({})
      MyModule.load('test')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yml_reader-0.3 spec/yml_reader/yml_reader_spec.rb
yml_reader-0.2 spec/yml_reader/yml_reader_spec.rb
yml_reader-0.1 spec/yml_reader/yml_reader_spec.rb