Permalink
Browse files

none of this works

  • Loading branch information...
1 parent 10b6d1f commit d2ab6b6470a81363d7ea20e0045625ae2f69ab52 @rsanheim committed Oct 5, 2011
Showing with 28 additions and 2 deletions.
  1. +7 −1 lib/tweaker.rb
  2. +5 −0 lib/tweaker/configuration.rb
  3. +8 −0 spec/configuration_spec.rb
  4. +8 −1 spec/tweaker_spec.rb
View
8 lib/tweaker.rb
@@ -1,9 +1,15 @@
require 'tweaker/configuration'
module Tweaker
- def self.configuration
+ def self.configure
@configuration ||= Configuration.new
yield if block_given?
@configuration
end
+
+ def self.[](key)
+ configure
+ retrieve(key)
+ end
+
end
View
5 lib/tweaker/configuration.rb
@@ -1,5 +1,10 @@
module Tweaker
class Configuration
+ attr_reader :backends, :yaml_paths
+ def initialize
+ @backends = [:yaml]
+ @yaml_paths = ["config/settings"]
+ end
end
end
View
8 spec/configuration_spec.rb
@@ -0,0 +1,8 @@
+require "spec_helper"
+
+describe Tweaker::Configuration do
+ it "has sensible defaults" do
+ Tweaker.configure.backends.should == [:yaml]
+ Tweaker.configure.yaml_paths.should == ["config/settings"]
+ end
+end
View
9 spec/tweaker_spec.rb
@@ -2,7 +2,14 @@
describe Tweaker do
it "has configuration" do
- Tweaker.configuration.should be_instance_of(Tweaker::Configuration)
+ Tweaker.configure.should be_instance_of(Tweaker::Configuration)
+ end
+
+ context "retreiving" do
+ it "works" do
+ Tweaker[:something].should == "value"
+ end
+
end
end

0 comments on commit d2ab6b6

Please sign in to comment.