konfa 0.4.1 → 0.4.2

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.
Files changed (2) hide show
  1. data/lib/konfa/rspec.rb +11 -0
  2. metadata +3 -3
@@ -8,6 +8,7 @@ module Konfa
8
8
 
9
9
  def let_config(variable, value, use_klass=@konfa_klass)
10
10
  raise Konfa::UnsupportedVariableError.new(variable) unless use_klass.allowed_variables.has_key?(variable)
11
+ raise Konfa::RSpec::BadValueError.new(value) unless value.kind_of?(String) || value.kind_of?(NilClass)
11
12
 
12
13
  unless @konfa_stubbed_klasses.include?(use_klass)
13
14
  allow(use_klass).to receive(:get).and_call_original
@@ -23,5 +24,15 @@ module Konfa
23
24
  end
24
25
  end
25
26
  end
27
+
28
+ class BadValueError < StandardError
29
+ def initialize(msg)
30
+ @type = msg.class.name
31
+ end
32
+
33
+ def to_s
34
+ "Konfa requires values to be of type String (or NilClass), you passed #{@type}"
35
+ end
36
+ end
26
37
  end
27
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: konfa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -18,9 +18,9 @@ executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
- - lib/konfa.rb
22
21
  - lib/konfa/initializer.rb
23
22
  - lib/konfa/rspec.rb
23
+ - lib/konfa.rb
24
24
  homepage: http://github.com/avidity/konfa
25
25
  licenses:
26
26
  - MIT
@@ -42,7 +42,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
42
42
  version: '0'
43
43
  requirements: []
44
44
  rubyforge_project:
45
- rubygems_version: 1.8.24
45
+ rubygems_version: 1.8.23
46
46
  signing_key:
47
47
  specification_version: 3
48
48
  summary: Application configuration