jasmine-rails 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +20 -29
- data/lib/assets/javascripts/jasmine-console-shims.js +33 -26
- data/lib/jasmine_rails/version.rb +1 -1
- metadata +20 -38
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 04c5286d68468e3af180888684f02448f3fe52a3
|
4
|
+
data.tar.gz: f4bf90cf1d05548e50a2b493a4a478939398a7a9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: de941110cc8d0db01c8c2920223f8bdf17f88ef2de4e4478d142f495d8c5899cfaac3e0870abe7a6f93576d4bddc8f61e134ba63fd157748b0cc85479fc061bd
|
7
|
+
data.tar.gz: 1496482fefa855753b89005ccaaf5b759cf03bc544c86bcbb91bab8202b16884c299a9c9e15daeaa7f259ab8930071a9fdec1787dd1170b586cbcc8c96713bc7
|
data/README.md
CHANGED
@@ -11,14 +11,6 @@ By bundling this gem and configuring your project, you can expect to:
|
|
11
11
|
[PhantomJS](http://phantomjs.org/))
|
12
12
|
* Write specs or source in [CoffeeScript](http://jashkenas.github.com/coffee-script/), leveraging the [asset pipeline](http://railscasts.com/episodes/279-understanding-the-asset-pipeline) to pre-process it
|
13
13
|
|
14
|
-
## Prerequisites
|
15
|
-
|
16
|
-
Install phantomjs in order to run tests headless on the command line. The easiest way (on a Mac) that I've found is to use [homebrew](https://github.com/mxcl/homebrew):
|
17
|
-
|
18
|
-
brew install phantomjs
|
19
|
-
|
20
|
-
If you're not on a Mac, fear not, as [installing PhantomJS](http://phantomjs.org) is pretty painless for most environments. The important thing is that the binary be somewhere on your PATH.
|
21
|
-
|
22
14
|
## Installation
|
23
15
|
|
24
16
|
First, add jasmine-rails to your Gemfile, like so
|
@@ -129,43 +121,42 @@ Again, it's the opinion of the present author that this shouldn't be necessary i
|
|
129
121
|
|
130
122
|
### Custom Helpers
|
131
123
|
|
132
|
-
If you need to write a custom spec runner template (for example, using requireJS to load components from your specs), you might benefit from
|
124
|
+
If you need to write a custom spec runner template (for example, using requireJS to load components from your specs), you might benefit from
|
133
125
|
custom helper functions. The controller will attempt to load `JasmineRails::SpecHelper` if it exists. An example:
|
134
126
|
|
135
127
|
```ruby
|
136
128
|
# in lib/jasmine_rails/spec_helper.rb
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
129
|
+
module JasmineRails
|
130
|
+
module SpecHelper
|
131
|
+
def custom_function
|
132
|
+
"hello world"
|
133
|
+
end
|
134
|
+
end
|
143
135
|
end
|
144
136
|
```
|
145
137
|
|
146
|
-
Create a custom layout in app/layouts/jasmine_rails/spec_runner.html.erb and reference your helper:
|
138
|
+
Create a custom layout in app/views/layouts/jasmine_rails/spec_runner.html.erb and reference your helper:
|
147
139
|
|
148
140
|
```erb
|
149
141
|
<%= custom_function %>
|
150
142
|
```
|
151
143
|
|
152
|
-
If you wanted to do something like this using [requirejs-rails](https://github.com/jwhitley/requirejs-rails), your helper
|
144
|
+
If you wanted to do something like this using [requirejs-rails](https://github.com/jwhitley/requirejs-rails), your helper
|
153
145
|
might look like this:
|
154
146
|
|
155
|
-
```
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
end
|
147
|
+
```ruby
|
148
|
+
# in lib/jasmine_rails/spec_helper.rb
|
149
|
+
module JasmineRails
|
150
|
+
module SpecHelper
|
151
|
+
# Gives us access to the require_js_include_tag helper
|
152
|
+
include RequirejsHelper
|
153
|
+
end
|
163
154
|
end
|
164
155
|
```
|
165
156
|
|
166
157
|
Remove any reference to `src_files` in `spec/javascripts/support/jasmine.yml`, to ensure files aren't loaded prematurely.
|
167
158
|
|
168
|
-
Create your custom layout `app/layouts/jasmine_rails/spec_runner.html.erb` like so:
|
159
|
+
Create your custom layout `app/views/layouts/jasmine_rails/spec_runner.html.erb` like so:
|
169
160
|
```erb
|
170
161
|
|
171
162
|
<!DOCTYPE html>
|
@@ -191,9 +182,9 @@ Use require with a callback to load your components:
|
|
191
182
|
```coffeescript
|
192
183
|
|
193
184
|
describe 'test my module', ->
|
194
|
-
|
195
|
-
|
196
|
-
|
185
|
+
require ['my/module'], (Module) ->
|
186
|
+
it 'does something', ->
|
187
|
+
expect(Module.method).toEqual 'something'
|
197
188
|
```
|
198
189
|
|
199
190
|
### Custom Reporter
|
@@ -1,31 +1,38 @@
|
|
1
|
+
// using react's Function.prototype.bind polyfill for phantomjs
|
2
|
+
// https://github.com/facebook/react/blob/master/src/test/phantomjs-shims.js
|
3
|
+
|
1
4
|
(function() {
|
2
|
-
/**
|
3
|
-
* Function.bind for ECMAScript 5 Support
|
4
|
-
*
|
5
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind
|
6
|
-
*/
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
var Ap = Array.prototype;
|
7
|
+
var slice = Ap.slice;
|
8
|
+
var Fp = Function.prototype;
|
9
|
+
|
10
|
+
if (!Fp.bind) {
|
11
|
+
// PhantomJS doesn't support Function.prototype.bind natively, so
|
12
|
+
// polyfill it whenever this module is required.
|
13
|
+
Fp.bind = function(context) {
|
14
|
+
var func = this;
|
15
|
+
var args = slice.call(arguments, 1);
|
16
|
+
|
17
|
+
function bound() {
|
18
|
+
var invokedAsConstructor = func.prototype && (this instanceof func);
|
19
|
+
return func.apply(
|
20
|
+
// Ignore the context parameter when invoking the bound function
|
21
|
+
// as a constructor. Note that this includes not only constructor
|
22
|
+
// invocations using the new keyword but also calls to base class
|
23
|
+
// constructors such as BaseClass.call(this, ...) or super(...).
|
24
|
+
!invokedAsConstructor && context || this,
|
25
|
+
args.concat(slice.call(arguments))
|
26
|
+
);
|
27
|
+
}
|
14
28
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
return fToBind.apply(this instanceof fNOP && oThis
|
20
|
-
? this
|
21
|
-
: oThis,
|
22
|
-
aArgs.concat(Array.prototype.slice.call(arguments)));
|
23
|
-
};
|
29
|
+
// The bound function must share the .prototype of the unbound
|
30
|
+
// function so that any object created by one constructor will count
|
31
|
+
// as an instance of both constructors.
|
32
|
+
bound.prototype = func.prototype;
|
24
33
|
|
25
|
-
|
26
|
-
|
34
|
+
return bound;
|
35
|
+
};
|
36
|
+
}
|
27
37
|
|
28
|
-
|
29
|
-
};
|
30
|
-
}
|
31
|
-
})();
|
38
|
+
})();
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jasmine-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
5
|
-
prerelease:
|
4
|
+
version: 0.9.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Justin Searls
|
@@ -11,46 +10,41 @@ authors:
|
|
11
10
|
autorequire:
|
12
11
|
bindir: bin
|
13
12
|
cert_chain: []
|
14
|
-
date: 2014-
|
13
|
+
date: 2014-07-02 00:00:00.000000000 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: railties
|
18
17
|
requirement: !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
18
|
requirements:
|
21
|
-
- -
|
19
|
+
- - '>='
|
22
20
|
- !ruby/object:Gem::Version
|
23
21
|
version: 3.1.0
|
24
22
|
type: :runtime
|
25
23
|
prerelease: false
|
26
24
|
version_requirements: !ruby/object:Gem::Requirement
|
27
|
-
none: false
|
28
25
|
requirements:
|
29
|
-
- -
|
26
|
+
- - '>='
|
30
27
|
- !ruby/object:Gem::Version
|
31
28
|
version: 3.1.0
|
32
29
|
- !ruby/object:Gem::Dependency
|
33
30
|
name: sprockets-rails
|
34
31
|
requirement: !ruby/object:Gem::Requirement
|
35
|
-
none: false
|
36
32
|
requirements:
|
37
|
-
- -
|
33
|
+
- - '>='
|
38
34
|
- !ruby/object:Gem::Version
|
39
35
|
version: '0'
|
40
36
|
type: :runtime
|
41
37
|
prerelease: false
|
42
38
|
version_requirements: !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
39
|
requirements:
|
45
|
-
- -
|
40
|
+
- - '>='
|
46
41
|
- !ruby/object:Gem::Version
|
47
42
|
version: '0'
|
48
43
|
- !ruby/object:Gem::Dependency
|
49
44
|
name: jasmine-core
|
50
45
|
requirement: !ruby/object:Gem::Requirement
|
51
|
-
none: false
|
52
46
|
requirements:
|
53
|
-
- -
|
47
|
+
- - '>='
|
54
48
|
- !ruby/object:Gem::Version
|
55
49
|
version: '1.3'
|
56
50
|
- - <
|
@@ -59,9 +53,8 @@ dependencies:
|
|
59
53
|
type: :runtime
|
60
54
|
prerelease: false
|
61
55
|
version_requirements: !ruby/object:Gem::Requirement
|
62
|
-
none: false
|
63
56
|
requirements:
|
64
|
-
- -
|
57
|
+
- - '>='
|
65
58
|
- !ruby/object:Gem::Version
|
66
59
|
version: '1.3'
|
67
60
|
- - <
|
@@ -70,33 +63,29 @@ dependencies:
|
|
70
63
|
- !ruby/object:Gem::Dependency
|
71
64
|
name: phantomjs
|
72
65
|
requirement: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
66
|
requirements:
|
75
|
-
- -
|
67
|
+
- - '>='
|
76
68
|
- !ruby/object:Gem::Version
|
77
69
|
version: '0'
|
78
70
|
type: :runtime
|
79
71
|
prerelease: false
|
80
72
|
version_requirements: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
73
|
requirements:
|
83
|
-
- -
|
74
|
+
- - '>='
|
84
75
|
- !ruby/object:Gem::Version
|
85
76
|
version: '0'
|
86
77
|
- !ruby/object:Gem::Dependency
|
87
78
|
name: testbeds
|
88
79
|
requirement: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
80
|
requirements:
|
91
|
-
- -
|
81
|
+
- - '>='
|
92
82
|
- !ruby/object:Gem::Version
|
93
83
|
version: '0'
|
94
84
|
type: :development
|
95
85
|
prerelease: false
|
96
86
|
version_requirements: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
87
|
requirements:
|
99
|
-
- -
|
88
|
+
- - '>='
|
100
89
|
- !ruby/object:Gem::Version
|
101
90
|
version: '0'
|
102
91
|
description: Provides a Jasmine Spec Runner that plays nicely with Rails 3.1 assets
|
@@ -109,6 +98,9 @@ executables: []
|
|
109
98
|
extensions: []
|
110
99
|
extra_rdoc_files: []
|
111
100
|
files:
|
101
|
+
- MIT-LICENSE
|
102
|
+
- README.md
|
103
|
+
- Rakefile
|
112
104
|
- app/controllers/jasmine_rails/application_controller.rb
|
113
105
|
- app/controllers/jasmine_rails/spec_runner_controller.rb
|
114
106
|
- app/helpers/jasmine_rails/spec_runner_helper.rb
|
@@ -132,37 +124,27 @@ files:
|
|
132
124
|
- lib/jasmine_rails/save_fixture.rb
|
133
125
|
- lib/jasmine_rails/version.rb
|
134
126
|
- lib/tasks/jasmine-rails_tasks.rake
|
135
|
-
- MIT-LICENSE
|
136
|
-
- Rakefile
|
137
|
-
- README.md
|
138
127
|
homepage: http://github.com/searls/jasmine-rails
|
139
128
|
licenses: []
|
129
|
+
metadata: {}
|
140
130
|
post_install_message:
|
141
131
|
rdoc_options: []
|
142
132
|
require_paths:
|
143
133
|
- lib
|
144
134
|
required_ruby_version: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
135
|
requirements:
|
147
|
-
- -
|
136
|
+
- - '>='
|
148
137
|
- !ruby/object:Gem::Version
|
149
138
|
version: '0'
|
150
|
-
segments:
|
151
|
-
- 0
|
152
|
-
hash: -2099432972387832543
|
153
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
|
-
none: false
|
155
140
|
requirements:
|
156
|
-
- -
|
141
|
+
- - '>='
|
157
142
|
- !ruby/object:Gem::Version
|
158
143
|
version: '0'
|
159
|
-
segments:
|
160
|
-
- 0
|
161
|
-
hash: -2099432972387832543
|
162
144
|
requirements: []
|
163
145
|
rubyforge_project:
|
164
|
-
rubygems_version:
|
146
|
+
rubygems_version: 2.3.0
|
165
147
|
signing_key:
|
166
|
-
specification_version:
|
148
|
+
specification_version: 4
|
167
149
|
summary: Makes Jasmine easier on Rails 3.1
|
168
150
|
test_files: []
|