guard-jasmine 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -12,23 +12,28 @@ If you have any questions please join us on our [Google group](http://groups.goo
12
12
  * Continuous testing based on file modifications by [Guard][], manifold configurable rules
13
13
  with RegEx and Ruby.
14
14
 
15
- * Fast headless testing in [PhantomJS][], a full featured WebKit browser with native support for
15
+ * Fast headless testing on [PhantomJS][], a full featured WebKit browser with native support for
16
16
  various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.
17
17
 
18
- * With Rails 3.1 you can write your [Jasmine][] specs in [CoffeeScript][] also, fully integrated into the
18
+ * You can write your [Jasmine][] specs in [CoffeeScript][], fully integrated into the
19
19
  [Rails 3.1 asset pipeline][] with [Jasminerice][].
20
20
 
21
21
  * Runs on Mac OS X, Linux and Windows.
22
22
 
23
23
  ## How it works
24
24
 
25
- 1. Configure your Jasmine based JavaScript/CoffeeScript specs with Jasminerice in the asset pipeline, serve it over
26
- the normal Jasmine Spec Runner. (With Rails 2 & 3 you configure your plain JavaScript Jasmine specs with [the Jasmine Gem][].)
25
+ ![Guard Jasmine](https://github.com/netzpirat/guard-jasmine/raw/master/resources/guard-jasmine.png)
27
26
 
28
- 2. You configure Guard to trigger certain specs based on file modifications.
29
-
30
- 3. Guard uses PhantomJS to request the Jasmine Spec Runner headless and notifies you of the result in the terminal and
31
- optionally over system notifications like Growl, Libnotify or Notifu.
27
+ 1. Guard is triggered by a file modification.
28
+ 2. Guard::Jasmine executes the [PhantomJS script][].
29
+ 3. The PhantomJS script requests the Jasmine test runner via HTTP.
30
+ 4. Rails uses the asset pipeline to get the Jasmine runner, the code to be tested and the specs.
31
+ 5. The asset pipeline prepares the assets, compiles the CoffeeScripts if necessary.
32
+ 6. The asset pipeline has finished to prepare the needed assets.
33
+ 7. Rails returns the Jasmine runner HTML.
34
+ 8. PhantomJS requests linked assets and runs the Jasmine tests headless.
35
+ 9. The PhantomJS script extracts the result from the DOM and returns a JSON report.
36
+ 10. Guard::Jasmine reports the results to the console and system notifications.
32
37
 
33
38
  ## Install
34
39
 
@@ -58,7 +63,7 @@ Please read the detailed installation and configuration instructions at [Jasmine
58
63
  In short, you add it to your `Gemfile`:
59
64
 
60
65
  group :development, :test do
61
- gem 'jasmine'
66
+ gem 'jasminerice'
62
67
  end
63
68
 
64
69
  and add a route for the Jasmine Test Runner to `config/routes.rb`:
@@ -72,11 +77,6 @@ asset pipeline manifest in `spec/javascripts/spec.js.coffee`:
72
77
 
73
78
  #=require_tree ./
74
79
 
75
- ### Rails 2 & 3
76
-
77
- With Rails 3 you write your Jasmine specs in JavaScript, configured and server with the Jasmine gem. Please read the
78
- detailed installation and configuration instructions at [the Jasmine Gem][].
79
-
80
80
  ### PhantomJS
81
81
 
82
82
  You need the PhantomJS browser installed on your system. You can download binaries for Mac OS X and Windows from
@@ -112,15 +112,6 @@ Guard::Jasmine can be adapted to all kind of projects. Please read the
112
112
  watch(%r{spec/javascripts/spec\.(js\.coffee|js)}) { "spec/javascripts" }
113
113
  end
114
114
 
115
- ### Rails 2 & 3 with the Jasmine gem
116
-
117
- guard 'jasmine', :url => 'http://127.0.0.1:8888' do
118
- watch(%r{public/javascripts/(.+)\.js}) { |m| "spec/javascripts/#{m[1]}_spec.js" }
119
- watch(%r{spec/javascripts/(.+)_spec\.js}) { |m| "spec/javascripts/#{m[1]}_spec.js" }
120
- watch(%r{spec/javascripts/support/jasmine\.yml}) { "spec/javascripts" }
121
- watch(%r{spec/javascripts/support/jasmine_config\.rb}) { "spec/javascripts" }
122
- end
123
-
124
115
  ## Options
125
116
 
126
117
  There following options can be passed to Guard::Jasmine:
@@ -132,13 +123,13 @@ There following options can be passed to Guard::Jasmine:
132
123
  :phantomjs_bin => '~/bin/phantomjs' # Path to phantomjs.
133
124
  # default: '/usr/local/bin/phantomjs'
134
125
 
135
- :all_on_start => false # Run all specs on start.
126
+ :all_on_start => false # Run all suites on start.
136
127
  # default: true
137
128
 
138
- :keep_failed => false # Keep failed specs and add them the next run again.
129
+ :keep_failed => false # Keep failed suites and add them to the next run again.
139
130
  # default: true
140
131
 
141
- :all_after_pass => false # Run all specs after a single spec has passed.
132
+ :all_after_pass => false # Run all suites after a suite has passed again after failing.
142
133
  # default: true
143
134
 
144
135
  :notifications => false # Show success and error messages.
@@ -147,6 +138,34 @@ There following options can be passed to Guard::Jasmine:
147
138
  :hide_success => true # Disable successful compilation messages.
148
139
  # default: false
149
140
 
141
+ The `:keep_failed` failed option remembers failed suites and not failed specs. The reason for this decision is to
142
+ avoid to much round trip time to request the Jasmine test runner for each single spec, which is mostly more expensive
143
+ than running a whole suite.
144
+
145
+ ### A note on Rails 2 and 3
146
+
147
+ This readme describes the use of Guard::Jasmine with Jasminerice through the asset pipeline. But as long as you
148
+ serve the Jasmine test runner under a certain url, it's freely up to you how to prepare and serve the runner.
149
+
150
+ You can use [the Jasmine Gem][], configure the test suite in `jasmine.yml` and start the Jasmine test runner with
151
+ the supplied Rake task:
152
+
153
+ $ rake jasmine
154
+
155
+ Next follows an example on how to configure your `Guardfile` with the Jasmine gem:
156
+
157
+ guard 'jasmine', :url => 'http://127.0.0.1:8888' do
158
+ watch(%r{public/javascripts/(.+)\.js}) { |m| "spec/javascripts/#{m[1]}_spec.js" }
159
+ watch(%r{spec/javascripts/(.+)_spec\.js}) { |m| "spec/javascripts/#{m[1]}_spec.js" }
160
+ watch(%r{spec/javascripts/support/jasmine\.yml}) { "spec/javascripts" }
161
+ watch(%r{spec/javascripts/support/jasmine_config\.rb}) { "spec/javascripts" }
162
+ end
163
+
164
+ It is also possible to use CoffeeScript in this setup, by using [Guard::CoffeeScript][] to compile your code and even
165
+ specs. Just add something like this *before* Guard::Jasmine:
166
+
167
+ guard 'coffeescript', :input => 'app/coffeescripts', :output => 'public/javascripts'
168
+ guard 'coffeescript', :input => 'spec/coffeescripts', :output => 'spec/javascripts'
150
169
 
151
170
  ## Alternatives
152
171
 
@@ -159,8 +178,8 @@ featured browser environment.
159
178
  ## Development
160
179
 
161
180
  - Documentation hosted at [RubyDoc](http://rubydoc.info/gems/guard-jasmine/file/README.md).
162
- - Source hosted at [GitHub](https://github.com/netzpirat/guard-Jasmine).
163
- - Report issues and feature requests to [GitHub Issues](https://github.com/netzpirat/guard-Jasmine/issues).
181
+ - Source hosted at [GitHub](https://github.com/netzpirat/guard-jasmine).
182
+ - Report issues and feature requests to [GitHub Issues](https://github.com/netzpirat/guard-jasmine/issues).
164
183
 
165
184
  Pull requests are very welcome! Please try to follow these simple "rules", though:
166
185
 
@@ -174,11 +193,11 @@ For questions please join us on our [Google group](http://groups.google.com/grou
174
193
 
175
194
  ## Acknowledgment
176
195
 
177
- - [Ariya Hidayat][] for [PhantomJS][], a powerfull headless WebKit browser.
196
+ - [Ariya Hidayat][] for [PhantomJS][], a powerful headless WebKit browser.
178
197
  - [Brad Phelan][] for [Jasminerice][], an elegant solution for [Jasmine][] in the Rails 3.1 asset pipeline.
179
198
  - [Pivotal Labs][] for their beautiful [Jasmine][] BDD testing framework that makes JavaScript testing fun.
180
199
  - [Jeremy Ashkenas][] for [CoffeeScript][], that little language that compiles into JavaScript and makes me enjoy the
181
- frontend.
200
+ front-end.
182
201
  - The [Guard Team][] for giving us such a nice piece of software that is so easy to extend, one *has* to make a plugin
183
202
  for it!
184
203
  - All the authors of the numerous [Guards][] available for making the Guard ecosystem so much growing and comprehensive.
@@ -229,3 +248,5 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
229
248
  [guard-jasmine-headless-webkit]: https://github.com/johnbintz/guard-jasmine-headless-webkit
230
249
  [jasmine-headless-webkit]: https://github.com/johnbintz/jasmine-headless-webkit/
231
250
  [Evergreen]: https://github.com/jnicklas/evergreen
251
+ [PhantomJS script]: https://github.com/netzpirat/guard-jasmine/blob/master/lib/guard/jasmine/phantomjs/run-jasmine.coffee
252
+ [Guard::CoffeeScript]: https://github.com/guard/guard-coffeescript
@@ -25,8 +25,8 @@ module Guard
25
25
  # @option options [Boolean] :notification show notifications
26
26
  # @option options [Boolean] :hide_success hide success message notification
27
27
  # @option options [Boolean] :all_on_start run all suites on start
28
- # @option options [Boolean] :keep_failed keep failed specs and add them the next run again
29
- # @option options [Boolean] :all_after_pass run all specs after a single spec has passed
28
+ # @option options [Boolean] :keep_failed keep failed suites and add them to the next run again
29
+ # @option options [Boolean] :all_after_pass run all suites after a suite has passed again after failing
30
30
  #
31
31
  def initialize(watchers = [], options = { })
32
32
  defaults = {
@@ -110,7 +110,7 @@ module Guard
110
110
 
111
111
  File.foreach(file) do |line|
112
112
  if line =~ /describe\s*[("']+(.*?)["')]+/
113
- query_string = "?spec=#{ $1 }"
113
+ query_string = "?#{ $1 }"
114
114
  break
115
115
  end
116
116
  end
@@ -1,6 +1,6 @@
1
1
  module Guard
2
2
  module JasmineVersion
3
3
  # Guard::Jasmine version that is used for the Gem specification
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-jasmine
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 0
10
- version: 0.3.0
9
+ - 1
10
+ version: 0.3.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Kessler
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-08 00:00:00 Z
18
+ date: 2011-09-09 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: guard