configloader 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/configloader.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{configloader}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Vinicius Teles"]
data/lib/config_loader.rb CHANGED
@@ -42,7 +42,9 @@ module ConfigLoader
42
42
  # db_config = ConfigLoader.load('database', 'production')
43
43
  # db_config = ConfigLoader.load('database', 'test', '/home/user/my_special_project_root')
44
44
  def self.load(file_name, running_env = Rails.env, project_root = RAILS_ROOT)
45
- ConfigLoader::Map.new(file_name, running_env, project_root).populate
45
+ map = ConfigLoader::Map.new(file_name, running_env, project_root)
46
+ map.populate
47
+ map
46
48
  end
47
49
 
48
50
  end
@@ -1,4 +1,5 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+ require 'yaml'
2
3
 
3
4
  module ConfigLoader
4
5
 
@@ -6,24 +6,27 @@ describe "ConfigLoader" do
6
6
 
7
7
  def prepare_mocks(running_env, project_root)
8
8
  Rails.stub!(:env).and_return(running_env)
9
- map_mock = mock('ConfigLoader::Map')
10
- map_mock.should_receive(:populate).and_return('result')
11
- ConfigLoader::Map.should_receive(:new).with('database', running_env, project_root).and_return(map_mock)
9
+ ConfigLoader::Map.should_receive(:new).with('database', running_env, project_root).and_return(@map_mock)
10
+ @map_mock.should_receive(:populate)
11
+ end
12
+
13
+ before(:each) do
14
+ @map_mock = mock('ConfigLoader::Map')
12
15
  end
13
16
 
14
17
  it "should delegate to ConfigLoader::Map.populate" do
15
18
  prepare_mocks('development', '/home/user/project')
16
- ConfigLoader.load('database').should == 'result'
19
+ ConfigLoader.load('database').should == @map_mock
17
20
  end
18
21
 
19
22
  it "should delegate to ConfigLoader::Map.populate with the given running_env" do
20
23
  prepare_mocks('production', '/home/user/project')
21
- ConfigLoader.load('database', 'production').should == 'result'
24
+ ConfigLoader.load('database', 'production').should == @map_mock
22
25
  end
23
26
 
24
27
  it "should delegate to ConfigLoader::Map.populate with the given project_root" do
25
28
  prepare_mocks('development', '/home/user/another_project')
26
- ConfigLoader.load('database', 'development', '/home/user/another_project').should == 'result'
29
+ ConfigLoader.load('database', 'development', '/home/user/another_project').should == @map_mock
27
30
  end
28
31
 
29
32
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Vinicius Teles