app_config 0.7.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,5 +1,8 @@
1
+ .rbenv-*
1
2
  .rvmrc
3
+ .yardoc/
2
4
  *.gem
5
+ coverage/
3
6
  doc/api/
4
7
  pkg/
5
8
  tmp/**/*
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile.lock CHANGED
@@ -1,25 +1,34 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- app_config (0.7.0)
4
+ app_config (0.7.1)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
8
8
  specs:
9
9
  bson (1.3.1)
10
10
  bson_ext (1.3.1)
11
- diff-lcs (1.1.2)
11
+ diff-lcs (1.1.3)
12
+ maruku (0.6.0)
13
+ syntax (>= 1.0.0)
12
14
  mongo (1.3.1)
13
15
  bson (>= 1.3.1)
14
- rspec (2.6.0)
15
- rspec-core (~> 2.6.0)
16
- rspec-expectations (~> 2.6.0)
17
- rspec-mocks (~> 2.6.0)
18
- rspec-core (2.6.2)
19
- rspec-expectations (2.6.0)
20
- diff-lcs (~> 1.1.2)
21
- rspec-mocks (2.6.0)
22
- sqlite3 (1.3.3)
16
+ multi_json (1.3.6)
17
+ rake (0.9.2.2)
18
+ rspec (2.10.0)
19
+ rspec-core (~> 2.10.0)
20
+ rspec-expectations (~> 2.10.0)
21
+ rspec-mocks (~> 2.10.0)
22
+ rspec-core (2.10.1)
23
+ rspec-expectations (2.10.0)
24
+ diff-lcs (~> 1.1.3)
25
+ rspec-mocks (2.10.1)
26
+ simplecov (0.6.4)
27
+ multi_json (~> 1.0)
28
+ simplecov-html (~> 0.5.3)
29
+ simplecov-html (0.5.3)
30
+ syntax (1.0.0)
31
+ yard (0.8.2)
23
32
 
24
33
  PLATFORMS
25
34
  ruby
@@ -27,6 +36,9 @@ PLATFORMS
27
36
  DEPENDENCIES
28
37
  app_config!
29
38
  bson_ext
39
+ maruku
30
40
  mongo
31
- rspec (>= 2.6.0)
32
- sqlite3
41
+ rake
42
+ rspec (~> 2.10.0)
43
+ simplecov
44
+ yard
data/README.md ADDED
@@ -0,0 +1,97 @@
1
+ # AppConfig
2
+
3
+ An easy to use, customizable library to easily store and retrieve application
4
+ (or library) configuration, API keys or basically anything in 'key/value' pairs.
5
+
6
+
7
+ ## Usage
8
+
9
+ Usage is simple. Just pass either a hash of options, or a block, to {AppConfig.setup}.
10
+
11
+ In it's simplest form, you can use it like so:
12
+
13
+ AppConfig.setup(:admin_email => 'admin@example.com')
14
+ # ..or..
15
+ AppConfig.setup do |config|
16
+ config[:admin_email] = 'admin@example.com'
17
+ end
18
+
19
+ # Strings or symbols as keys.
20
+ AppConfig[:admin_email] # => 'admin@example.com'
21
+
22
+ You may also specify the storage method along with options specific to that storage method.
23
+ Check the [wiki](https://github.com/Oshuma/app_config/wiki) for more usage examples.
24
+
25
+
26
+ ## AppConfig::Storage::YAML
27
+
28
+ Given this YAML file:
29
+
30
+ ---
31
+ admin_email: 'admin@example.com'
32
+ api_name: 'Supr Webz 2.0'
33
+ api_key: 'SUPERAWESOMESERVICE'
34
+
35
+ Use it like so:
36
+
37
+ AppConfig.setup(:yaml => '/path/to/app_config.yml')
38
+
39
+ # Later on...
40
+ # Strings or symbols as keys.
41
+ AppConfig['admin_email'] # => 'admin@example.com'
42
+ AppConfig[:api_name] # => 'Supr Webz 2.0'
43
+ AppConfig[:api_key] # => 'SUPERAWESOMESERVICE'
44
+
45
+
46
+ ## AppConfig::Storage::Mongo
47
+
48
+ You can pass a `:mongo` options hash to {AppConfig.setup} which should contain
49
+ configuration values for a Mongo database. Check the {AppConfig::Storage::Mongo::DEFAULTS}
50
+ constant for the default Mongo connection options.
51
+
52
+ mongo_opts = {
53
+ :host => 'localhost', # default
54
+ :database => 'app_config', # default
55
+ :collection => 'app_config' # default
56
+ }
57
+
58
+ AppConfig.setup(:mongo => mongo_opts)
59
+
60
+ AppConfig[:admin_email]
61
+ # => 'admin@example.com'
62
+
63
+ # Override an existing value (saves to the database):
64
+ AppConfig[:admin_email] = 'other_admin@example.com'
65
+
66
+ The values are read/saved (by default) to the `app_config` database and
67
+ `app_config` collection. These defaults can be overridden, however, which
68
+ might lend well to versioned configurations; collection names such as
69
+ `app_config_v1`, `app_config_v2`, etc.
70
+
71
+ AppConfig.setup(:mongo => { :collection => 'app_config_v2' })
72
+
73
+
74
+ ## Environment Mode
75
+
76
+ There's also an 'environment mode' where you can organize the config
77
+ sort of like the Rails database config. Given this YAML file:
78
+
79
+ # Rails.root/config/app_config.yml
80
+ development:
81
+ title: 'Development Mode'
82
+
83
+ production:
84
+ title: 'Production Mode'
85
+
86
+ Set the `:env` option to your desired environment.
87
+
88
+ # Rails.root/config/initializers/app_config.rb
89
+ AppConfig.setup({
90
+ :yaml => "#{Rails.root}/config/app_config.yml",
91
+ :env => Rails.env # or any string
92
+ })
93
+
94
+ # Uses the given environment section of the config.
95
+ AppConfig[:title]
96
+ # => 'Production Mode'
97
+
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'bundler'
2
- require 'rake/rdoctask'
2
+ require 'rdoc/task'
3
3
  require 'rspec/core/rake_task'
4
4
 
5
5
  Bundler::GemHelper.install_tasks
@@ -12,24 +12,22 @@ task :console do
12
12
  end
13
13
 
14
14
  desc 'Run the specs'
15
- RSpec::Core::RakeTask.new(:spec) do |t|
16
- t.rspec_opts = [ "--color" ]
17
- end
15
+ RSpec::Core::RakeTask.new(:spec)
16
+
17
+ task :doc => [ 'doc:clean', 'doc:api' ]
18
18
 
19
- namespace :docs do
20
- Rake::RDocTask.new do |rd|
21
- rd.title = "AppConfig API"
22
- rd.main = "README.rdoc"
23
- rd.rdoc_dir = "#{File.dirname(__FILE__)}/doc/api"
24
- rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
25
- rd.options << "--all"
19
+ namespace :doc do
20
+ require 'yard'
21
+ YARD::Rake::YardocTask.new(:api) do |t|
22
+ t.files = ['README.rdoc', 'lib/**/*.rb']
23
+ t.options = [
24
+ '--output-dir', 'doc/api',
25
+ '--markup', 'markdown'
26
+ ]
26
27
  end
27
- end
28
28
 
29
- desc 'Build the API docs'
30
- task :docs do
31
- Rake::Task['docs:rerdoc'].invoke
32
- STDOUT.puts "Copying Javascript files..."
33
- doc_root = "#{File.dirname(__FILE__)}/doc"
34
- system("cp -r #{doc_root}/js #{doc_root}/api/")
29
+ desc 'Remove YARD Documentation'
30
+ task :clean do
31
+ system("rm -rf #{File.dirname(__FILE__)}/doc/api")
32
+ end
35
33
  end
data/app_config.gemspec CHANGED
@@ -12,15 +12,19 @@ Gem::Specification.new do |s|
12
12
  s.summary = %q{Quick and easy application configuration.}
13
13
  s.description = %q{An easy to use, customizable library to easily store and retrieve application configuration.}
14
14
 
15
- s.add_development_dependency('bson_ext')
16
- s.add_development_dependency('mongo')
17
- s.add_development_dependency('rspec', '>= 2.6.0')
18
- s.add_development_dependency('sqlite3')
15
+ s.add_development_dependency 'bson_ext'
16
+ s.add_development_dependency 'maruku'
17
+ s.add_development_dependency 'mongo'
18
+ s.add_development_dependency 'rake'
19
+ s.add_development_dependency 'rspec', '~> 2.10.0'
20
+ s.add_development_dependency 'simplecov'
21
+ s.add_development_dependency 'yard'
19
22
 
20
23
  s.has_rdoc = true
21
24
  s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
22
25
 
26
+ s.require_paths = ["lib"]
23
27
  s.files = `git ls-files`.split("\n")
28
+
24
29
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
25
- s.require_paths = ["lib"]
26
30
  end
@@ -1,38 +1,32 @@
1
1
  module AppConfig
2
2
 
3
- require 'uri'
4
-
5
3
  # The Base storage class.
6
4
  # Acts as a wrapper for the different storage methods.
7
5
  #
8
6
  # See each storage method's documentation for their specific options.
9
7
  #
10
8
  # Valid storage methods:
11
- # * :memory (AppConfig::Storage::Memory)
12
- # * :mongo (AppConfig::Storage::Mongo)
13
- # * :sqlite (AppConfig::Storage::Sqlite)
14
- # * :yaml (AppConfig::Storage::YAML)
15
- #
16
- # TODO: Purge AppConfig options (ie, those not related to the user-end).
9
+ # * `:memory` - {AppConfig::Storage::Memory AppConfig::Storage::Memory}
10
+ # * `:mongo` - {AppConfig::Storage::Mongo AppConfig::Storage::Mongo}
11
+ # * `:yaml` - {AppConfig::Storage::YAML AppConfig::Storage::YAML}
17
12
  class Base
18
13
 
19
- # TODO: All these DEFAULTS constants are kinda annoying.
20
- DEFAULTS = {
21
- :storage_method => :memory,
22
- }
23
-
24
- # Accepts either a hash of +options+ or a block (which overrides
25
- # any options passed in the hash).
14
+ # Accepts either a hash of `options` or a block (which overrides any options passed in the hash).
26
15
  def initialize(options = {}, &block)
27
- @options = DEFAULTS.merge(options)
28
- yield @options if block_given?
16
+ @options = options
29
17
 
30
- determine_storage_method if @options[:uri]
31
- @storage_method = initialize_storage_method
32
- @storage = @storage_method.data
18
+ if @options[:yaml]
19
+ @storage = AppConfig::Storage::YAML.new(@options.delete(:yaml))
20
+ elsif @options[:mongo]
21
+ @storage = AppConfig::Storage::Mongo.new(@options.delete(:mongo))
22
+ else
23
+ @storage = AppConfig::Storage::Memory.new(@options)
24
+ end
25
+
26
+ yield @storage if block_given?
33
27
  end
34
28
 
35
- # Access the <tt>key</tt>'s value in storage.
29
+ # Access the `key`'s value in storage.
36
30
  def [](key)
37
31
  if storage.respond_to?(:[])
38
32
  storage[key]
@@ -62,7 +56,7 @@ module AppConfig
62
56
  end
63
57
  alias_method :env, :environment
64
58
 
65
- # Returns the <tt>@storage</tt> contents, which is what is exposed
59
+ # Returns the `@storage` contents, which is what is exposed
66
60
  # as the configuration.
67
61
  def storage
68
62
  environment ? @storage[environment] : @storage
@@ -72,36 +66,5 @@ module AppConfig
72
66
  storage.to_hash
73
67
  end
74
68
 
75
- private
76
-
77
- # Sets the storage_method depending on the URI given.
78
- def determine_storage_method
79
- uri = URI.parse(@options.delete(:uri))
80
- case uri.scheme
81
- when 'sqlite'
82
- @options[:storage_method] = :sqlite
83
- @options[:database] = uri.path
84
- when 'yaml'
85
- @options[:storage_method] = :yaml
86
- @options[:path] = uri.path
87
- end
88
- end
89
-
90
- # This decides how to load the data, based on the +storage_method+.
91
- def initialize_storage_method
92
- @storage_method = case @options[:storage_method]
93
- when :memory
94
- AppConfig::Storage::Memory.new(@options)
95
- when :mongo
96
- AppConfig::Storage::Mongo.new(@options)
97
- when :sqlite
98
- AppConfig::Storage::Sqlite.new(@options)
99
- when :yaml
100
- AppConfig::Storage::YAML.new(@options)
101
- else
102
- raise AppConfig::Error::UnknownStorageMethod
103
- end
104
- end
105
-
106
69
  end # Base
107
70
  end # AppConfig
@@ -4,16 +4,26 @@ module AppConfig
4
4
 
5
5
  attr_reader :data
6
6
 
7
- # DEPRECATED
8
- def self.load(options)
9
- STDERR.puts("DEPRECATED: AppConfig::Storage::Base.load() has been deprecated")
10
- new(options).data
11
- end
12
-
13
7
  def initialize(options)
14
8
  @options = options
15
9
  end
16
10
 
11
+ def [](key)
12
+ @data[key]
13
+ end
14
+
15
+ def []=(key, value)
16
+ @data[key] = value
17
+ end
18
+
19
+ def empty?
20
+ @data.empty?
21
+ end
22
+
23
+ def to_hash
24
+ @data.to_hash
25
+ end
26
+
17
27
  end # BaseStorage
18
28
  end # Storage
19
29
  end # AppConfig
@@ -1,24 +1,18 @@
1
- begin
2
- require 'mongo'
3
- rescue LoadError
4
- require 'rubygems'
5
- require 'mongo'
6
- end
7
-
8
1
  module AppConfig
9
2
  module Storage
10
3
 
4
+ require 'mongo'
5
+
11
6
  # Mongo storage method.
12
- # FIXME: Come up with a way of removing stale config entries.
13
7
  class Mongo < Storage::Base
14
8
 
15
9
  DEFAULTS = {
16
- :host => 'localhost',
17
- :port => '27017',
18
- :database => 'app_config',
10
+ :host => 'localhost',
11
+ :port => '27017',
12
+ :database => 'app_config',
19
13
  :collection => 'app_config',
20
- :user => nil,
21
- :password => nil
14
+ :user => nil,
15
+ :password => nil
22
16
  }
23
17
 
24
18
  def initialize(options)
@@ -6,18 +6,13 @@ module AppConfig
6
6
  # YAML storage method.
7
7
  class YAML < Storage::Base
8
8
 
9
- DEFAULTS = {
10
- :path => File.expand_path(File.join(ENV['HOME'], '.app_config.yml'))
11
- }
9
+ DEFAULT_PATH = File.expand_path(File.join(ENV['HOME'], '.app_config.yml'))
12
10
 
13
- # Loads @data with the YAML file located at +path+.
14
- # @data will be the Hashish that is accessed with AppConfig[:key].
11
+ # Loads `@data` with the YAML file located at `path`.
12
+ # `@data` will be the Hashish that is accessed with `AppConfig[:key]`.
15
13
  #
16
- # Defaults to $HOME/.app_config.yml
17
- def initialize(options)
18
- super(DEFAULTS.merge(options))
19
- path = @options[:path] || DEFAULTS[:path]
20
-
14
+ # Defaults to `$HOME/.app_config.yml`
15
+ def initialize(path = DEFAULT_PATH)
21
16
  # Make sure to use the top-level YAML module here.
22
17
  @data = Hashish.new(::YAML.load_file(path))
23
18
  end
@@ -3,7 +3,6 @@ module AppConfig
3
3
  autoload :Base, 'app_config/storage/base'
4
4
  autoload :Memory, 'app_config/storage/memory'
5
5
  autoload :Mongo, 'app_config/storage/mongo'
6
- autoload :Sqlite, 'app_config/storage/sqlite'
7
6
  autoload :YAML, 'app_config/storage/yaml'
8
7
  end
9
8
  end
data/lib/app_config.rb CHANGED
@@ -1,47 +1,49 @@
1
- $LOAD_PATH.unshift File.dirname(__FILE__)
2
-
3
- # AppConfig stuff.
4
1
  require 'core_ext/hashish'
5
2
 
6
3
  module AppConfig
7
- VERSION = '0.7.1'
4
+ VERSION = '1.0.0'
8
5
 
9
- autoload :Base, 'app_config/base'
10
- autoload :Error, 'app_config/error'
6
+ autoload :Base, 'app_config/base'
7
+ autoload :Error, 'app_config/error'
11
8
  autoload :Storage, 'app_config/storage'
12
9
 
13
10
  class << self
14
11
 
15
- # Accepts an +options+ hash or a block.
16
- # See AppConfig::Base for valid storage methods.
17
- # TODO: This should probably return true/false.
12
+ # Accepts an `options` hash or a block.
13
+ # See {AppConfig::Base AppConfig::Base} for valid storage methods.
18
14
  def setup(options = {}, &block)
19
15
  @@storage = AppConfig::Base.new(options, &block)
20
16
  end
21
17
 
22
- # Returns +true+ if +AppConfig.setup()+ has been called.
18
+ # Returns `true` if {AppConfig.setup AppConfig.setup} has been called.
23
19
  def setup?
24
- defined?(@@storage) && !@@storage.empty?
20
+ !!(defined?(@@storage) && !@@storage.empty?)
25
21
  end
26
22
 
27
- # Clears the <tt>@@storage</tt>.
23
+ # Clears the `@@storage`.
28
24
  def reset!
29
- @@storage = Hashish.new
25
+ if defined?(@@storage)
26
+ remove_class_variable(:@@storage)
27
+ true
28
+ else
29
+ false
30
+ end
30
31
  end
31
32
 
32
- # Access the configured <tt>key</tt>'s value.
33
+ # Access the configured `key`'s value.
33
34
  def [](key)
34
35
  setup unless setup?
35
36
  @@storage[key]
36
37
  end
37
38
 
38
- # Set a new <tt>value</tt> for <tt>key</tt> (persistence depends on the type of Storage).
39
+ # Set a new `value` for `key` (persistence depends on the type of Storage).
39
40
  def []=(key, value)
41
+ setup unless setup?
40
42
  @@storage[key] = value
41
43
  end
42
44
 
43
45
  def to_hash
44
- @@storage.to_hash
46
+ setup? ? @@storage.to_hash : Hashish.new
45
47
  end
46
48
 
47
49
  end # self
@@ -1,7 +1,7 @@
1
1
  # Stolen from Rails Active Support and renamed to Hashish.
2
2
  #
3
3
  # This class has dubious semantics and we only have it so that
4
- # people can write params[:key] instead of params['key']
4
+ # people can write `params[:key]` instead of `params['key']`
5
5
  # and they get the same value for both keys.
6
6
  class Hashish < Hash
7
7
  def initialize(constructor = {})
@@ -26,23 +26,21 @@ class Hashish < Hash
26
26
 
27
27
  # Assigns a new value to the hash:
28
28
  #
29
- # hash = HashWithIndifferentAccess.new
30
- # hash[:key] = "value"
31
- #
29
+ # hash = HashWithIndifferentAccess.new
30
+ # hash[:key] = "value"
32
31
  def []=(key, value)
33
32
  regular_writer(convert_key(key), convert_value(value))
34
33
  end
35
34
 
36
35
  # Updates the instantized hash with values from the second:
37
36
  #
38
- # hash_1 = HashWithIndifferentAccess.new
39
- # hash_1[:key] = "value"
40
- #
41
- # hash_2 = HashWithIndifferentAccess.new
42
- # hash_2[:key] = "New Value!"
37
+ # hash_1 = HashWithIndifferentAccess.new
38
+ # hash_1[:key] = "value"
43
39
  #
44
- # hash_1.update(hash_2) # => {"key"=>"New Value!"}
40
+ # hash_2 = HashWithIndifferentAccess.new
41
+ # hash_2[:key] = "New Value!"
45
42
  #
43
+ # hash_1.update(hash_2) # => {"key"=>"New Value!"}
46
44
  def update(other_hash)
47
45
  other_hash.each_pair { |key, value| regular_writer(convert_key(key), convert_value(value)) }
48
46
  self
@@ -52,11 +50,10 @@ class Hashish < Hash
52
50
 
53
51
  # Checks the hash for a key matching the argument passed in:
54
52
  #
55
- # hash = HashWithIndifferentAccess.new
56
- # hash["key"] = "value"
57
- # hash.key? :key # => true
58
- # hash.key? "key" # => true
59
- #
53
+ # hash = HashWithIndifferentAccess.new
54
+ # hash["key"] = "value"
55
+ # hash.key? :key # => true
56
+ # hash.key? "key" # => true
60
57
  def key?(key)
61
58
  super(convert_key(key))
62
59
  end
@@ -65,18 +62,17 @@ class Hashish < Hash
65
62
  alias_method :has_key?, :key?
66
63
  alias_method :member?, :key?
67
64
 
68
- # Fetches the value for the specified key, same as doing hash[key]
65
+ # Fetches the value for the specified key, same as doing `hash[key]`.
69
66
  def fetch(key, *extras)
70
67
  super(convert_key(key), *extras)
71
68
  end
72
69
 
73
70
  # Returns an array of the values at the specified indices:
74
71
  #
75
- # hash = HashWithIndifferentAccess.new
76
- # hash[:a] = "x"
77
- # hash[:b] = "y"
78
- # hash.values_at("a", "b") # => ["x", "y"]
79
- #
72
+ # hash = HashWithIndifferentAccess.new
73
+ # hash[:a] = "x"
74
+ # hash[:b] = "y"
75
+ # hash.values_at("a", "b") # => ["x", "y"]
80
76
  def values_at(*indices)
81
77
  indices.collect {|key| self[convert_key(key)]}
82
78
  end
@@ -1,10 +1,11 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
1
+ require 'spec_helper'
2
2
 
3
+ # TODO: Drop the Mongo test db before running specs.
3
4
  describe AppConfig::Storage::Mongo do
4
5
 
5
- before(:each) do
6
+ before(:all) do
6
7
  AppConfig.reset!
7
- config_for_mongo(:api_key => 'SEEKRET_KEY')
8
+ config_for_mongo
8
9
  end
9
10
 
10
11
  it 'should have some values' do
@@ -12,7 +13,14 @@ describe AppConfig::Storage::Mongo do
12
13
  end
13
14
 
14
15
  it 'should update the values' do
16
+ pending 'Needs a little work...'
17
+ AppConfig.class_variable_get(:@@storage).
18
+ instance_variable_get(:@storage).should_receive(:save!)
15
19
  AppConfig[:api_key] = 'SOME_NEW_API_KEY'
20
+
21
+ # now reload the config options and check the value
22
+ AppConfig.reset!
23
+ config_for_mongo({}, false) # use default options and do not load test data
16
24
  AppConfig[:api_key].should == 'SOME_NEW_API_KEY'
17
25
  end
18
26
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe AppConfig::Storage::YAML do
4
4
 
@@ -9,15 +9,10 @@ describe AppConfig::Storage::YAML do
9
9
 
10
10
  it 'should raise file not found' do
11
11
  lambda do
12
- config_for_yaml(:path => 'not/a/real/file.yml')
12
+ config_for_yaml(:yaml => 'not/a/real/file.yml')
13
13
  end.should raise_error(Errno::ENOENT)
14
14
  end
15
15
 
16
- it 'parses the URI properly' do
17
- AppConfig.setup(:uri => "yaml://#{fixture('app_config.yml')}")
18
- AppConfig[:api_key].should_not be_nil
19
- end
20
-
21
16
  it 'saves the new value in memory' do
22
17
  config_for_yaml
23
18
  AppConfig[:new_key] = 'new value'
@@ -1,9 +1,4 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe AppConfig::Storage do
4
-
5
- it 'responds to .setup()' do
6
- AppConfig.should respond_to(:setup)
7
- end
8
-
9
4
  end
@@ -32,15 +32,13 @@ describe AppConfig do
32
32
  end
33
33
 
34
34
  it 'to_hash() returns an empty hash if storage not set' do
35
- # # First, reset the storage variable.
36
- # AppConfig.send(:class_variable_set, :@@storage, nil)
37
35
  AppConfig.reset!
38
36
  AppConfig.to_hash.should == {}
39
37
  end
40
38
 
41
39
  describe 'environment mode' do
42
40
  it 'should load the proper environment' do
43
- config_for_yaml(:path => fixture('env_app_config.yml'),
41
+ config_for_yaml(:yaml => fixture('env_app_config.yml'),
44
42
  :env => 'development')
45
43
  AppConfig[:api_key].should_not be_nil
46
44
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe Hashish do
4
4
  before(:each) do