teaspoon 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 +4 -4
- data/README.md +1 -1
- data/app/assets/javascripts/teaspoon-jasmine.js +4 -5
- data/app/assets/javascripts/teaspoon-mocha.js +4 -5
- data/app/assets/javascripts/teaspoon-qunit.js +4 -5
- data/app/assets/javascripts/teaspoon/base/hook.coffee +1 -1
- data/app/assets/javascripts/teaspoon/base/reporters/html/suite_view.coffee +1 -1
- data/lib/generators/teaspoon/install/templates/_boot.html.erb +1 -1
- data/lib/teaspoon/engine.rb +9 -4
- data/lib/teaspoon/suite.rb +1 -1
- data/lib/teaspoon/version.rb +1 -1
- data/spec/dummy/config/boot.rb +1 -1
- data/spec/features/console_reporter_spec.rb +7 -3
- metadata +2 -4
- data/config/routes.rb +0 -6
- data/lib/teaspoon/configuration.rb.orig +0 -187
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 727bdb9217114560c7755d33ed032e6c05355a7f
|
4
|
+
data.tar.gz: b9cdd9f870082cebd6dd8cd3db297a3a425a8620
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c7403b545340d18c0290390108fa541d65079f7bc7c955f9816ba10d51aa07f57082754adfc36e63a81f1a5347e1b4081a4de9c4596cc0e844e868ccaa58dd9
|
7
|
+
data.tar.gz: 622b7ecb4873067b55e25ebbe2647c61bc6070a50e63c17db2674704e39ffe64b1173a7eefbcf76dfbe619dfd2c79b816a1b1dae7dff30ca50bc494cea6681d7
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Teaspoon
|
2
2
|
========
|
3
3
|
|
4
|
-
[![Gem Version](https://img.shields.io/gem/v/
|
4
|
+
[![Gem Version](https://img.shields.io/gem/v/teaspoon.svg)](https://rubygems.org/gems/teaspoon)
|
5
5
|
[![Dependency Status](https://gemnasium.com/modeset/teaspoon.svg)](https://gemnasium.com/modeset/teaspoon)
|
6
6
|
[![Build Status](https://img.shields.io/travis/modeset/teaspoon.svg)](https://travis-ci.org/modeset/teaspoon)
|
7
7
|
[![Code Climate](https://codeclimate.com/github/modeset/teaspoon/badges/gpa.svg)](https://codeclimate.com/github/modeset/teaspoon)
|
@@ -344,11 +344,10 @@
|
|
344
344
|
}).call(this);
|
345
345
|
(function() {
|
346
346
|
Teaspoon.hook = function(name, payload) {
|
347
|
-
var
|
347
|
+
var xhr, xhrRequest;
|
348
348
|
if (payload == null) {
|
349
349
|
payload = {};
|
350
350
|
}
|
351
|
-
method = "POST";
|
352
351
|
xhr = null;
|
353
352
|
xhrRequest = function(url, payload, callback) {
|
354
353
|
var e;
|
@@ -941,13 +940,13 @@
|
|
941
940
|
|
942
941
|
viewId = 0;
|
943
942
|
|
944
|
-
function SuiteView(
|
945
|
-
this.suite =
|
943
|
+
function SuiteView(suite, reporter) {
|
944
|
+
this.suite = suite;
|
946
945
|
this.reporter = reporter;
|
947
946
|
this.views = this.reporter.views;
|
948
947
|
this.suite.viewId = viewId += 1;
|
949
948
|
this.views.suites[this.suite.viewId] = this;
|
950
|
-
this.suite = new Teaspoon.Suite(suite);
|
949
|
+
this.suite = new Teaspoon.Suite(this.suite);
|
951
950
|
SuiteView.__super__.constructor.apply(this, arguments);
|
952
951
|
}
|
953
952
|
|
@@ -344,11 +344,10 @@
|
|
344
344
|
}).call(this);
|
345
345
|
(function() {
|
346
346
|
Teaspoon.hook = function(name, payload) {
|
347
|
-
var
|
347
|
+
var xhr, xhrRequest;
|
348
348
|
if (payload == null) {
|
349
349
|
payload = {};
|
350
350
|
}
|
351
|
-
method = "POST";
|
352
351
|
xhr = null;
|
353
352
|
xhrRequest = function(url, payload, callback) {
|
354
353
|
var e;
|
@@ -941,13 +940,13 @@
|
|
941
940
|
|
942
941
|
viewId = 0;
|
943
942
|
|
944
|
-
function SuiteView(
|
945
|
-
this.suite =
|
943
|
+
function SuiteView(suite, reporter) {
|
944
|
+
this.suite = suite;
|
946
945
|
this.reporter = reporter;
|
947
946
|
this.views = this.reporter.views;
|
948
947
|
this.suite.viewId = viewId += 1;
|
949
948
|
this.views.suites[this.suite.viewId] = this;
|
950
|
-
this.suite = new Teaspoon.Suite(suite);
|
949
|
+
this.suite = new Teaspoon.Suite(this.suite);
|
951
950
|
SuiteView.__super__.constructor.apply(this, arguments);
|
952
951
|
}
|
953
952
|
|
@@ -344,11 +344,10 @@
|
|
344
344
|
}).call(this);
|
345
345
|
(function() {
|
346
346
|
Teaspoon.hook = function(name, payload) {
|
347
|
-
var
|
347
|
+
var xhr, xhrRequest;
|
348
348
|
if (payload == null) {
|
349
349
|
payload = {};
|
350
350
|
}
|
351
|
-
method = "POST";
|
352
351
|
xhr = null;
|
353
352
|
xhrRequest = function(url, payload, callback) {
|
354
353
|
var e;
|
@@ -941,13 +940,13 @@
|
|
941
940
|
|
942
941
|
viewId = 0;
|
943
942
|
|
944
|
-
function SuiteView(
|
945
|
-
this.suite =
|
943
|
+
function SuiteView(suite, reporter) {
|
944
|
+
this.suite = suite;
|
946
945
|
this.reporter = reporter;
|
947
946
|
this.views = this.reporter.views;
|
948
947
|
this.suite.viewId = viewId += 1;
|
949
948
|
this.views.suites[this.suite.viewId] = this;
|
950
|
-
this.suite = new Teaspoon.Suite(suite);
|
949
|
+
this.suite = new Teaspoon.Suite(this.suite);
|
951
950
|
SuiteView.__super__.constructor.apply(this, arguments);
|
952
951
|
}
|
953
952
|
|
data/lib/teaspoon/engine.rb
CHANGED
@@ -29,11 +29,18 @@ module Teaspoon
|
|
29
29
|
'support/*.js'
|
30
30
|
]
|
31
31
|
|
32
|
+
routes do
|
33
|
+
root to: "suite#index"
|
34
|
+
match "/fixtures/*filename", to: "suite#fixtures", via: :get, as: "fixture"
|
35
|
+
match "/:suite", to: "suite#show", via: :get, as: "suite", defaults: { suite: "default" }
|
36
|
+
match "/:suite/:hook", to: "suite#hook", via: :post, as: "suite_hook", defaults: { suite: "default", hook: "default" }
|
37
|
+
end
|
38
|
+
|
32
39
|
initializer :assets, group: :all do |app|
|
33
40
|
begin
|
34
41
|
Teaspoon::Environment.require_environment
|
35
42
|
rescue Teaspoon::EnvironmentNotFound
|
36
|
-
# it's ok for this to fail sometimes, like before the
|
43
|
+
# it's ok for this to fail sometimes, like before the generator is run etc
|
37
44
|
end
|
38
45
|
|
39
46
|
Teaspoon::Engine.default_root_path(app.root) # default the root if it's not set
|
@@ -71,9 +78,7 @@ module Teaspoon
|
|
71
78
|
return if app.routes.recognize_path(mount_at)[:action] != "routing_error" rescue nil
|
72
79
|
require Teaspoon::Engine.root.join("app/controllers/teaspoon/suite_controller")
|
73
80
|
|
74
|
-
app.routes.prepend
|
75
|
-
mount Teaspoon::Engine => mount_at, as: "teaspoon"
|
76
|
-
end
|
81
|
+
app.routes.prepend { mount Teaspoon::Engine => mount_at, as: "teaspoon" }
|
77
82
|
end
|
78
83
|
end
|
79
84
|
end
|
data/lib/teaspoon/suite.rb
CHANGED
@@ -101,7 +101,7 @@ module Teaspoon
|
|
101
101
|
end
|
102
102
|
|
103
103
|
def glob
|
104
|
-
@glob ||= Dir[config.matcher.present? ? Teaspoon.configuration.root.join(config.matcher) : ""]
|
104
|
+
@glob ||= Dir[config.matcher.present? ? Teaspoon.configuration.root.join(config.matcher) : ""].sort!
|
105
105
|
end
|
106
106
|
|
107
107
|
def suite_configuration
|
data/lib/teaspoon/version.rb
CHANGED
data/spec/dummy/config/boot.rb
CHANGED
@@ -9,8 +9,12 @@ feature "testing with teaspoon in the console", aruba: true do
|
|
9
9
|
Teaspoon running default suite at http://127.0.0.1:31337/teaspoon/default
|
10
10
|
TypeError: 'undefined' is not a function (evaluating 'foo()')
|
11
11
|
# http://127.0.0.1:31337/relative/assets/integration/spec_helper.js:12
|
12
|
-
|
12
|
+
OUTPUT
|
13
|
+
output = all_output.gsub(/127\.0\.0\.1:\d+/, "127.0.0.1:31337")
|
14
|
+
output = output.gsub("undefined is not a constructor", "'undefined' is not a function")
|
15
|
+
assert_partial_output(expected, output)
|
13
16
|
|
17
|
+
expected = <<-OUTPUT.strip_heredoc
|
14
18
|
testing console output
|
15
19
|
..FF.*.
|
16
20
|
|
@@ -34,8 +38,8 @@ feature "testing with teaspoon in the console", aruba: true do
|
|
34
38
|
teaspoon -s default --filter="Integration tests allows failing specs."
|
35
39
|
teaspoon -s default --filter="Integration tests allows erroring specs."
|
36
40
|
OUTPUT
|
37
|
-
output = all_output.gsub(/
|
38
|
-
output = output.gsub(/
|
41
|
+
output = all_output.gsub(/127\.0\.0\.1:\d+/, "127.0.0.1:31337")
|
42
|
+
output = output.gsub(/Finished in [\d\.]+ seconds/, "Finished in 0.31337 seconds")
|
39
43
|
assert_partial_output(expected, output)
|
40
44
|
end
|
41
45
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teaspoon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jejacks0n
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2015-02
|
14
|
+
date: 2015-03-02 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: railties
|
@@ -77,7 +77,6 @@ files:
|
|
77
77
|
- app/views/teaspoon/suite/index.html.erb
|
78
78
|
- app/views/teaspoon/suite/show.html.erb
|
79
79
|
- bin/teaspoon
|
80
|
-
- config/routes.rb
|
81
80
|
- lib/generators/teaspoon/install/POST_INSTALL
|
82
81
|
- lib/generators/teaspoon/install/install_generator.rb
|
83
82
|
- lib/generators/teaspoon/install/templates/_body.html.erb
|
@@ -98,7 +97,6 @@ files:
|
|
98
97
|
- lib/teaspoon.rb
|
99
98
|
- lib/teaspoon/command_line.rb
|
100
99
|
- lib/teaspoon/configuration.rb
|
101
|
-
- lib/teaspoon/configuration.rb.orig
|
102
100
|
- lib/teaspoon/console.rb
|
103
101
|
- lib/teaspoon/coverage.rb
|
104
102
|
- lib/teaspoon/deprecated.rb
|
data/config/routes.rb
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
Teaspoon::Engine.routes.draw do
|
2
|
-
root to: "suite#index"
|
3
|
-
match "/fixtures/*filename", to: "suite#fixtures", via: :get
|
4
|
-
match "/:suite", as: "suite", to: "suite#show", via: :get, defaults: { suite: "default" }
|
5
|
-
match "/:suite/:hook", as: "suite_hook", to: "suite#hook", via: :post, defaults: { suite: "default", hook: "default" }
|
6
|
-
end
|
@@ -1,187 +0,0 @@
|
|
1
|
-
require "singleton"
|
2
|
-
|
3
|
-
module Teaspoon
|
4
|
-
autoload :Formatters, "teaspoon/formatters/base"
|
5
|
-
autoload :Drivers, "teaspoon/drivers/base"
|
6
|
-
|
7
|
-
class Configuration
|
8
|
-
include Singleton
|
9
|
-
|
10
|
-
# CONTRIBUTORS:
|
11
|
-
# If you add a configuration option you should do the following before it will be considered for merging.
|
12
|
-
# - think about if it should be a suite, coverage, or global configuration
|
13
|
-
# - write specs for it, and add it to existing specs in spec/teaspoon/configuration_spec.rb
|
14
|
-
# - add it to the readme so it's documented
|
15
|
-
# - add it to the command_line.rb if appropriate (_only_ if it's appropriate)
|
16
|
-
# - add it to ENV_OVERRIDES if it can be overridden from ENV
|
17
|
-
# - add it to the initializers in /lib/generators/install/templates so it's documented there as well
|
18
|
-
|
19
|
-
cattr_accessor :mount_at, :root, :asset_paths, :fixture_paths
|
20
|
-
@@mount_at = "/teaspoon"
|
21
|
-
@@root = nil # will default to Rails.root
|
22
|
-
@@asset_paths = ["spec/javascripts", "spec/javascripts/stylesheets", "test/javascripts", "test/javascripts/stylesheets"]
|
23
|
-
@@fixture_paths = ["spec/javascripts/fixtures", "test/javascripts/fixtures"]
|
24
|
-
|
25
|
-
# console runner specific
|
26
|
-
|
27
|
-
cattr_accessor :driver, :driver_options, :driver_timeout, :server, :server_port, :server_timeout, :fail_fast,
|
28
|
-
:formatters, :color, :suppress_log,
|
29
|
-
:use_coverage
|
30
|
-
@@driver = "phantomjs"
|
31
|
-
@@driver_options = nil
|
32
|
-
@@driver_timeout = 180
|
33
|
-
@@server = nil
|
34
|
-
@@server_port = nil
|
35
|
-
@@server_timeout = 20
|
36
|
-
@@fail_fast = true
|
37
|
-
|
38
|
-
@@formatters = ["dot"]
|
39
|
-
@@color = true
|
40
|
-
@@suppress_log = false
|
41
|
-
|
42
|
-
@@use_coverage = nil
|
43
|
-
|
44
|
-
# options that can be specified in the ENV
|
45
|
-
|
46
|
-
ENV_OVERRIDES = {
|
47
|
-
boolean: %w(FAIL_FAST SUPPRESS_LOG COLOR),
|
48
|
-
integer: %w(DRIVER_TIMEOUT SERVER_TIMEOUT),
|
49
|
-
string: %w(DRIVER DRIVER_OPTIONS SERVER SERVER_PORT FORMATTERS USE_COVERAGE)
|
50
|
-
}
|
51
|
-
|
52
|
-
# suite configurations
|
53
|
-
|
54
|
-
cattr_accessor :suite_configs
|
55
|
-
@@suite_configs = { "default" => { block: proc {} } }
|
56
|
-
|
57
|
-
def self.suite(name = :default, &block)
|
58
|
-
@@suite_configs[name.to_s] = { block: block, instance: Suite.new(&block) }
|
59
|
-
end
|
60
|
-
|
61
|
-
class Suite
|
62
|
-
FRAMEWORKS = {
|
63
|
-
jasmine: ["1.3.1", "2.0.0"],
|
64
|
-
mocha: ["1.10.0", "1.17.1"],
|
65
|
-
qunit: ["1.12.0", "1.14.0"],
|
66
|
-
}
|
67
|
-
|
68
|
-
attr_accessor :matcher, :helper, :javascripts, :stylesheets,
|
69
|
-
:boot_partial, :body_partial, :no_coverage, :hooks,
|
70
|
-
:expand_assets
|
71
|
-
|
72
|
-
def initialize
|
73
|
-
@matcher = "{spec/javascripts,app/assets}/**/*_spec.{js,js.coffee,coffee}"
|
74
|
-
@helper = "spec_helper"
|
75
|
-
@javascripts = ["jasmine/1.3.1", "teaspoon-jasmine"]
|
76
|
-
@stylesheets = ["teaspoon"]
|
77
|
-
|
78
|
-
@boot_partial = "boot"
|
79
|
-
@body_partial = "body"
|
80
|
-
|
81
|
-
@no_coverage = [%r{/lib/ruby/gems/}, %r{/vendor/assets/}, %r{/support/}, %r{/(.+)_helper.}]
|
82
|
-
|
83
|
-
<<<<<<< Updated upstream
|
84
|
-
@hooks = Hash.new { |h, k| h[k] = [] }
|
85
|
-
=======
|
86
|
-
@hooks = Hash.new{ |h, k| h[k] = [] }
|
87
|
-
@expand_assets = true
|
88
|
-
>>>>>>> Stashed changes
|
89
|
-
|
90
|
-
default = Teaspoon.configuration.suite_configs["default"]
|
91
|
-
instance_eval(&default[:block]) if default
|
92
|
-
yield self if block_given?
|
93
|
-
end
|
94
|
-
|
95
|
-
def use_framework(name, version = nil)
|
96
|
-
name = name.to_sym
|
97
|
-
version ||= FRAMEWORKS[name].last if FRAMEWORKS[name]
|
98
|
-
unless FRAMEWORKS[name] && FRAMEWORKS[name].include?(version)
|
99
|
-
message = "Unknown framework \"#{name}\""
|
100
|
-
if FRAMEWORKS[name] && version
|
101
|
-
message += " with version #{version} -- available versions #{FRAMEWORKS[name].join(', ')}"
|
102
|
-
end
|
103
|
-
raise Teaspoon::UnknownFramework, message
|
104
|
-
end
|
105
|
-
|
106
|
-
@javascripts = [[name, version].join("/"), "teaspoon-#{name}"]
|
107
|
-
case name.to_sym
|
108
|
-
when :qunit
|
109
|
-
@matcher = "{test/javascripts,app/assets}/**/*_test.{js,js.coffee,coffee}"
|
110
|
-
@helper = "test_helper"
|
111
|
-
end
|
112
|
-
end
|
113
|
-
alias_method :use_framework=, :use_framework
|
114
|
-
|
115
|
-
def hook(group = :default, &block)
|
116
|
-
@hooks[group.to_s] << block
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
# coverage configurations
|
121
|
-
|
122
|
-
cattr_accessor :coverage_configs
|
123
|
-
@@coverage_configs = { "default" => { block: proc {} } }
|
124
|
-
|
125
|
-
def self.coverage(name = :default, &block)
|
126
|
-
@@coverage_configs[name.to_s] = { block: block, instance: Coverage.new(&block) }
|
127
|
-
end
|
128
|
-
|
129
|
-
class Coverage
|
130
|
-
attr_accessor :reports, :output_path,
|
131
|
-
:statements, :functions, :branches, :lines
|
132
|
-
|
133
|
-
def initialize
|
134
|
-
@reports = ["text-summary"]
|
135
|
-
@output_path = "coverage"
|
136
|
-
|
137
|
-
@statements = nil
|
138
|
-
@functions = nil
|
139
|
-
@branches = nil
|
140
|
-
@lines = nil
|
141
|
-
|
142
|
-
default = Teaspoon.configuration.coverage_configs["default"]
|
143
|
-
instance_eval(&default[:block]) if default
|
144
|
-
yield self if block_given?
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
# custom getters / setters
|
149
|
-
|
150
|
-
def self.root=(path)
|
151
|
-
@@root = Pathname.new(path.to_s) if path.present?
|
152
|
-
end
|
153
|
-
|
154
|
-
def self.formatters
|
155
|
-
return ["dot"] if @@formatters.blank?
|
156
|
-
return @@formatters if @@formatters.is_a?(Array)
|
157
|
-
@@formatters.to_s.split(/,\s?/)
|
158
|
-
end
|
159
|
-
|
160
|
-
# override from env or options
|
161
|
-
|
162
|
-
def self.override_from_options(options)
|
163
|
-
options.each { |k, v| override(k, v) }
|
164
|
-
end
|
165
|
-
|
166
|
-
def self.override_from_env(env)
|
167
|
-
ENV_OVERRIDES[:boolean].each { |o| override(o, env[o] == "true") if env[o].present? }
|
168
|
-
ENV_OVERRIDES[:integer].each { |o| override(o, env[o].to_i) if env[o].present? }
|
169
|
-
ENV_OVERRIDES[:string].each { |o| override(o, env[o]) if env[o].present? }
|
170
|
-
end
|
171
|
-
|
172
|
-
def self.override(config, value)
|
173
|
-
setter = "#{config.to_s.downcase}="
|
174
|
-
send(setter, value) if respond_to?(setter)
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
mattr_accessor :configured, :configuration
|
179
|
-
@@configured = false
|
180
|
-
@@configuration = Configuration
|
181
|
-
|
182
|
-
def self.configure
|
183
|
-
yield @@configuration
|
184
|
-
@@configured = true
|
185
|
-
@@configuration.override_from_env(ENV)
|
186
|
-
end
|
187
|
-
end
|