-
Notifications
You must be signed in to change notification settings - Fork 242
Developing Teaspoon
Teaspoon is largely conventional, meaning it shouldn't surprise you with its choices. If it does, submit a PR!
Running the tests should be straightforward:
git clone https://github.com/jejacks0n/teaspoon.git
cd teaspoon
bundle
rake
The default tests run 8 suites:
- teaspoon core's ruby tests (
rake spec
) - teaspoon core's javascript tests (
rake teaspoon
) - teaspoon-jasmine's integration tests (
rake teaspoon:jasmine:spec
) - teaspoon-jasmine's javascript tests (
rake teaspoon:jasmine:jsspec
) - teaspoon-mocha's integration tests (
rake teaspoon:mocha:spec
) - teaspoon-mocha's javascript tests (
rake teaspoon:mocha:jsspec
) - teaspoon-qunit's integration tests (
rake teaspoon:qunit:spec
) - teaspoon-qunit's javascript tests (
rake teaspoon:qunit:jsspec
)
Most of the framework extension happens in javascript. Therefore, there aren't many (if at all) framework-specific ruby tests because frameworks don't contain much ruby code. The framework-specific tests generally check that teaspoon installs correctly, the framework javascript tests run, dummy tests run in the browser, and dummy tests run on the CLI.
The core library code follows a standard Rails engine file structure. Officially supported framework extensions live in sub-directories teaspoon-jasmine
, teaspoon-mocha
and teaspoon-qunit
. Third party libraries could use these framework extensions as a template to create extensions for other frameworks. Each extension is its own gem.
If you're working within an extension's coffeescript files, you'll want to run those tests:
TEASPOON_DEVELOPMENT=true TEASPOON_RAILS_ENV=./spec/dummy/config/environment.rb TEASPOON_ENV=./teaspoon-jasmine/spec/teaspoon_env.rb teaspoon
TEASPOON_DEVELOPMENT
indicates that we'd like to use the framework's coffeescript development files. Without this, teaspoon will use the compiled, static javascript files that get created with each release and distributed as part of the gem.
TEASPOON_RAILS_ENV
indicates that the host Rails environment to run the tests should be the dummy Rails app. The framework extensions do not have their own dummy app.
TEASPOON_ENV
indicates the teaspoon_env.rb
file to use, which tells teaspoon what framework is being used and where to find the specs.
We're wrapped all of this up into rake tasks, so you can run the javascript tests with:
rake teaspoon:jasmine:jsspec
When it's time to release, all coffeescript code should be compiled into a static javascript file containing the core teaspoon library and the framework-specific extensions.
To build all frameworks, run:
rake teaspoon:build
To build a specific framework, run:
rake teaspoon:jasmine:build