Skip to content

Commit

Permalink
Raise on missing Sprockets assets in test
Browse files Browse the repository at this point in the history
When testing features, we'd prefer to be notified of asset pipeline
issues as early as possible.
  • Loading branch information
seanpdoyle committed Nov 13, 2015
1 parent e96f845 commit dd6b203
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/suspenders/app_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ def readme
template 'README.md.erb', 'README.md'
end

def raise_on_missing_assets_in_test
inject_into_file(
"config/environments/test.rb",
"\n config.assets.raise_runtime_errors = true",
after: "Rails.application.configure do",
)
end

def raise_on_delivery_errors
replace_in_file 'config/environments/development.rb',
'raise_delivery_errors = false', 'raise_delivery_errors = true'
Expand Down
1 change: 1 addition & 0 deletions lib/suspenders/generators/app_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def setup_database

def setup_development_environment
say 'Setting up the development environment'
build :raise_on_missing_assets_in_test
build :raise_on_delivery_errors
build :set_test_delivery_method
build :add_bullet_gem_configuration
Expand Down
8 changes: 8 additions & 0 deletions spec/features/new_project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@
expect(test_config).to match /^ +Bullet.rails_logger = true$/
end

it "configs missing assets to raise in test" do
test_config = IO.read("#{project_path}/config/environments/test.rb")

expect(test_config).to match(
/^ +config.assets.raise_runtime_errors = true$/,
)
end

it "adds spring to binstubs" do
expect(File).to exist("#{project_path}/bin/spring")

Expand Down

0 comments on commit dd6b203

Please sign in to comment.