guard-jasmine 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Guard::Jasmine [![Build Status](https://secure.travis-ci.org/netzpirat/guard-jasmine.png)](http://travis-ci.org/netzpirat/guard-jasmine)
2
2
 
3
- Guard::Jasmine automatically tests your Jasmine specs on Rails when files are modified.
3
+ Guard::Jasmine automatically tests your Jasmine specs when files are modified.
4
4
 
5
5
  Tested on MRI Ruby 1.8.7, 1.9.2, 1.9.3, REE and the latest versions of JRuby and Rubinius.
6
6
 
@@ -13,12 +13,13 @@ If you have any questions please join us on our [Google group](http://groups.goo
13
13
  * [Installation](#installation)
14
14
  * [Guard and Guard::Jasmine](#guard-guard-jasmine)
15
15
  * [PhantomJS](#phantomjs)
16
- * [Rails 3.1 setup](#rails31)
17
- * [How it works](#rails31-works)
18
- * [Jasminerice](#rails31-jasminerice)
19
- * [Rails 2 & Rails 3 setup](#rails23)
20
- * [How it works](#rails23-works)
21
- * [Jasmine Gem](#rails23-jasmine-gem)
16
+ * [Rails with the asset pipeline](#asset-pipeline)
17
+ * [How it works](#asset-pipeline-works)
18
+ * [Jasminerice](#asset-pipeline-jasminerice)
19
+ * [Jasmine Stories](#asset-pipeline-jasmine-stories)
20
+ * [Rails without the asset pipeline and plain Ruby projects](#without-asset-pipeline)
21
+ * [How it works](#without-asset-pipeline-works)
22
+ * [Jasmine Gem](#without-asset-pipeline-jasmine-gem)
22
23
  * [Usage](#usage)
23
24
  * [Guardfile](#guardfile)
24
25
  * [Options](#options)
@@ -46,7 +47,10 @@ Ruby.
46
47
  various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.
47
48
 
48
49
  * Runs the standard Jasmine test runner, so you can use [Jasminerice][] for integrating [Jasmine][] into the
49
- [Rails 3.1 asset pipeline][] and write your specs in [CoffeeScript][].
50
+ [Rails asset pipeline][] and write your specs in [CoffeeScript][].
51
+
52
+ * Can be used to run [Jasmine-species](http://rudylattae.github.com/jasmine-species/) acceptance tests provided by
53
+ [Jasmine Stories](https://github.com/DominikGuzei/jasmine-stories).
50
54
 
51
55
  * Thor and Rake command line helper for CI server integration.
52
56
 
@@ -101,19 +105,19 @@ $ sudo apt-get install phantomjs
101
105
  You can also build it from source for several other operating systems, please consult the
102
106
  [PhantomJS build instructions][].
103
107
 
104
- <a name="rails31" />
105
- ## Rails 3.1 setup
108
+ <a name="asset-pipeline" />
109
+ ## Rails with the asset pipeline setup
106
110
 
107
- With Rails 3.1 you can write your Jasmine specs in addition to JavaScript with CoffeeScript, fully integrated into the
108
- Rails 3.1 asset pipeline with [Jasminerice][]. You have full access to your running Rails app, but it's a good practice
109
- to fake the server response. Check out the excellent [Sinon.JS][] documentation to learn more about this topic.
111
+ With Rails 3.1 and later you can write your Jasmine specs in addition to JavaScript with CoffeeScript, fully integrated
112
+ into the Rails asset pipeline with [Jasminerice][]. You have full access to your running Rails app, but it's a good
113
+ practice to fake the server response. Check out the excellent [Sinon.JS][] documentation to learn more about this topic.
110
114
 
111
115
  Guard::Jasmine will start a Rails Rack server to run your specs.
112
116
 
113
- <a name="rails31-works" />
117
+ <a name="asset-pipeline-works" />
114
118
  ### How it works
115
119
 
116
- ![Guard Jasmine](https://github.com/netzpirat/guard-jasmine/raw/master/resources/guard-jasmine-rails31.jpg)
120
+ ![Guard Jasmine](https://github.com/netzpirat/guard-jasmine/raw/master/resources/guard-jasmine-with-asset-pipeline.jpg)
117
121
 
118
122
  1. Guard is triggered by a file modification.
119
123
  2. Guard::Jasmine executes the [PhantomJS script][].
@@ -126,7 +130,7 @@ Guard::Jasmine will start a Rails Rack server to run your specs.
126
130
  9. The PhantomJS script collects the Jasmine runner results and returns a JSON report.
127
131
  10. Guard::Jasmine reports the results to the console and system notifications.
128
132
 
129
- <a name="rails31-jasminerice" />
133
+ <a name="asset-pipeline-jasminerice" />
130
134
  ### Jasminerice
131
135
 
132
136
  Please read the detailed installation and configuration instructions at [Jasminerice][].
@@ -144,10 +148,10 @@ And run following from the Terminal:
144
148
  ```bash
145
149
  mkdir -p spec/javascripts
146
150
  echo -e "#=require application\n#=require_tree ./" > spec/javascripts/spec.js.coffee
147
- echo -e "/*\n * add css using =require application\n */" > spec/javascripts/spec.css
151
+ echo -e "/*\n *=require application\n */" > spec/javascripts/spec.css
148
152
  ```
149
153
 
150
- This creates the directory `spec/javascripts` where your CoffeeScript tests go into. You define the Rails 3.1
154
+ This creates the directory `spec/javascripts` where your CoffeeScript tests goes into. You define the Rails
151
155
  asset pipeline manifest in `spec/javascripts/spec.js.coffee`:
152
156
 
153
157
  ```coffeescript
@@ -157,21 +161,54 @@ asset pipeline manifest in `spec/javascripts/spec.js.coffee`:
157
161
 
158
162
  It also creates an empty `spec/javascripts/spec.css` file as it is always requested when running specs.
159
163
 
160
- Now you can access `/jasmine` url when you start rails server normally.
164
+ Now you can access `/jasmine` when you start your Rails server normally.
165
+
166
+ <a name="asset-pipeline-jasmine-stories" />
167
+ ### Jasmine Stories acceptance tests
168
+
169
+ [Jasmine Stories](https://github.com/DominikGuzei/jasmine-stories) is a Jasminerice clone and that serves
170
+ [Jasmine-species](http://rudylattae.github.com/jasmine-species/) acceptance tests.
161
171
 
162
- <a name="rails23" />
163
- ## Rails 2 & Rails 3 setup
172
+ In short, you add it to your `Gemfile`:
173
+
174
+ ```ruby
175
+ group :development, :test do
176
+ gem 'jasmine-stories'
177
+ end
178
+ ```
179
+
180
+ And run following from the Terminal:
181
+
182
+ ```bash
183
+ mkdir -p spec/javascripts/stories
184
+ echo -e "#=require_tree ./stories" > spec/javascripts/stories.js.coffee
185
+ echo -e "/*\n *=require application\n */" > spec/javascripts/spec.css
186
+ ```
187
+
188
+ This creates the directory `spec/javascripts/stories` where your CoffeeScript acceptance tests goes into.
189
+
190
+ Now you can access `/jasmine-stories` when you start your Rails server normally. You have to change the Jasmine runner
191
+ accordingly:
192
+
193
+ ```ruby
194
+ guard :jasmine, :jasmine_url => 'http://127.0.0.1:8888/jasmine-stories' do
195
+ ...
196
+ end
197
+ ```
164
198
 
165
- With Rails 2 or Rails 3 you can use [the Jasmine Gem][] to configure your Jasmine specs and server the Jasmine
166
- runner. You don't have full access to your running Rails app, but it's anyway a good practice to fake the server
167
- response. Check out the excellent [Sinon.JS][] documentation to learn more about this topic.
199
+ <a name="without-asset-pipeline" />
200
+ ## Rails without the asset pipeline and plain Ruby projects
201
+
202
+ With Rails without the asset pipeline or a plain Ruby project, you can use [the Jasmine Gem][] to configure your Jasmine
203
+ specs and server the Jasmine runner. You don't have full access to your running Rails app, but it's anyway a good
204
+ practice to fake the server response. Check out the excellent [Sinon.JS][] documentation to learn more about this topic.
168
205
 
169
206
  Guard::Jasmine will start a Jasmine Gem Rack server to run your specs.
170
207
 
171
- <a name="rails23-works" />
208
+ <a name="without-asset-pipeline-works" />
172
209
  ### How it works
173
210
 
174
- ![Guard Jasmine](https://github.com/netzpirat/guard-jasmine/raw/master/resources/guard-jasmine-rails23.jpg)
211
+ ![Guard Jasmine](https://github.com/netzpirat/guard-jasmine/raw/master/resources/guard-jasmine-without-asset-pipeline.jpg)
175
212
 
176
213
  1. Guard is triggered by a file modification.
177
214
  2. Guard::Jasmine executes the [PhantomJS script][].
@@ -182,12 +219,12 @@ Guard::Jasmine will start a Jasmine Gem Rack server to run your specs.
182
219
  7. The PhantomJS script collects the Jasmine runner results and returns a JSON report.
183
220
  8. Guard::Jasmine reports the results to the console and system notifications.
184
221
 
185
- <a name="rails23-jasmine-gem" />
222
+ <a name="without-asset-pipeline-jasmine-gem" />
186
223
  ### Jasmine Gem
187
224
 
188
225
  Please read the detailed installation and configuration instructions at [the Jasmine Gem][].
189
226
 
190
- In short, you add it to your `Gemfile`:
227
+ In short, you add the Jasmine gem to your `Gemfile`:
191
228
 
192
229
  ```ruby
193
230
  group :development, :test do
@@ -195,15 +232,25 @@ group :development, :test do
195
232
  end
196
233
  ```
197
234
 
198
- and generate the configuration files:
235
+ and generate the configuration files and change the Jasmine url:
236
+
237
+ ```ruby
238
+ guard :jasmine, :jasmine_url => 'http://localhost:8888/' do
239
+ ...
240
+ end
241
+ ```
242
+
243
+ #### Rails 3 without the asset pipeline
199
244
 
200
- #### for Rails 3
245
+ Install the Jasmine gem in your Rails 3 app with:
201
246
 
202
247
  ```bash
203
248
  $ rails g jasmine:install
204
249
  ```
205
250
 
206
- #### for Rails 2
251
+ #### Rails 2 and plain Ruby project
252
+
253
+ Install the Jasmine gem in your Rails 2 app or a plain Ruby project with:
207
254
 
208
255
  ```bash
209
256
  $ script/generate jasmine
@@ -305,7 +352,7 @@ environment variable.
305
352
  The spec runner options configures the behavior driven development (or BDD) cycle:
306
353
 
307
354
  ```ruby
308
- :spec_dir => false # Directory with the Jasmine specs.
355
+ :spec_dir => 'app/spec' # Directory with the Jasmine specs.
309
356
  # default: 'spec/javascripts'
310
357
 
311
358
  :clean => false # Clean the spec list by only keep Jasmine specs within the project.
@@ -497,6 +544,21 @@ end
497
544
  Guard::JasmineTask.new(:jasmine_no_server, '-s none')
498
545
  ```
499
546
 
547
+ Now you'll set your tasks in the Rake task list:
548
+
549
+ ```bash
550
+ $ rake -T guard
551
+ rake guard:jasmine # Run all Jasmine specs
552
+ rake guard:jasmine_no_server # Run all Jasmine specs
553
+ ```
554
+
555
+ and you can execute the Guard::Jasmine specs on the console by running
556
+ the task:
557
+
558
+ ```bash
559
+ $ rake guard:jasmine
560
+ ```
561
+
500
562
  <a name="travis-ci" />
501
563
  ### Travis CI integration
502
564
 
@@ -504,9 +566,6 @@ With the given `guard-jasmine` script you're able to configure [Travis CI](http:
504
566
  Simply use the `script` setting in your `.travis.yml`:
505
567
 
506
568
  ```yaml
507
- before_script:
508
- - "export DISPLAY=:99.0"
509
- - "sh -e /etc/init.d/xvfb start"
510
569
  script: 'bundle exec guard-jasmine'
511
570
  ```
512
571
 
@@ -31,13 +31,13 @@ module Guard
31
31
  method_option :port,
32
32
  :type => :numeric,
33
33
  :aliases => '-p',
34
- :default => 8888,
34
+ :default => 3001,
35
35
  :desc => 'Server port to use'
36
36
 
37
37
  method_option :url,
38
38
  :type => :string,
39
39
  :aliases => '-u',
40
- :default => 'http://localhost:8888/jasmine',
40
+ :default => 'http://localhost:3001/jasmine',
41
41
  :desc => 'The url of the Jasmine test runner'
42
42
 
43
43
  method_option :bin,
@@ -34,7 +34,7 @@ module Guard
34
34
  desc 'Run all Jasmine specs'
35
35
  task(name) do
36
36
  begin
37
- ::Guard::Jasmine::CLI.start(options.split)
37
+ ::Guard::Jasmine::CLI.start(self.options.split)
38
38
 
39
39
  rescue SystemExit => e
40
40
  case e.status
@@ -48,12 +48,16 @@ module Guard
48
48
 
49
49
  if version
50
50
  # Remove all but version, e.g. from '1.5 (development)'
51
- version = version.match(/(\d\.)*(\d)/)[0]
52
-
53
- if Gem::Version.new(version) < Gem::Version.new('1.3.0')
54
- ::Guard::Jasmine::Formatter.error "PhantomJS executable at #{ bin } must be at least version 1.3.0"
51
+ cleaned_version = version.match(/(\d\.)*(\d)/)
52
+
53
+ if cleaned_version
54
+ if Gem::Version.new(cleaned_version[0]) < Gem::Version.new('1.3.0')
55
+ ::Guard::Jasmine::Formatter.error "PhantomJS executable at #{ bin } must be at least version 1.3.0"
56
+ else
57
+ true
58
+ end
55
59
  else
56
- true
60
+ ::Guard::Jasmine::Formatter.error "PhantomJS reports unknown version format: #{ version }"
57
61
  end
58
62
  else
59
63
  ::Guard::Jasmine::Formatter.error "PhantomJS executable doesn't exist at #{ bin }"
@@ -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 = '1.1.0'
4
+ VERSION = '1.1.1'
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-jasmine
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-27 00:00:00.000000000 Z
12
+ date: 2012-04-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard
16
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &70161667685600 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,15 +21,10 @@ dependencies:
21
21
  version: 0.8.3
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: 0.8.3
24
+ version_requirements: *70161667685600
30
25
  - !ruby/object:Gem::Dependency
31
26
  name: multi_json
32
- requirement: !ruby/object:Gem::Requirement
27
+ requirement: &70161667685160 !ruby/object:Gem::Requirement
33
28
  none: false
34
29
  requirements:
35
30
  - - ! '>='
@@ -37,15 +32,10 @@ dependencies:
37
32
  version: '0'
38
33
  type: :runtime
39
34
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
35
+ version_requirements: *70161667685160
46
36
  - !ruby/object:Gem::Dependency
47
37
  name: childprocess
48
- requirement: !ruby/object:Gem::Requirement
38
+ requirement: &70161667684460 !ruby/object:Gem::Requirement
49
39
  none: false
50
40
  requirements:
51
41
  - - ! '>='
@@ -53,15 +43,10 @@ dependencies:
53
43
  version: '0'
54
44
  type: :runtime
55
45
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
46
+ version_requirements: *70161667684460
62
47
  - !ruby/object:Gem::Dependency
63
48
  name: thor
64
- requirement: !ruby/object:Gem::Requirement
49
+ requirement: &70161667683840 !ruby/object:Gem::Requirement
65
50
  none: false
66
51
  requirements:
67
52
  - - ! '>='
@@ -69,15 +54,10 @@ dependencies:
69
54
  version: '0'
70
55
  type: :runtime
71
56
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
57
+ version_requirements: *70161667683840
78
58
  - !ruby/object:Gem::Dependency
79
59
  name: bundler
80
- requirement: !ruby/object:Gem::Requirement
60
+ requirement: &70161667683200 !ruby/object:Gem::Requirement
81
61
  none: false
82
62
  requirements:
83
63
  - - ! '>='
@@ -85,15 +65,10 @@ dependencies:
85
65
  version: '0'
86
66
  type: :development
87
67
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: '0'
68
+ version_requirements: *70161667683200
94
69
  - !ruby/object:Gem::Dependency
95
70
  name: guard-rspec
96
- requirement: !ruby/object:Gem::Requirement
71
+ requirement: &70161667682560 !ruby/object:Gem::Requirement
97
72
  none: false
98
73
  requirements:
99
74
  - - ! '>='
@@ -101,15 +76,10 @@ dependencies:
101
76
  version: '0'
102
77
  type: :development
103
78
  prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
79
+ version_requirements: *70161667682560
110
80
  - !ruby/object:Gem::Dependency
111
81
  name: guard-coffeescript
112
- requirement: !ruby/object:Gem::Requirement
82
+ requirement: &70161667681940 !ruby/object:Gem::Requirement
113
83
  none: false
114
84
  requirements:
115
85
  - - ! '>='
@@ -117,15 +87,10 @@ dependencies:
117
87
  version: '0'
118
88
  type: :development
119
89
  prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
- requirements:
123
- - - ! '>='
124
- - !ruby/object:Gem::Version
125
- version: '0'
90
+ version_requirements: *70161667681940
126
91
  - !ruby/object:Gem::Dependency
127
92
  name: guard-shell
128
- requirement: !ruby/object:Gem::Requirement
93
+ requirement: &70161667681240 !ruby/object:Gem::Requirement
129
94
  none: false
130
95
  requirements:
131
96
  - - ! '>='
@@ -133,15 +98,10 @@ dependencies:
133
98
  version: '0'
134
99
  type: :development
135
100
  prerelease: false
136
- version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
- requirements:
139
- - - ! '>='
140
- - !ruby/object:Gem::Version
141
- version: '0'
101
+ version_requirements: *70161667681240
142
102
  - !ruby/object:Gem::Dependency
143
103
  name: rspec
144
- requirement: !ruby/object:Gem::Requirement
104
+ requirement: &70161667680820 !ruby/object:Gem::Requirement
145
105
  none: false
146
106
  requirements:
147
107
  - - ! '>='
@@ -149,15 +109,10 @@ dependencies:
149
109
  version: '0'
150
110
  type: :development
151
111
  prerelease: false
152
- version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
- requirements:
155
- - - ! '>='
156
- - !ruby/object:Gem::Version
157
- version: '0'
112
+ version_requirements: *70161667680820
158
113
  - !ruby/object:Gem::Dependency
159
114
  name: yard
160
- requirement: !ruby/object:Gem::Requirement
115
+ requirement: &70161667680400 !ruby/object:Gem::Requirement
161
116
  none: false
162
117
  requirements:
163
118
  - - ! '>='
@@ -165,15 +120,10 @@ dependencies:
165
120
  version: '0'
166
121
  type: :development
167
122
  prerelease: false
168
- version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
- requirements:
171
- - - ! '>='
172
- - !ruby/object:Gem::Version
173
- version: '0'
123
+ version_requirements: *70161667680400
174
124
  - !ruby/object:Gem::Dependency
175
125
  name: redcarpet
176
- requirement: !ruby/object:Gem::Requirement
126
+ requirement: &70161667679960 !ruby/object:Gem::Requirement
177
127
  none: false
178
128
  requirements:
179
129
  - - ! '>='
@@ -181,15 +131,10 @@ dependencies:
181
131
  version: '0'
182
132
  type: :development
183
133
  prerelease: false
184
- version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
- requirements:
187
- - - ! '>='
188
- - !ruby/object:Gem::Version
189
- version: '0'
134
+ version_requirements: *70161667679960
190
135
  - !ruby/object:Gem::Dependency
191
136
  name: pry
192
- requirement: !ruby/object:Gem::Requirement
137
+ requirement: &70161667679520 !ruby/object:Gem::Requirement
193
138
  none: false
194
139
  requirements:
195
140
  - - ! '>='
@@ -197,15 +142,10 @@ dependencies:
197
142
  version: '0'
198
143
  type: :development
199
144
  prerelease: false
200
- version_requirements: !ruby/object:Gem::Requirement
201
- none: false
202
- requirements:
203
- - - ! '>='
204
- - !ruby/object:Gem::Version
205
- version: '0'
145
+ version_requirements: *70161667679520
206
146
  - !ruby/object:Gem::Dependency
207
147
  name: yajl-ruby
208
- requirement: !ruby/object:Gem::Requirement
148
+ requirement: &70161667679100 !ruby/object:Gem::Requirement
209
149
  none: false
210
150
  requirements:
211
151
  - - ! '>='
@@ -213,12 +153,7 @@ dependencies:
213
153
  version: '0'
214
154
  type: :development
215
155
  prerelease: false
216
- version_requirements: !ruby/object:Gem::Requirement
217
- none: false
218
- requirements:
219
- - - ! '>='
220
- - !ruby/object:Gem::Version
221
- version: '0'
156
+ version_requirements: *70161667679100
222
157
  description: Guard::Jasmine automatically tests your Jasmine specs on PhantomJS
223
158
  email:
224
159
  - michi@netzpiraten.ch
@@ -272,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
272
207
  version: 1.3.6
273
208
  requirements: []
274
209
  rubyforge_project: guard-jasmine
275
- rubygems_version: 1.8.19
210
+ rubygems_version: 1.8.17
276
211
  signing_key:
277
212
  specification_version: 3
278
213
  summary: Guard gem for headless testing with Jasmine