Skip to content

Commit

Permalink
configurator should pass the current config as argument to the block
Browse files Browse the repository at this point in the history
  • Loading branch information
mistersourcerer committed Nov 13, 2011
1 parent 97f389d commit 524dcac
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions spec/standalone_migrations/configurator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,35 @@ module StandaloneMigrations
context "customizing the environments configuration dynamically" do

let(:configurator) { Configurator.new }
let(:new_config) { { 'sbrobous' => 'test' } }

before(:all) do
Configurator.environments_config do |env|
env.on "production" do
new_config
end
end
end

it "allow changes on the configuration hashes" do
hash = { 'sbrobous' => 'test' }
config_key = "production"
Configurator.environments_config do |environments_config|
environments_config.on config_key do
hash
configurator.config_for("production").should == new_config
end

it "return current configuration if block yielding returns nil" do
Configurator.environments_config do |env|
env.on "production" do
nil
end
end
configurator.config_for("production").should == new_config
end

it "pass the current configuration as block argument" do
Configurator.environments_config do |env|
env.on "production" do |current_config|
current_config.should == new_config
end
end
configurator.config_for(config_key).should == hash
end

end
Expand Down

0 comments on commit 524dcac

Please sign in to comment.