Skip to content

Instantly share code, notes, and snippets.

@simi
Created March 9, 2019 02:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simi/bad8f02cd8975164a406e7a97db5cf44 to your computer and use it in GitHub Desktop.
Save simi/bad8f02cd8975164a406e7a97db5cf44 to your computer and use it in GitHub Desktop.
after_bundle do
generate(:controller, 'home index', '--no-javascripts --no-stylesheets --no-helper')
remove_file 'app/views/home/index.html.erb'
create_file 'app/views/home/index.html.erb', <<-RUBY.chomp
<script>document.write('<h2>Hello from JS</h2>')</script>
RUBY
create_file 'test/system/home_test.rb', <<-RUBY.chomp
require "application_system_test_case"
class HomeTest < ApplicationSystemTestCase
test "visiting the index" do
visit "home/index"
assert_selector "h2", text: "Hello from JS"
end
end
RUBY
git :init
git add: '.'
git commit: "-a -m 'Initial commit'"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment