rock_config 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,9 +19,8 @@ module RockConfig
19
19
  private
20
20
 
21
21
  def fetch(key, default = nil)
22
- if value = @hash[key.to_s]
23
- return value_or_config(value)
24
- end
22
+ value = @hash[key.to_s]
23
+ value_or_config(value) unless value.nil?
25
24
  end
26
25
 
27
26
  def value_or_config(value)
@@ -1,3 +1,3 @@
1
1
  module RockConfig
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/spec/config_spec.rb CHANGED
@@ -27,7 +27,7 @@ module RockConfig
27
27
  config.for_environment("I do not exist").should be_nil
28
28
  end
29
29
 
30
- it "returns correct values when asked for" do
30
+ it "returns correct values" do
31
31
  hash = {
32
32
  "development" => {
33
33
  "host" => "localhost"
@@ -38,7 +38,20 @@ module RockConfig
38
38
  config.development.host.should eq("localhost")
39
39
  end
40
40
 
41
- it "returns correct nested values when asked for" do
41
+ it "returns correct boolean values" do
42
+ hash = {
43
+ "development" => {
44
+ "test_mode" => true,
45
+ "computer_says" => false
46
+ }
47
+ }
48
+
49
+ config = Config.new(hash)
50
+ config.development.test_mode.should == true
51
+ config.development.computer_says.should == false
52
+ end
53
+
54
+ it "returns correct nested values" do
42
55
  hash = {
43
56
  "development" => {
44
57
  "elastic" => {
@@ -1,5 +1,7 @@
1
1
  development:
2
2
  magic_number: 213
3
+ test_false: false
4
+ test_true: true
3
5
 
4
6
  test:
5
7
  magic_number: 214
@@ -8,7 +8,10 @@ module RockConfig
8
8
  config.config_loaders << YamlLoader.new
9
9
  end
10
10
 
11
- RockConfig.for("database", "development").magic_number.should eq(213)
11
+ config = RockConfig.for("database", "development")
12
+ config.magic_number.should eq(213)
13
+ config.test_false.should == false
14
+ config.test_true.should == true
12
15
  end
13
16
  end
14
17
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rock_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-20 00:00:00.000000000 Z
12
+ date: 2013-03-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake