README.md in jasminerice-0.0.8 vs README.md in jasminerice-0.0.9
- old
+ new
@@ -16,11 +16,11 @@
This is a gem specifically for Rails 3.1. Just include it in
your `Gemfile`:
```ruby
-group :development, :test
+group :development, :test do
gem "jasminerice"
end
```
The engine is automatically mounted into your application in the development
@@ -46,11 +46,11 @@
The Rails 3.1 asset pipeline using [Sprockets](https://github.com/sstephenson/sprockets)
and [Tilt](https://github.com/rtomayko/tilt) ensure conversion.
As well you can use the `#require` dependency mechanisms in your specs to
-pull dependencies. Here's an example `spec/javascripts/foo.js.coffee`:
+pull dependencies. Here's an example `spec/javascripts/foo_spec.js.coffee`:
```coffeescript
#= require foo
#= require bar
@@ -61,11 +61,11 @@
describe "Bar", ->
it "it is not foo", ->
v = new Bar()
expect(v.foo()).toEqual(false)
-```
+```
### Stylesheets
For including stylesheets in your specs, Jasminerice uses `spec/javascripts/spec.css`.
Use Sprockets directives to include the right css files:
@@ -93,10 +93,13 @@
```coffeescript
loadFixtures 'baz'
```
+### Helper Methods
+You can declare Jasminerice::HelperMethods (perhaps put inside lib/) to make helpers available to jasminerice fixtures.
+
### Start server
Now start your server
```bash
@@ -108,9 +111,32 @@
```bash
http://localhost:3000/jasmine
```
and there are your specs.
+
+### Compatibility with Require.js
+
+If you use [Require.js](http://requirejs.org/) in your project and need to load your
+modules in your jasmine specs, there is an option to prevent jasminerice from automatically
+executing the test runner before the modules are defined. This enables you to start the
+execution manually whenever you want in your `spec/javascripts/spec.js.coffee` file:
+
+ #= require your/specs/and/other/stuff
+ # at the end of this file add:
+
+ jasmine.rice.autoExecute = false
+
+ define 'jasmine.waitsfor.requirejs', ->
+ require ['jasmine.waitsfor.requirejs'], ->
+ jasmine.getEnv().execute()
+
+The shown example defines a dummy module in require.js that is required immediately on the next
+line. This is a simple hack to wait until require.js has initialized all modules and start the
+jasmine runner after that.
+
+Of course you can use `jasmine.rice.autoExecute = false` also for all other cases where you need
+to control when your specs should be executed!
Author
------
* Brad Phelan (bradphelan@xtargets.com)