This repository has been archived by the owner on Jun 8, 2019. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First crack at Kumade::Configuration
- Loading branch information
Gabe Berke-Williams
committed
Sep 10, 2011
1 parent
ee04efc
commit 681bc8f
Showing
4 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module Kumade | ||
class Configuration | ||
def initialize | ||
@environment = 'staging' | ||
@pretending = false | ||
end | ||
|
||
def pretending? | ||
!!@pretending | ||
end | ||
|
||
attr_accessor :pretending, :environment | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
require 'spec_helper' | ||
|
||
describe Kumade::Configuration do | ||
context "#pretending" do | ||
it "has read/write access for the pretending attribute" do | ||
subject.pretending = true | ||
subject.pretending.should == true | ||
end | ||
end | ||
|
||
context "pretending?" do | ||
it "returns false when not pretending" do | ||
subject.pretending = false | ||
subject.should_not be_pretending | ||
end | ||
|
||
it "returns true when pretending" do | ||
subject.pretending = true | ||
subject.should be_pretending | ||
end | ||
|
||
it "defaults to false" do | ||
subject.pretending.should == false | ||
end | ||
end | ||
|
||
context "#environment" do | ||
it "has read/write access for the environment attribute" do | ||
subject.environment = 'new-environment' | ||
subject.environment.should == 'new-environment' | ||
end | ||
|
||
it "defaults to staging" do | ||
subject.environment.should == 'staging' | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require 'spec_helper' | ||
|
||
describe Kumade, ".configuration" do | ||
it "returns a Kumade::Configuration instance" do | ||
Kumade.configuration.should be_a Kumade::Configuration | ||
end | ||
|
||
it "caches the configuration" do | ||
Kumade.configuration.should eq Kumade.configuration | ||
end | ||
end | ||
|