Skip to content

Commit

Permalink
Verify production is used in staging
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Croak committed Feb 6, 2014
1 parent 258f7a6 commit 3b525e0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
12 changes: 11 additions & 1 deletion lib/suspenders/app_builder.rb
Expand Up @@ -84,7 +84,17 @@ def enable_rack_deflater
end

def setup_staging_environment
copy_file 'staging.rb', 'config/environments/staging.rb'
staging_file = 'config/environments/staging.rb'
copy_file 'staging.rb', staging_file

config = <<-RUBY
#{app_name.classify}::Application.configure do
# ...
end
RUBY

append_file staging_file, config
end

def setup_secret_token
Expand Down
4 changes: 2 additions & 2 deletions spec/features/github_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'

feature 'Github' do
scenario 'Suspend a project with github option' do
feature 'GitHub' do
scenario 'Suspend a project with --github option' do
repo_name = 'test'
run_suspenders("--github=#{repo_name}")

Expand Down
6 changes: 4 additions & 2 deletions spec/features/new_project_spec.rb
Expand Up @@ -14,8 +14,10 @@
scenario 'staging config is inherited from production' do
run_suspenders

staging_file = "#{project_path}/config/environments/staging.rb"
staging_file = IO.read("#{project_path}/config/environments/staging.rb")
config_stub = "Dummy::Application.configure do"

expect(IO.read(staging_file)).to eq template('staging.rb')
expect(staging_file).to match(/^require_relative 'production'/)
expect(staging_file).to match(/#{config_stub}/), staging_file
end
end
4 changes: 0 additions & 4 deletions spec/support/suspenders.rb
Expand Up @@ -30,10 +30,6 @@ 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
Expand Down

0 comments on commit 3b525e0

Please sign in to comment.