teaspoon-mocha 2.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +7 -0
  2. data/lib/teaspoon-mocha.rb +4 -0
  3. data/lib/teaspoon/mocha/assets/mocha/1.10.0.js +5374 -0
  4. data/lib/teaspoon/mocha/assets/mocha/1.17.1.js +5813 -0
  5. data/lib/teaspoon/mocha/assets/mocha/1.18.2.js +5841 -0
  6. data/lib/teaspoon/mocha/assets/mocha/1.19.0.js +5843 -0
  7. data/lib/teaspoon/mocha/assets/mocha/2.0.1.js +6070 -0
  8. data/lib/teaspoon/mocha/assets/mocha/2.1.0.js +6299 -0
  9. data/lib/teaspoon/mocha/assets/mocha/2.2.4.js +6565 -0
  10. data/lib/teaspoon/mocha/assets/mocha/MIT.LICENSE +22 -0
  11. data/lib/teaspoon/mocha/assets/support/chai-1.10.0.js +4800 -0
  12. data/lib/teaspoon/mocha/assets/support/chai-jq-0.0.7.js +524 -0
  13. data/lib/teaspoon/mocha/assets/support/chai.js +4782 -0
  14. data/lib/teaspoon/mocha/assets/support/expect.js +1284 -0
  15. data/lib/teaspoon/mocha/assets/support/sinon-chai.js +126 -0
  16. data/lib/teaspoon/mocha/assets/teaspoon-mocha.js +1435 -0
  17. data/lib/teaspoon/mocha/assets/teaspoon/mocha.coffee +10 -0
  18. data/lib/teaspoon/mocha/assets/teaspoon/mocha/fixture.coffee +14 -0
  19. data/lib/teaspoon/mocha/assets/teaspoon/mocha/intiialize.coffee +4 -0
  20. data/lib/teaspoon/mocha/assets/teaspoon/mocha/reporters/html.coffee +14 -0
  21. data/lib/teaspoon/mocha/assets/teaspoon/mocha/reporters/spec_view.coffee +6 -0
  22. data/lib/teaspoon/mocha/assets/teaspoon/mocha/responder.coffee +38 -0
  23. data/lib/teaspoon/mocha/assets/teaspoon/mocha/runner.coffee +16 -0
  24. data/lib/teaspoon/mocha/assets/teaspoon/mocha/spec.coffee +34 -0
  25. data/lib/teaspoon/mocha/assets/teaspoon/mocha/suite.coffee +8 -0
  26. data/lib/teaspoon/mocha/framework.rb +31 -0
  27. data/lib/teaspoon/mocha/templates/spec_helper.coffee +40 -0
  28. data/lib/teaspoon/mocha/templates/spec_helper.js +40 -0
  29. data/lib/teaspoon/mocha/version.rb +5 -0
  30. metadata +88 -0
@@ -0,0 +1,10 @@
1
+ #= require teaspoon/teaspoon
2
+ #= require_self
3
+ #= require_tree ./mocha
4
+
5
+ unless mocha?
6
+ throw new Teaspoon.Error('Mocha not found -- use `suite.use_framework :mocha` and adjust or remove the `suite.javascripts` directive.')
7
+
8
+ @Teaspoon ?= {}
9
+ @Teaspoon.Mocha ?= {}
10
+ @Teaspoon.Mocha.Reporters ?= {}
@@ -0,0 +1,14 @@
1
+ #= require teaspoon/fixture
2
+
3
+ class Teaspoon.Mocha.Fixture extends Teaspoon.Fixture
4
+
5
+ @load: ->
6
+ args = arguments
7
+ if window.env.started then super
8
+ else beforeEach => fixture.__super__.constructor.load.apply(@, args)
9
+
10
+
11
+ @set: ->
12
+ args = arguments
13
+ if window.env.started then super
14
+ else beforeEach => fixture.__super__.constructor.set.apply(@, args)
@@ -0,0 +1,4 @@
1
+ Teaspoon.setFramework(Teaspoon.Mocha)
2
+
3
+ # set the environment
4
+ window.env = mocha.setup("bdd")
@@ -0,0 +1,14 @@
1
+ #= require teaspoon/reporters/html
2
+
3
+ class Teaspoon.Mocha.Reporters.HTML extends Teaspoon.Reporters.HTML
4
+
5
+ reportSpecResults: (spec) ->
6
+ # Mocha does not report pending specs as starting, only as completed with a
7
+ # pending state. So, we need to instantiate the view for the pending spec.
8
+ if spec.pending
9
+ @reportView = new Teaspoon.Mocha.Reporters.HTML.SpecView(spec, @) if @config["build-full-report"]
10
+ super(spec)
11
+
12
+
13
+ envInfo: ->
14
+ "mocha #{_mocha_version || "[unknown version]"}"
@@ -0,0 +1,6 @@
1
+ #= require teaspoon/reporters/html/spec_view
2
+
3
+ class Teaspoon.Mocha.Reporters.HTML.SpecView extends Teaspoon.Reporters.HTML.SpecView
4
+
5
+ updateState: (state) ->
6
+ super(state, @spec.spec.duration)
@@ -0,0 +1,38 @@
1
+ class Teaspoon.Mocha.Responder
2
+
3
+ constructor: (runner) ->
4
+ @reporter.reportRunnerStarting(total: runner.total)
5
+
6
+ runner.on("end", @runnerDone)
7
+ runner.on("suite", @suiteStarted)
8
+ runner.on("suite end", @suiteDone)
9
+ runner.on("test", @specStarted)
10
+ runner.on("fail", @specFailed)
11
+ runner.on("test end", @specFinished)
12
+
13
+
14
+ runnerDone: =>
15
+ @reporter.reportRunnerResults()
16
+
17
+
18
+ suiteStarted: (suite) =>
19
+ @reporter.reportSuiteStarting(new Teaspoon.Mocha.Suite(suite))
20
+
21
+
22
+ suiteDone: (suite) =>
23
+ @reporter.reportSuiteResults(new Teaspoon.Mocha.Suite(suite))
24
+
25
+
26
+ specStarted: (spec) =>
27
+ @reporter.reportSpecStarting(new Teaspoon.Mocha.Spec(spec))
28
+
29
+
30
+ specFinished: (spec) =>
31
+ spec = new Teaspoon.Mocha.Spec(spec)
32
+ @reporter.reportSpecResults(spec) unless spec.result().status == "failed"
33
+
34
+
35
+ specFailed: (spec, err) =>
36
+ spec.err = err
37
+
38
+ @reporter.reportSpecResults(new Teaspoon.Mocha.Spec(spec))
@@ -0,0 +1,16 @@
1
+ #= require teaspoon/runner
2
+
3
+ class Teaspoon.Mocha.Runner extends Teaspoon.Runner
4
+
5
+ constructor: ->
6
+ super
7
+ window.env.run()
8
+ window.env.started = true
9
+ afterEach -> Teaspoon.Mocha.Fixture.cleanup()
10
+
11
+
12
+ setup: ->
13
+ # add the reporter and set the filter
14
+ reporter = new (@getReporter())()
15
+ Teaspoon.Mocha.Responder::reporter = reporter
16
+ window.env.setup(reporter: Teaspoon.Mocha.Responder)
@@ -0,0 +1,34 @@
1
+ class Teaspoon.Mocha.Spec
2
+
3
+ constructor: (@spec) ->
4
+ @fullDescription = @spec.fullTitle()
5
+ @description = @spec.title
6
+ @link = "?grep=#{encodeURIComponent(@fullDescription)}"
7
+ @parent = @spec.parent
8
+ @suiteName = @parent.fullTitle()
9
+ @viewId = @spec.viewId
10
+ @pending = @spec.pending
11
+
12
+
13
+ errors: ->
14
+ return [] unless @spec.err
15
+ [@spec.err]
16
+
17
+
18
+ getParents: ->
19
+ return @parents if @parents
20
+ @parents ||= []
21
+ parent = @parent
22
+ while parent
23
+ parent = new Teaspoon.Mocha.Suite(parent)
24
+ @parents.unshift(parent)
25
+ parent = parent.parent
26
+ @parents
27
+
28
+
29
+ result: ->
30
+ status = "failed"
31
+ status = "passed" if @spec.state == "passed" || @spec.state == "skipped"
32
+ status = "pending" if @spec.pending
33
+ status: status
34
+ skipped: @spec.state == "skipped"
@@ -0,0 +1,8 @@
1
+ class Teaspoon.Mocha.Suite
2
+
3
+ constructor: (@suite) ->
4
+ @fullDescription = @suite.fullTitle()
5
+ @description = @suite.title
6
+ @link = "?grep=#{encodeURIComponent(@fullDescription)}"
7
+ @parent = if @suite.parent?.root then null else @suite.parent
8
+ @viewId = @suite.viewId
@@ -0,0 +1,31 @@
1
+ require "teaspoon/framework/base"
2
+
3
+ module Teaspoon
4
+ module Mocha
5
+ class Framework < Teaspoon::Framework::Base
6
+ # specify the framework name
7
+ framework_name :mocha
8
+
9
+ # register standard versions
10
+ versions = ["1.10.0", "1.17.1", "1.18.2", "1.19.0", "2.0.1", "2.1.0", "2.2.4"]
11
+
12
+ versions.each do |version|
13
+ register_version version, "mocha/#{version}.js",
14
+ dependencies: ["teaspoon-mocha.js"],
15
+ dev_deps: ["teaspoon/mocha.js"]
16
+ end
17
+
18
+ # add asset paths
19
+ add_asset_path File.expand_path("../../../teaspoon/mocha/assets", __FILE__)
20
+
21
+ # add custom install templates
22
+ add_template_path File.expand_path("../../../teaspoon/mocha/templates", __FILE__)
23
+
24
+ # specify where to install, and add installation steps.
25
+ install_to "spec" do
26
+ ext = options[:coffee] ? ".coffee" : ".js"
27
+ copy_file "spec_helper#{ext}", "spec/javascripts/spec_helper#{ext}"
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,40 @@
1
+ # Teaspoon includes some support files, but you can use anything from your own support path too.
2
+ # require support/expect
3
+ # require support/sinon
4
+ # require support/chai
5
+ # require support/chai-jq-0.0.7
6
+ # require support/your-support-file
7
+ #
8
+ # PhantomJS (Teaspoons default driver) doesn't have support for Function.prototype.bind, which has caused confusion.
9
+ # Use this polyfill to avoid the confusion.
10
+ #= require support/bind-poly
11
+ #
12
+ # You can require your own javascript files here. By default this will include everything in application, however you
13
+ # may get better load performance if you require the specific files that are being used in the spec that tests them.
14
+ #= require application
15
+ #
16
+ # Deferring execution
17
+ # If you're using CommonJS, RequireJS or some other asynchronous library you can defer execution. Call
18
+ # Teaspoon.execute() after everything has been loaded. Simple example of a timeout:
19
+ #
20
+ # Teaspoon.defer = true
21
+ # setTimeout(Teaspoon.execute, 1000)
22
+ #
23
+ # Matching files
24
+ # By default Teaspoon will look for files that match _spec.{js,js.coffee,.coffee}. Add a filename_spec.js file in your
25
+ # spec path and it'll be included in the default suite automatically. If you want to customize suites, check out the
26
+ # configuration in teaspoon_env.rb
27
+ #
28
+ # Manifest
29
+ # If you'd rather require your spec files manually (to control order for instance) you can disable the suite matcher in
30
+ # the configuration and use this file as a manifest.
31
+ #
32
+ # For more information: http://github.com/modeset/teaspoon
33
+ #
34
+ # Chai
35
+ # If you're using Chai, you'll probably want to initialize your preferred assertion style. You can read more about Chai
36
+ # at: http://chaijs.com/guide/styles
37
+ #
38
+ # window.assert = chai.assert
39
+ # window.expect = chai.expect
40
+ # window.should = chai.should()
@@ -0,0 +1,40 @@
1
+ // Teaspoon includes some support files, but you can use anything from your own support path too.
2
+ // require support/expect
3
+ // require support/sinon
4
+ // require support/chai
5
+ // require support/chai-jq-0.0.7
6
+ // require support/your-support-file
7
+ //
8
+ // PhantomJS (Teaspoons default driver) doesn't have support for Function.prototype.bind, which has caused confusion.
9
+ // Use this polyfill to avoid the confusion.
10
+ //= require support/bind-poly
11
+ //
12
+ // You can require your own javascript files here. By default this will include everything in application, however you
13
+ // may get better load performance if you require the specific files that are being used in the spec that tests them.
14
+ //= require application
15
+ //
16
+ // Deferring execution
17
+ // If you're using CommonJS, RequireJS or some other asynchronous library you can defer execution. Call
18
+ // Teaspoon.execute() after everything has been loaded. Simple example of a timeout:
19
+ //
20
+ // Teaspoon.defer = true
21
+ // setTimeout(Teaspoon.execute, 1000)
22
+ //
23
+ // Matching files
24
+ // By default Teaspoon will look for files that match _spec.{js,js.coffee,.coffee}. Add a filename_spec.js file in your
25
+ // spec path and it'll be included in the default suite automatically. If you want to customize suites, check out the
26
+ // configuration in teaspoon_env.rb
27
+ //
28
+ // Manifest
29
+ // If you'd rather require your spec files manually (to control order for instance) you can disable the suite matcher in
30
+ // the configuration and use this file as a manifest.
31
+ //
32
+ // For more information: http://github.com/modeset/teaspoon
33
+ //
34
+ // Chai
35
+ // If you're using Chai, you'll probably want to initialize your preferred assertion style. You can read more about Chai
36
+ // at: http://chaijs.com/guide/styles
37
+ //
38
+ // window.assert = chai.assert;
39
+ // window.expect = chai.expect;
40
+ // window.should = chai.should();
@@ -0,0 +1,5 @@
1
+ module Teaspoon
2
+ module Mocha
3
+ VERSION = "2.2.4"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: teaspoon-mocha
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.2.4
5
+ platform: ruby
6
+ authors:
7
+ - jejacks0n
8
+ - mikepack
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-05-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: teaspoon
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: 1.0.0
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: 1.0.0
28
+ description: Run Mocha specs in the browser or headless with PhantomJS, Selenium Webdriver,
29
+ or Capybara Webkit
30
+ email:
31
+ - info@modeset.com
32
+ executables: []
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - lib/teaspoon-mocha.rb
37
+ - lib/teaspoon/mocha/assets/mocha/1.10.0.js
38
+ - lib/teaspoon/mocha/assets/mocha/1.17.1.js
39
+ - lib/teaspoon/mocha/assets/mocha/1.18.2.js
40
+ - lib/teaspoon/mocha/assets/mocha/1.19.0.js
41
+ - lib/teaspoon/mocha/assets/mocha/2.0.1.js
42
+ - lib/teaspoon/mocha/assets/mocha/2.1.0.js
43
+ - lib/teaspoon/mocha/assets/mocha/2.2.4.js
44
+ - lib/teaspoon/mocha/assets/mocha/MIT.LICENSE
45
+ - lib/teaspoon/mocha/assets/support/chai-1.10.0.js
46
+ - lib/teaspoon/mocha/assets/support/chai-jq-0.0.7.js
47
+ - lib/teaspoon/mocha/assets/support/chai.js
48
+ - lib/teaspoon/mocha/assets/support/expect.js
49
+ - lib/teaspoon/mocha/assets/support/sinon-chai.js
50
+ - lib/teaspoon/mocha/assets/teaspoon-mocha.js
51
+ - lib/teaspoon/mocha/assets/teaspoon/mocha.coffee
52
+ - lib/teaspoon/mocha/assets/teaspoon/mocha/fixture.coffee
53
+ - lib/teaspoon/mocha/assets/teaspoon/mocha/intiialize.coffee
54
+ - lib/teaspoon/mocha/assets/teaspoon/mocha/reporters/html.coffee
55
+ - lib/teaspoon/mocha/assets/teaspoon/mocha/reporters/spec_view.coffee
56
+ - lib/teaspoon/mocha/assets/teaspoon/mocha/responder.coffee
57
+ - lib/teaspoon/mocha/assets/teaspoon/mocha/runner.coffee
58
+ - lib/teaspoon/mocha/assets/teaspoon/mocha/spec.coffee
59
+ - lib/teaspoon/mocha/assets/teaspoon/mocha/suite.coffee
60
+ - lib/teaspoon/mocha/framework.rb
61
+ - lib/teaspoon/mocha/templates/spec_helper.coffee
62
+ - lib/teaspoon/mocha/templates/spec_helper.js
63
+ - lib/teaspoon/mocha/version.rb
64
+ homepage: https://github.com/modeset/teaspoon
65
+ licenses:
66
+ - MIT
67
+ metadata: {}
68
+ post_install_message:
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ requirements: []
83
+ rubyforge_project:
84
+ rubygems_version: 2.4.5
85
+ signing_key:
86
+ specification_version: 4
87
+ summary: 'Teaspoon Mocha: A Javascript test runner built on top of Rails for Mocha'
88
+ test_files: []