Skip to content

Commit

Permalink
Remove turbolinks from application.js file
Browse files Browse the repository at this point in the history
Suspenders doesn't use turbolinks by default. It doesn't include it in
the Gemfile, but the generated `application.js` was trying to include
it, resulting in a failure.

This fix make sure a newly generated application doesn't include
the turbolinks reference.

[fixes #788]
  • Loading branch information
tute committed Jul 22, 2016
1 parent 601764d commit 1146e19
Show file tree
Hide file tree
Showing 3 changed files with 14 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 @@ -43,6 +43,14 @@ def raise_on_delivery_errors
'raise_delivery_errors = false', 'raise_delivery_errors = true'
end

def remove_turbolinks
replace_in_file(
"app/assets/javascripts/application.js",
"//= require turbolinks",
""
)
end

def set_test_delivery_method
inject_into_file(
"config/environments/development.rb",
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 @@ -77,6 +77,7 @@ def setup_development_environment
say 'Setting up the development environment'
build :raise_on_missing_assets_in_test
build :raise_on_delivery_errors
build :remove_turbolinks
build :set_test_delivery_method
build :add_bullet_gem_configuration
build :raise_on_unpermitted_parameters
Expand Down
5 changes: 5 additions & 0 deletions spec/features/new_project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,11 @@ def app_name
expect(app_css).to match(/normalize-rails.*bourbon.*neat.*base.*refills/m)
end

it "doesn't use turbolinks" do
app_js = read_project_file(%w(app assets javascripts application.js))
expect(app_js).not_to match(/turbolinks/)
end

def development_config
@_development_config ||=
read_project_file %w(config environments development.rb)
Expand Down

0 comments on commit 1146e19

Please sign in to comment.