Hooray for ES6 modules on Rails Part 2: Testing

In my last post, I integrated modern JS into a Rails app with Browserify via Browserify-Rails gem, and getting started with writing specs in ES6 is just as easy.

1.) Set up Browserify-Rails via my last post

2.) Add teaspoon-jasmine gem to your gemfile

3.) Make sure Browserify is configured to load spec files

4.) Run “bundle install” from Rails console

5.) Run “bundle exec rails g teaspoon:install” from Rails console

6.) Import whatever class you are testing and use ES6 syntax!

7.) Run your specs in the browser at http://localhost:3000/teaspoon, or in the console via rake teaspoon

screen-shot-2016-12-23-at-2-15-08-pm

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s