Permalink
Browse files

Inherit staging config from production

  • Loading branch information...
1 parent 91ccad9 commit 258f7a61e81700d5128b52a001382b2e5c572920 @croaky croaky committed Feb 5, 2014
Showing with 18 additions and 6 deletions.
  1. +1 −4 lib/suspenders/app_builder.rb
  2. +10 −2 spec/features/new_project_spec.rb
  3. +4 −0 spec/support/suspenders.rb
  4. +3 −0 templates/staging.rb
@@ -84,10 +84,7 @@ def enable_rack_deflater
end
def setup_staging_environment
- run 'cp config/environments/production.rb config/environments/staging.rb'
-
- prepend_file 'config/environments/staging.rb',
- "Mail.register_interceptor RecipientInterceptor.new(ENV['EMAIL_RECIPIENTS'])\n"
+ copy_file 'staging.rb', 'config/environments/staging.rb'
end
def setup_secret_token
@@ -1,7 +1,7 @@
require 'spec_helper'
-feature 'New project' do
- scenario 'Suspend a project with default configurations' do
+feature 'Suspend a new project with default configuration' do
+ scenario 'specs pass' do
run_suspenders
Dir.chdir(project_path) do
@@ -10,4 +10,12 @@
end
end
end
+
+ scenario 'staging config is inherited from production' do
+ run_suspenders
+
+ staging_file = "#{project_path}/config/environments/staging.rb"
+
+ expect(IO.read(staging_file)).to eq template('staging.rb')
+ end
end
@@ -30,6 +30,10 @@ def drop_dummy_database
end
end
+ def template(file)
+ IO.read("#{root_path}/templates/#{file}")
+ end
+
def project_path
@project_path ||= Pathname.new("#{tmp_path}/#{APP_NAME}")
end
View
@@ -0,0 +1,3 @@
+require_relative 'production'
+
+Mail.register_interceptor RecipientInterceptor.new(ENV['EMAIL_RECIPIENTS'])

0 comments on commit 258f7a6

Please sign in to comment.