oojspec 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -36,6 +36,11 @@ Feel free to explore it in jsfiddle:
|
|
36
36
|
- [CoffeeScript example with test runner](http://jsfiddle.net/rosenfeld/qJSyz/)
|
37
37
|
- [CoffeeScript example without test runner](http://jsfiddle.net/rosenfeld/37Qdn/)
|
38
38
|
|
39
|
+
Or some object-oriented approach:
|
40
|
+
|
41
|
+
- [JavaScript OO approach](http://jsfiddle.net/rosenfeld/mkw3v/)
|
42
|
+
- [CoffeeScript OO approach](http://jsfiddle.net/rosenfeld/ze8mU/)
|
43
|
+
|
39
44
|
And finally [a more complete suite](http://jsfiddle.net/rosenfeld/wgBJg/)
|
40
45
|
demonstrating lots of the features available. This was extracted from the test
|
41
46
|
application and is expected to fail. The result should be the same as the first
|
@@ -169,8 +174,7 @@ The other approach is to compile the source (possibly in the
|
|
169
174
|
[Try CoffeeScript page](http://coffeescript.org/)) and write your own custom runner HTML. Just take
|
170
175
|
the template provided by this gem as an example on how to write it.
|
171
176
|
|
172
|
-
|
173
|
-
in the future.
|
177
|
+
Alternatively you can take a look at the jsfiddle demos from the Examples section.
|
174
178
|
|
175
179
|
# Plans for the future
|
176
180
|
|
@@ -179,8 +183,6 @@ features in my spare time.
|
|
179
183
|
|
180
184
|
I'd like to support `given-and-when-and-then-and` style specs at some point.
|
181
185
|
|
182
|
-
Also, I'm still thinking about a more object-oriented API for the description blocks.
|
183
|
-
|
184
186
|
But I wanted to have some initial working version published soon before someone register an
|
185
187
|
`oojspec` gem before me! :)
|
186
188
|
|
@@ -0,0 +1,43 @@
|
|
1
|
+
h = buster.reporters.html
|
2
|
+
h._lists = []
|
3
|
+
|
4
|
+
# original private function defined in Buster.js. Re-writing it here in CS
|
5
|
+
el = (doc, tagName, properties) ->
|
6
|
+
e = doc.createElement(tagName)
|
7
|
+
for prop, value of properties
|
8
|
+
e.setAttribute prop, value if prop is "http-equiv"
|
9
|
+
prop = "innerHTML" if prop == "text"
|
10
|
+
e[prop] = value
|
11
|
+
e
|
12
|
+
|
13
|
+
oldCreate = h.create # patch create
|
14
|
+
h.create = ->
|
15
|
+
reporter = oldCreate.apply this, arguments
|
16
|
+
reporter._lists = []
|
17
|
+
reporter
|
18
|
+
|
19
|
+
h.contextStart = (context)->
|
20
|
+
container = @_lists[0] or @root
|
21
|
+
container.appendChild el(@doc, "h2", text: context.name)
|
22
|
+
container.appendChild @_list = el(@doc, "ul")
|
23
|
+
@_lists.unshift @_list
|
24
|
+
|
25
|
+
# fix Buster.js time reporting
|
26
|
+
oldListen = h.listen
|
27
|
+
h.listen = (runner)->
|
28
|
+
result = oldListen.apply this, arguments
|
29
|
+
runner.bind this, 'suite:start': 'suiteStart'
|
30
|
+
result
|
31
|
+
|
32
|
+
# doesn't currently exist in original reporter
|
33
|
+
h.suiteStart = -> @startedAt = new Date()
|
34
|
+
|
35
|
+
h.list = ->
|
36
|
+
unless @_list = @_lists[0]
|
37
|
+
@_lists.unshift @_list = el(this.doc, "ul", className: "test-results")
|
38
|
+
@root.appendChild(@_list)
|
39
|
+
@_list
|
40
|
+
|
41
|
+
h.contextEnd = (context)->
|
42
|
+
@_lists.shift()
|
43
|
+
@_list = @_lists[0]
|
@@ -3,3 +3,19 @@
|
|
3
3
|
.buster-test h1 .buster-logo {
|
4
4
|
background-image: url(<%= asset_path "buster/logo.png" %>);
|
5
5
|
}
|
6
|
+
|
7
|
+
/* override margin to use 0.2em on top and bottom instead of 1em at bottom only. */
|
8
|
+
.buster-test h1,
|
9
|
+
.buster-test h2,
|
10
|
+
.buster-test h3,
|
11
|
+
.buster-test h4,
|
12
|
+
.buster-test h5,
|
13
|
+
.buster-test h6,
|
14
|
+
.buster-test p {
|
15
|
+
margin: 0.2em 0;
|
16
|
+
}
|
17
|
+
|
18
|
+
/* was 0 0 1em 15px */
|
19
|
+
.buster-test ul {
|
20
|
+
margin: 0.2em 0 0.2em 15px;
|
21
|
+
}
|
data/lib/oojspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oojspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -52,6 +52,7 @@ extensions: []
|
|
52
52
|
extra_rdoc_files: []
|
53
53
|
files:
|
54
54
|
- app/views/oojspec/runner.html.erb
|
55
|
+
- lib/assets/javascripts/oojspec/reporter/html-multi-level.js.coffee
|
55
56
|
- lib/assets/javascripts/oojspec.js.coffee
|
56
57
|
- lib/assets/stylesheets/oojspec.css.erb
|
57
58
|
- lib/tasks/oojspec_tasks.rake
|
@@ -85,7 +86,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
85
86
|
version: '0'
|
86
87
|
segments:
|
87
88
|
- 0
|
88
|
-
hash:
|
89
|
+
hash: 2483002507602501921
|
89
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
91
|
none: false
|
91
92
|
requirements:
|
@@ -94,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
95
|
version: '0'
|
95
96
|
segments:
|
96
97
|
- 0
|
97
|
-
hash:
|
98
|
+
hash: 2483002507602501921
|
98
99
|
requirements: []
|
99
100
|
rubyforge_project:
|
100
101
|
rubygems_version: 1.8.24
|