jspec 4.3.2 → 4.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +8 -0
- data/jspec.gemspec +4 -4
- data/lib/jspec.jquery.js +12 -3
- data/lib/jspec.js +21 -6
- data/lib/jspec.timers.js +123 -59
- data/spec/support/jquery.js +4382 -2518
- data/spec/unit/spec.jquery.js +19 -1
- data/spec/unit/spec.jquery.xhr.js +22 -3
- data/spec/unit/spec.utils.js +9 -0
- data/src/installables.rb +3 -3
- data/src/project.rb +2 -2
- data/src/routes.rb +5 -1
- metadata +17 -4
data/spec/unit/spec.jquery.js
CHANGED
@@ -17,6 +17,18 @@ describe 'jQuery'
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
describe 'with the document element'
|
21
|
+
it 'should output "jQuery(document)"'
|
22
|
+
puts($(document)).should.match(/jQuery\(document\)/i)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe 'without parameters'
|
27
|
+
it 'should output "jQuery()"'
|
28
|
+
puts($()).should.match(/jQuery\(\)/i)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
20
32
|
describe 'sandbox()'
|
21
33
|
before
|
22
34
|
dom = sandbox()
|
@@ -120,6 +132,12 @@ describe 'jQuery'
|
|
120
132
|
elem.bind('click', function(){})
|
121
133
|
elem.should.have_event_handlers 'click'
|
122
134
|
end
|
135
|
+
|
136
|
+
it 'should check if an element has handlers for a given event when binded with live'
|
137
|
+
$('.live-event').should.not.have_event_handlers 'click'
|
138
|
+
$('.live-event').live('click', function(){})
|
139
|
+
$('.live-event').should.have_event_handlers 'click'
|
140
|
+
end
|
123
141
|
end
|
124
142
|
|
125
143
|
describe 'be_visible'
|
@@ -191,4 +209,4 @@ describe 'jQuery'
|
|
191
209
|
end
|
192
210
|
end
|
193
211
|
|
194
|
-
end
|
212
|
+
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
describe 'jQuery'
|
3
3
|
describe '.ajax()'
|
4
4
|
it "should call the success function when 200"
|
5
|
-
mock_request().and_return('{ foo: "bar" }', 'application/json')
|
5
|
+
mock_request().and_return('{ "foo": "bar" }', 'application/json')
|
6
6
|
var successCalled = false
|
7
7
|
var errorCalled = false
|
8
8
|
$.ajax({
|
@@ -21,7 +21,7 @@ describe 'jQuery'
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should call the error function when 404"
|
24
|
-
mock_request().and_return('{ foo: "bar" }', 'application/json', 404)
|
24
|
+
mock_request().and_return('{ "foo": "bar" }', 'application/json', 404)
|
25
25
|
var successCalled = false
|
26
26
|
var errorCalled = false
|
27
27
|
$.ajax({
|
@@ -38,6 +38,25 @@ describe 'jQuery'
|
|
38
38
|
successCalled.should.be_false
|
39
39
|
errorCalled.should.be_true
|
40
40
|
end
|
41
|
+
|
42
|
+
it "should call the success function when GET script"
|
43
|
+
mock_request().and_return('', 'application/javascript', 200)
|
44
|
+
var successCalled = false
|
45
|
+
var errorCalled = false
|
46
|
+
$.ajax({
|
47
|
+
type: "GET",
|
48
|
+
url: 'http://code.jquery.com/jquery-1.4.2.js',
|
49
|
+
dataType: 'script',
|
50
|
+
success: function() {
|
51
|
+
successCalled = true
|
52
|
+
},
|
53
|
+
error: function() {
|
54
|
+
errorCalled = false
|
55
|
+
}
|
56
|
+
})
|
57
|
+
successCalled.should.be_true
|
58
|
+
errorCalled.should.be_false
|
59
|
+
end
|
41
60
|
end
|
42
61
|
|
43
62
|
it 'should work with getScript()'
|
@@ -51,7 +70,7 @@ describe 'jQuery'
|
|
51
70
|
|
52
71
|
describe '.getJSON()'
|
53
72
|
it 'should work with mockRequest'
|
54
|
-
mockRequest().and_return('{ foo : "bar" }')
|
73
|
+
mockRequest().and_return('{ "foo" : "bar" }')
|
55
74
|
$.getJSON('foo', function(response, statusText){
|
56
75
|
response.foo.should.eql 'bar'
|
57
76
|
statusText.should.eql 'success'
|
data/spec/unit/spec.utils.js
CHANGED
@@ -82,6 +82,15 @@ describe 'Utility'
|
|
82
82
|
text.should_eql 'is awesome'
|
83
83
|
})
|
84
84
|
end
|
85
|
+
|
86
|
+
it 'should overwrite previous stub'
|
87
|
+
stub(object, 'toString').and_return('I am stub overriden')
|
88
|
+
object.toString().should.eql 'I am stub overriden'
|
89
|
+
|
90
|
+
destub(object, 'toString')
|
91
|
+
object.toString().should.eql '<Im an object>'
|
92
|
+
end
|
93
|
+
|
85
94
|
end
|
86
95
|
|
87
96
|
describe 'destub()'
|
data/src/installables.rb
CHANGED
@@ -181,7 +181,7 @@ module JSpec
|
|
181
181
|
|
182
182
|
class Jquery < URI
|
183
183
|
name 'jQuery'
|
184
|
-
current '1.
|
184
|
+
current '1.4.0'
|
185
185
|
uri 'http://ajax.googleapis.com/ajax/libs/jquery/RELEASE/jquery.js'
|
186
186
|
end
|
187
187
|
|
@@ -211,7 +211,7 @@ module JSpec
|
|
211
211
|
|
212
212
|
class Mootools < URI
|
213
213
|
name 'MooTools'
|
214
|
-
current '1.2.
|
214
|
+
current '1.2.4'
|
215
215
|
uri 'http://ajax.googleapis.com/ajax/libs/mootools/RELEASE/mootools.js'
|
216
216
|
end
|
217
217
|
|
@@ -221,7 +221,7 @@ module JSpec
|
|
221
221
|
|
222
222
|
class Dojo < URI
|
223
223
|
name 'Dojo'
|
224
|
-
current '1.
|
224
|
+
current '1.4.0'
|
225
225
|
uri 'http://ajax.googleapis.com/ajax/libs/dojo/RELEASE/dojo/dojo.xd.js.uncompressed.js'
|
226
226
|
end
|
227
227
|
|
data/src/project.rb
CHANGED
@@ -37,7 +37,7 @@ module JSpec
|
|
37
37
|
# Execute _file_ with Rhino.
|
38
38
|
|
39
39
|
def rhino file
|
40
|
-
system "java -jar #{rhino_jar} #{file}"
|
40
|
+
system "java -jar #{rhino_jar} -opt -1 #{file}"
|
41
41
|
end
|
42
42
|
|
43
43
|
##
|
@@ -268,7 +268,7 @@ module JSpec
|
|
268
268
|
# Return the Project instance which should be used for _dest_.
|
269
269
|
|
270
270
|
def self.for dest
|
271
|
-
(File.
|
271
|
+
(File.exists?("#{dest}/config/boot.rb") ?
|
272
272
|
JSpec::Project::Rails :
|
273
273
|
JSpec::Project).new(dest)
|
274
274
|
end
|
data/src/routes.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 53
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 4
|
7
8
|
- 3
|
8
|
-
-
|
9
|
-
version: 4.3.
|
9
|
+
- 3
|
10
|
+
version: 4.3.3
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- TJ Holowaychuk
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-07-30 00:00:00 -05:00
|
18
19
|
default_executable: jspec
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: sinatra
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
version: "0"
|
@@ -33,9 +36,11 @@ dependencies:
|
|
33
36
|
name: json_pure
|
34
37
|
prerelease: false
|
35
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
36
40
|
requirements:
|
37
41
|
- - ">="
|
38
42
|
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
39
44
|
segments:
|
40
45
|
- 0
|
41
46
|
version: "0"
|
@@ -45,9 +50,11 @@ dependencies:
|
|
45
50
|
name: commander
|
46
51
|
prerelease: false
|
47
52
|
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
48
54
|
requirements:
|
49
55
|
- - ">="
|
50
56
|
- !ruby/object:Gem::Version
|
57
|
+
hash: 61
|
51
58
|
segments:
|
52
59
|
- 4
|
53
60
|
- 0
|
@@ -59,9 +66,11 @@ dependencies:
|
|
59
66
|
name: bind
|
60
67
|
prerelease: false
|
61
68
|
requirement: &id004 !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
62
70
|
requirements:
|
63
71
|
- - ">="
|
64
72
|
- !ruby/object:Gem::Version
|
73
|
+
hash: 7
|
65
74
|
segments:
|
66
75
|
- 0
|
67
76
|
- 2
|
@@ -189,16 +198,20 @@ rdoc_options:
|
|
189
198
|
require_paths:
|
190
199
|
- lib
|
191
200
|
required_ruby_version: !ruby/object:Gem::Requirement
|
201
|
+
none: false
|
192
202
|
requirements:
|
193
203
|
- - ">="
|
194
204
|
- !ruby/object:Gem::Version
|
205
|
+
hash: 3
|
195
206
|
segments:
|
196
207
|
- 0
|
197
208
|
version: "0"
|
198
209
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
210
|
+
none: false
|
199
211
|
requirements:
|
200
212
|
- - ">="
|
201
213
|
- !ruby/object:Gem::Version
|
214
|
+
hash: 11
|
202
215
|
segments:
|
203
216
|
- 1
|
204
217
|
- 2
|
@@ -206,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
219
|
requirements: []
|
207
220
|
|
208
221
|
rubyforge_project: jspec
|
209
|
-
rubygems_version: 1.3.
|
222
|
+
rubygems_version: 1.3.7
|
210
223
|
signing_key:
|
211
224
|
specification_version: 3
|
212
225
|
summary: JavaScript BDD Testing Framework
|