spec/jumpup/heroku/env_spec.rb in jumpup-heroku-0.0.4 vs spec/jumpup/heroku/env_spec.rb in jumpup-heroku-0.0.5
- old
+ new
@@ -1,53 +1,71 @@
require 'spec_helper'
describe Jumpup::Heroku::Env do
+
before do
Jumpup::Heroku.configuration = nil
end
+
describe "with app" do
+
before do
Jumpup::Heroku.configure do |config|
config.app = 'myapp'
end
end
+
it "have correct env info" do
- expect(Jumpup::Heroku::Env.all).to eq({ app: 'myapp', run_database_tasks: true, host: 'heroku.com' })
+ config = { app: 'myapp', run_database_tasks: true, host: 'heroku.com',
+ deploy_branch: 'master', deploy_to_production_branch: 'master'}
+ expect(Jumpup::Heroku::Env.all).to eq(config)
end
end
+
describe "with staging_app and production_app" do
+
before do
Jumpup::Heroku.configure do |config|
config.production_app = 'myapp-production'
config.staging_app = 'myapp-staging'
end
end
+
it "have correct env info" do
- result = { production_app: 'myapp-production', staging_app: 'myapp-staging', run_database_tasks: true, host: 'heroku.com' }
- expect(Jumpup::Heroku::Env.all).to eq(result)
+ config = { production_app: 'myapp-production', staging_app: 'myapp-staging',
+ run_database_tasks: true, host: 'heroku.com',
+ deploy_branch: 'master', deploy_to_production_branch: 'production'}
+ expect(Jumpup::Heroku::Env.all).to eq(config)
end
end
+
describe "with run_database_tasks" do
+
before do
Jumpup::Heroku.configure do |config|
config.app = 'myapp'
config.run_database_tasks = false
end
end
+
it "have correct env info" do
- result = { app: 'myapp', run_database_tasks: false, host: 'heroku.com' }
+ result = { app: 'myapp', run_database_tasks: false, host: 'heroku.com',
+ deploy_branch: 'master', deploy_to_production_branch: 'master' }
expect(Jumpup::Heroku::Env.all).to eq(result)
end
end
+
describe "with a invalid config env" do
+
before do
Jumpup::Heroku.configure do |config|
config.app = 'myapp'
config.production_app = 'myapp-production'
config.staging_app = 'myapp-staging'
config.run_database_tasks = 'a'
end
end
+
it 'raise error' do
expect do
Jumpup::Heroku::Env.all
end.to raise_error(Jumpup::Heroku::ConfigurationError, %r{/config/initializers/jumpup-heroku.rb})
end