opal-spec 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,21 @@
1
+ require 'opal-spec'
2
+
3
+ OpalSpec.on_dom_ready do
4
+ Dir[OpalSpec.autorun_glob].each do |s|
5
+ require s
6
+ end
7
+
8
+ OpalSpec::Runner.new.run
9
+ end
10
+
11
+ module OpalSpec
12
+ @autorun_glob = "spec/**/*"
13
+
14
+ def self.autorun_glob
15
+ @autorun_glob
16
+ end
17
+
18
+ def self.autorun_glob=(glob)
19
+ @autorun_glob = glob
20
+ end
21
+ end
data/lib/opal-spec/dom.rb CHANGED
@@ -1,4 +1,13 @@
1
1
  module OpalSpec
2
+
3
+ def self.on_dom_ready(&block)
4
+ %x{
5
+ setTimeout(function() {
6
+ #{ block.call };
7
+ }, 0);
8
+ }
9
+ end
10
+
2
11
  class Element
3
12
  def self.body_ready?
4
13
  `!!(document && document.body)`
@@ -1,45 +1,34 @@
1
- # cheat until proper method available..
2
- %x{
3
- setTimeout(function() {
4
- #{OpalSpec::Runner.new.run}
5
- }, 0);
6
- }
7
-
8
1
  module OpalSpec
9
2
  class Runner
10
- # def self.autorun
11
- # at_exit { OpalSpec::Runner.new.run }
12
- # end
13
-
14
3
  def initialize
15
- @formatters = [BrowserFormatter.new]
4
+ @formatter = BrowserFormatter.new
16
5
  end
17
6
 
18
7
  def run
19
8
  groups = ExampleGroup.example_groups
20
- @formatters.each { |f| f.start }
9
+ @formatter.start
21
10
  groups.each { |group| group.run self }
22
- @formatters.each { |f| f.finish }
11
+ @formatter.finish
23
12
  end
24
13
 
25
14
  def example_group_started group
26
- @formatters.each { |f| f.example_group_started group }
15
+ @formatter.example_group_started group
27
16
  end
28
17
 
29
18
  def example_group_finished group
30
- @formatters.each { |f| f.example_group_finished group }
19
+ @formatter.example_group_finished group
31
20
  end
32
21
 
33
22
  def example_started example
34
- @formatters.each { |f| f.example_started example }
23
+ @formatter.example_started example
35
24
  end
36
25
 
37
26
  def example_passed example
38
- @formatters.each { |f| f.example_passed example }
27
+ @formatter.example_passed example
39
28
  end
40
29
 
41
30
  def example_failed example
42
- @formatters.each { |f| f.example_failed example }
31
+ @formatter.example_failed example
43
32
  end
44
33
  end
45
- end
34
+ end
@@ -1,3 +1,3 @@
1
1
  module OpalSpec
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
data/lib/opal-spec.rb CHANGED
@@ -3,7 +3,7 @@ require 'opal-spec/example_group'
3
3
  require 'opal-spec/matchers'
4
4
  require 'opal-spec/runner'
5
5
  require 'opal-spec/scratch_pad'
6
- require 'opal-spec/exception'
6
+ require 'opal-spec/expectations'
7
7
  require 'opal-spec/browser_formatter'
8
8
  require 'opal-spec/dom'
9
9
  require 'opal-spec/kernel'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal-spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-20 00:00:00.000000000Z
12
+ date: 2012-05-29 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: Opal compatible spec
15
15
  email: adam@adambeynon.com
@@ -29,6 +29,7 @@ files:
29
29
  - example/runner.html
30
30
  - example/spec_helper.rb
31
31
  - lib/opal-spec.rb
32
+ - lib/opal-spec/autorun.rb
32
33
  - lib/opal-spec/browser_formatter.rb
33
34
  - lib/opal-spec/dom.rb
34
35
  - lib/opal-spec/example.rb
@@ -60,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
61
  version: '0'
61
62
  requirements: []
62
63
  rubyforge_project:
63
- rubygems_version: 1.8.10
64
+ rubygems_version: 1.8.11
64
65
  signing_key:
65
66
  specification_version: 3
66
67
  summary: Opal compatible spec