Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
There should be a simple, unified way of configuring a running Vanill…
…a application, which doesn't involve putting the config into Vanilla itself. This should make it simpler for Vanilla to simply be a gem in the future.
- Loading branch information
Showing
11 changed files
with
75 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,5 @@ pkg | |
*.db | ||
.DS_Store | ||
*~ | ||
vanilla-authorization.yml | ||
tmp | ||
defensio.yml | ||
config.yml |
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
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,5 @@ | ||
--- | ||
:filename: config.example.yml | ||
:secret: a6bc097eff86cabd92ee72ba4687c3f057b7556deaa3e4a6b284460871056b87ba3e91548c37dcc44fbc10241cee5b386556e6bcc2946fd9b609dc3bc1b24488 | ||
:credentials: | ||
admin: 5f4dcc3b5aa765d61d8327deb882cf99 |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,38 @@ | ||
require File.join(File.dirname(__FILE__), 'spec_helper') | ||
|
||
describe Vanilla::App do | ||
describe "when behaving as a Rack application" do | ||
it "should return an array of status code, headers and response" do | ||
create_snip(:name => "test", :content => "content") | ||
result = Vanilla::App.new.call(mock_env_for_url("/test.text")) | ||
result.should be_a_kind_of(Array) | ||
result[0].should == 200 | ||
result[1].should be_a_kind_of(Hash) | ||
result[2].each{ |output| output.should == "content" } | ||
end | ||
end | ||
|
||
describe "when being configured" do | ||
it "should load a config file from the current working directory by default" do | ||
File.should_receive(:open).with("config.yml").and_return(StringIO.new({}.to_yaml)) | ||
Vanilla::App.new | ||
end | ||
|
||
it "should load a config file given" do | ||
File.open("/tmp/vanilla_config.yml", "w") { |f| f.write({:hello => true}.to_yaml) } | ||
app = Vanilla::App.new("/tmp/vanilla_config.yml") | ||
app.config[:hello].should be_true | ||
end | ||
|
||
it "should allow saving of configuration to the same file it was loaded from" do | ||
config_file = "/tmp/vanilla_config.yml" | ||
File.open(config_file, "w") { |f| f.write({:hello => true}.to_yaml) } | ||
app = Vanilla::App.new(config_file) | ||
app.config[:saved] = true | ||
app.config.save! | ||
|
||
config = YAML.load(File.open(config_file)) | ||
config[:saved].should be_true | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.