teaspoon 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/MIT.LICENSE +1 -1
- data/README.md +46 -377
- data/app/assets/javascripts/teaspoon-jasmine.js +200 -194
- data/app/assets/javascripts/teaspoon-mocha.js +183 -185
- data/app/assets/javascripts/teaspoon-qunit.js +201 -193
- data/app/assets/javascripts/teaspoon-teaspoon.js +10 -10
- data/app/assets/javascripts/teaspoon/base/fixture.coffee +0 -1
- data/app/assets/javascripts/teaspoon/base/hook.coffee +7 -6
- data/app/assets/javascripts/teaspoon/qunit.coffee +10 -0
- data/app/controllers/teaspoon/suite_controller.rb +3 -4
- data/app/views/teaspoon/suite/_boot.html.erb +1 -1
- data/app/views/teaspoon/suite/_boot_require_js.html.erb +1 -0
- data/bin/teaspoon +1 -1
- data/config/routes.rb +4 -14
- data/lib/generators/teaspoon/install/install_generator.rb +22 -11
- data/lib/generators/teaspoon/install/templates/jasmine/{env_comments.rb → env_comments.rb.tt} +10 -5
- data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.coffee +5 -5
- data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.js +5 -5
- data/lib/generators/teaspoon/install/templates/mocha/{env_comments.rb → env_comments.rb.tt} +10 -5
- data/lib/generators/teaspoon/install/templates/mocha/spec_helper.coffee +6 -5
- data/lib/generators/teaspoon/install/templates/mocha/spec_helper.js +6 -5
- data/lib/generators/teaspoon/install/templates/qunit/{env_comments.rb → env_comments.rb.tt} +10 -5
- data/lib/generators/teaspoon/install/templates/qunit/test_helper.coffee +5 -5
- data/lib/generators/teaspoon/install/templates/qunit/test_helper.js +5 -5
- data/lib/tasks/teaspoon.rake +1 -1
- data/lib/teaspoon/command_line.rb +37 -40
- data/lib/teaspoon/configuration.rb +27 -30
- data/lib/teaspoon/configuration.rb.orig +187 -0
- data/lib/teaspoon/console.rb +31 -17
- data/lib/teaspoon/coverage.rb +2 -3
- data/lib/teaspoon/deprecated.rb +13 -8
- data/lib/teaspoon/drivers/base.rb +2 -2
- data/lib/teaspoon/drivers/capybara_webkit_driver.rb +33 -0
- data/lib/teaspoon/drivers/phantomjs/runner.js +2 -2
- data/lib/teaspoon/drivers/phantomjs_driver.rb +13 -4
- data/lib/teaspoon/drivers/selenium_driver.rb +3 -5
- data/lib/teaspoon/engine.rb +33 -5
- data/lib/teaspoon/environment.rb +2 -4
- data/lib/teaspoon/exceptions.rb +8 -5
- data/lib/teaspoon/formatters/base.rb +39 -27
- data/lib/teaspoon/formatters/clean_formatter.rb +0 -1
- data/lib/teaspoon/formatters/description.rb +36 -0
- data/lib/teaspoon/formatters/documentation_formatter.rb +2 -2
- data/lib/teaspoon/formatters/json_formatter.rb +1 -2
- data/lib/teaspoon/formatters/junit_formatter.rb +20 -20
- data/lib/teaspoon/formatters/modules/report_module.rb +4 -4
- data/lib/teaspoon/formatters/pride_formatter.rb +0 -1
- data/lib/teaspoon/formatters/rspec_html_formatter.rb +463 -0
- data/lib/teaspoon/formatters/snowday_formatter.rb +0 -1
- data/lib/teaspoon/formatters/swayze_or_oprah_formatter.rb +5 -4
- data/lib/teaspoon/formatters/tap_formatter.rb +2 -3
- data/lib/teaspoon/formatters/tap_y_formatter.rb +20 -21
- data/lib/teaspoon/formatters/teamcity_formatter.rb +4 -5
- data/lib/teaspoon/instrumentation.rb +7 -7
- data/lib/teaspoon/result.rb +1 -3
- data/lib/teaspoon/runner.rb +1 -2
- data/lib/teaspoon/server.rb +2 -1
- data/lib/teaspoon/suite.rb +20 -17
- data/lib/teaspoon/utility.rb +1 -3
- data/lib/teaspoon/version.rb +1 -1
- data/spec/dummy/config/application.rb +14 -18
- data/spec/dummy/config/boot.rb +2 -6
- data/spec/dummy/config/environment.rb +3 -3
- data/spec/dummy/config/environments/development.rb +27 -13
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +26 -13
- data/spec/dummy/config/routes.rb +1 -1
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/features/console_reporter_spec.rb +3 -8
- data/spec/features/hooks_spec.rb +17 -4
- data/spec/features/html_reporter_spec.rb +12 -1
- data/spec/features/install_generator_spec.rb +2 -3
- data/spec/features/instrumentation_spec.rb +11 -11
- data/spec/javascripts/teaspoon/base/teaspoon_spec.coffee +14 -1
- data/spec/spec_helper.rb +7 -4
- data/spec/teaspoon/command_line_spec.rb +19 -28
- data/spec/teaspoon/configuration_spec.rb +22 -14
- data/spec/teaspoon/console_spec.rb +79 -63
- data/spec/teaspoon/coverage_spec.rb +23 -23
- data/spec/teaspoon/drivers/capybara_webkit_driver_spec.rb +39 -0
- data/spec/teaspoon/drivers/phantomjs_driver_spec.rb +10 -5
- data/spec/teaspoon/drivers/selenium_driver_spec.rb +10 -10
- data/spec/teaspoon/environment_spec.rb +28 -20
- data/spec/teaspoon/exceptions_spec.rb +4 -4
- data/spec/teaspoon/exporter_spec.rb +28 -28
- data/spec/teaspoon/formatters/base_spec.rb +29 -29
- data/spec/teaspoon/formatters/clean_formatter_spec.rb +1 -1
- data/spec/teaspoon/formatters/documentation_formatter_spec.rb +1 -1
- data/spec/teaspoon/formatters/dot_formatter_spec.rb +1 -1
- data/spec/teaspoon/formatters/json_formatter_spec.rb +7 -7
- data/spec/teaspoon/formatters/junit_formatter_spec.rb +10 -10
- data/spec/teaspoon/formatters/pride_formatter_spec.rb +1 -1
- data/spec/teaspoon/formatters/rspec_html_formatter_spec.rb +107 -0
- data/spec/teaspoon/formatters/snowday_formatter_spec.rb +1 -1
- data/spec/teaspoon/formatters/tap_formatter_spec.rb +1 -1
- data/spec/teaspoon/formatters/tap_y_formatter_spec.rb +1 -1
- data/spec/teaspoon/formatters/teamcity_formatter_spec.rb +27 -27
- data/spec/teaspoon/instrumentation_spec.rb +35 -29
- data/spec/teaspoon/result_spec.rb +40 -36
- data/spec/teaspoon/runner_spec.rb +23 -20
- data/spec/teaspoon/server_spec.rb +19 -16
- data/spec/teaspoon/suite_spec.rb +23 -9
- data/spec/teaspoon_env.rb +7 -12
- data/test/javascripts/teaspoon/qunit/models_test.coffee +6 -2
- data/vendor/assets/javascripts/support/chai-1.10.0.js +4800 -0
- data/vendor/assets/javascripts/support/chai-jq-0.0.7.js +524 -0
- data/vendor/assets/javascripts/support/chai.js +4435 -4349
- metadata +57 -54
- data/app/assets/javascripts/teaspoon-angular.js +0 -1299
- data/app/assets/javascripts/teaspoon/angular.coffee +0 -55
- data/app/assets/javascripts/teaspoon/angular/reporters/console.coffee +0 -11
- data/app/assets/javascripts/teaspoon/angular/reporters/html.coffee +0 -21
- data/spec/javascripts/angular_helper.coffee +0 -5
- data/spec/javascripts/teaspoon/angular/models_aspec.coffee +0 -95
- data/spec/javascripts/teaspoon/angular/reporters/html_aspec.coffee +0 -9
- data/vendor/assets/javascripts/angular/1.0.5.js +0 -26195
- data/vendor/assets/javascripts/angular/MIT-LICENSE +0 -22
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
module Teaspoon
|
|
2
2
|
module Formatters
|
|
3
3
|
class SwayzeOrOprahFormatter < Base
|
|
4
|
-
|
|
5
4
|
protected
|
|
6
5
|
|
|
7
|
-
def log_result(
|
|
6
|
+
def log_result(_result)
|
|
8
7
|
return log_str("\nNo quote for you.") if failures.size > 0
|
|
9
8
|
names, quote = random_quote
|
|
10
9
|
log_line("\n#{quote.inspect} -- Oprah Winfrey or Patrick Swayze?")
|
|
@@ -13,7 +12,7 @@ module Teaspoon
|
|
|
13
12
|
log_line("\nYou got it right!\n")
|
|
14
13
|
else
|
|
15
14
|
log_line("\nWrong, too bad!\n")
|
|
16
|
-
raise the roof
|
|
15
|
+
raise the roof, YO && "Let's get busy"
|
|
17
16
|
end
|
|
18
17
|
end
|
|
19
18
|
|
|
@@ -92,8 +91,10 @@ module Teaspoon
|
|
|
92
91
|
[set[:author], set[:quotes][rand(set[:quotes].size)]]
|
|
93
92
|
end
|
|
94
93
|
|
|
95
|
-
def the(*
|
|
94
|
+
def the(*_); Exception.new("poorly answered question"); end
|
|
95
|
+
|
|
96
96
|
def roof; 0; end
|
|
97
|
+
|
|
97
98
|
YO = 0
|
|
98
99
|
end
|
|
99
100
|
end
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
module Teaspoon
|
|
2
2
|
module Formatters
|
|
3
3
|
class TapFormatter < Base
|
|
4
|
-
|
|
5
4
|
protected
|
|
6
5
|
|
|
7
|
-
def log_runner(
|
|
6
|
+
def log_runner(_result)
|
|
8
7
|
log_line("1..#{@total_count}")
|
|
9
8
|
end
|
|
10
9
|
|
|
@@ -22,7 +21,7 @@ module Teaspoon
|
|
|
22
21
|
end
|
|
23
22
|
|
|
24
23
|
def log_console(message)
|
|
25
|
-
log_line("# #{message.gsub(/\n$/,
|
|
24
|
+
log_line("# #{message.gsub(/\n$/, '')}")
|
|
26
25
|
end
|
|
27
26
|
|
|
28
27
|
def log_coverage(message)
|
|
@@ -3,34 +3,33 @@ require "yaml"
|
|
|
3
3
|
module Teaspoon
|
|
4
4
|
module Formatters
|
|
5
5
|
class TapYFormatter < Base
|
|
6
|
-
|
|
7
6
|
protected
|
|
8
7
|
|
|
9
8
|
def log_runner(result)
|
|
10
|
-
log "type"
|
|
9
|
+
log "type" => "suite",
|
|
11
10
|
"start" => result.start,
|
|
12
11
|
"count" => result.total,
|
|
13
|
-
"seed"
|
|
14
|
-
"rev"
|
|
12
|
+
"seed" => 0,
|
|
13
|
+
"rev" => 4
|
|
15
14
|
end
|
|
16
15
|
|
|
17
16
|
def log_suite(result)
|
|
18
|
-
log "type"
|
|
17
|
+
log "type" => "case",
|
|
19
18
|
"label" => result.label,
|
|
20
19
|
"level" => result.level
|
|
21
20
|
end
|
|
22
21
|
|
|
23
22
|
def log_passing_spec(result)
|
|
24
|
-
log "type"
|
|
23
|
+
log "type" => "test",
|
|
25
24
|
"status" => "pass",
|
|
26
|
-
"label"
|
|
25
|
+
"label" => result.label,
|
|
27
26
|
"stdout" => @stdout
|
|
28
27
|
end
|
|
29
28
|
|
|
30
29
|
def log_pending_spec(result)
|
|
31
|
-
log "type"
|
|
30
|
+
log "type" => "test",
|
|
32
31
|
"status" => "pending",
|
|
33
|
-
"label"
|
|
32
|
+
"label" => result.label,
|
|
34
33
|
"stdout" => @stdout,
|
|
35
34
|
"exception" => {
|
|
36
35
|
"message" => result.message
|
|
@@ -38,18 +37,18 @@ module Teaspoon
|
|
|
38
37
|
end
|
|
39
38
|
|
|
40
39
|
def log_failing_spec(result)
|
|
41
|
-
log "type"
|
|
40
|
+
log "type" => "test",
|
|
42
41
|
"status" => "fail",
|
|
43
|
-
"label"
|
|
42
|
+
"label" => result.label,
|
|
44
43
|
"stdout" => @stdout,
|
|
45
44
|
"exception" => {
|
|
46
|
-
"message"
|
|
45
|
+
"message" => result.message,
|
|
47
46
|
"backtrace" => ["#{result.link}#:0"],
|
|
48
|
-
"file"
|
|
49
|
-
"line"
|
|
50
|
-
"source"
|
|
51
|
-
"snippet"
|
|
52
|
-
"class"
|
|
47
|
+
"file" => "unknown",
|
|
48
|
+
"line" => "unknown",
|
|
49
|
+
"source" => "unknown",
|
|
50
|
+
"snippet" => { "0" => result.link },
|
|
51
|
+
"class" => "Unknown"
|
|
53
52
|
}
|
|
54
53
|
end
|
|
55
54
|
|
|
@@ -58,11 +57,11 @@ module Teaspoon
|
|
|
58
57
|
"time" => result.elapsed,
|
|
59
58
|
"counts" => {
|
|
60
59
|
"total" => @run_count,
|
|
61
|
-
"pass"
|
|
62
|
-
"fail"
|
|
60
|
+
"pass" => @passes.size,
|
|
61
|
+
"fail" => @failures.size,
|
|
63
62
|
"error" => @errors.size,
|
|
64
|
-
"omit"
|
|
65
|
-
"todo"
|
|
63
|
+
"omit" => 0,
|
|
64
|
+
"todo" => @pendings.size
|
|
66
65
|
}
|
|
67
66
|
end
|
|
68
67
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
module Teaspoon
|
|
2
2
|
module Formatters
|
|
3
3
|
class TeamcityFormatter < Base
|
|
4
|
-
|
|
5
4
|
def initialize(*args)
|
|
6
|
-
log("enteredTheMatrix timestamp='#{Time.now.to_json.gsub('"',
|
|
5
|
+
log("enteredTheMatrix timestamp='#{Time.now.to_json.gsub('"', '')}'")
|
|
7
6
|
super
|
|
8
7
|
end
|
|
9
8
|
|
|
@@ -58,7 +57,7 @@ module Teaspoon
|
|
|
58
57
|
|
|
59
58
|
def log_complete(failure_count)
|
|
60
59
|
log_line("\nFinished in #{@result.elapsed} seconds")
|
|
61
|
-
stats = "#{pluralize(
|
|
60
|
+
stats = "#{pluralize('example', run_count)}, #{pluralize('failure', failure_count)}"
|
|
62
61
|
stats << ", #{pendings.size} pending" if pendings.size > 0
|
|
63
62
|
log_line(stats)
|
|
64
63
|
log_line if failure_count > 0
|
|
@@ -70,7 +69,7 @@ module Teaspoon
|
|
|
70
69
|
log("testSuiteFinished name='#{escape(@last_suite.label)}'") if @last_suite
|
|
71
70
|
end
|
|
72
71
|
|
|
73
|
-
def log_teamcity_spec(opts, &
|
|
72
|
+
def log_teamcity_spec(opts, &_block)
|
|
74
73
|
log("#{opts[:type]} name='#{opts[:desc]}' captureStandardOutput='true'")
|
|
75
74
|
log_line(@stdout.gsub(/\n$/, "")) unless @stdout.blank?
|
|
76
75
|
yield if block_given?
|
|
@@ -87,7 +86,7 @@ module Teaspoon
|
|
|
87
86
|
end
|
|
88
87
|
|
|
89
88
|
def escape_trace(trace)
|
|
90
|
-
lines = trace.map { |t| ["#{t[
|
|
89
|
+
lines = trace.map { |t| ["#{t['file']}:#{t['line']}", t["function"]].compact.join(" ") }
|
|
91
90
|
escape(lines.join("\n"))
|
|
92
91
|
end
|
|
93
92
|
end
|
|
@@ -10,11 +10,11 @@ module Teaspoon
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def self.add?(response, env)
|
|
13
|
-
executable &&
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
executable && # we have an executable
|
|
14
|
+
env["QUERY_STRING"].to_s =~ /instrument=(1|true)/ && # the instrument param was provided
|
|
15
|
+
response[0] == 200 && # the status is 200 (304 maybe?)
|
|
16
|
+
response[1]["Content-Type"].to_s == "application/javascript" && # the format is something that we care about
|
|
17
|
+
response[2].respond_to?(:source) # it looks like an asset
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def self.executable
|
|
@@ -45,7 +45,7 @@ module Teaspoon
|
|
|
45
45
|
source_path = asset.pathname.to_s
|
|
46
46
|
Dir.mktmpdir do |temp_path|
|
|
47
47
|
input_path = File.join(temp_path, File.basename(source_path)).sub(/\.js.+/, ".js")
|
|
48
|
-
File.open(input_path,
|
|
48
|
+
File.open(input_path, "w") { |f| f.write(asset.source) }
|
|
49
49
|
instrument(input_path).gsub(input_path, source_path)
|
|
50
50
|
end
|
|
51
51
|
end
|
|
@@ -53,7 +53,7 @@ module Teaspoon
|
|
|
53
53
|
def instrument(input)
|
|
54
54
|
result = %x{#{self.class.executable} instrument --embed-source #{input.shellescape}}
|
|
55
55
|
return result if $?.exitstatus == 0
|
|
56
|
-
raise Teaspoon::DependencyFailure, "Could not generate instrumentation for #{File.basename(input)}"
|
|
56
|
+
raise Teaspoon::DependencyFailure, "Could not generate instrumentation for #{File.basename(input)}."
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
|
data/lib/teaspoon/result.rb
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
module Teaspoon
|
|
2
|
-
|
|
3
2
|
RESULT_ATTRS = [
|
|
4
3
|
:type,
|
|
5
4
|
:suite,
|
|
@@ -18,9 +17,8 @@ module Teaspoon
|
|
|
18
17
|
]
|
|
19
18
|
|
|
20
19
|
class Result < Struct.new(*RESULT_ATTRS)
|
|
21
|
-
|
|
22
20
|
def self.build_from_json(json)
|
|
23
|
-
new(*RESULT_ATTRS.map{ |attr| json[attr.to_s] })
|
|
21
|
+
new(*RESULT_ATTRS.map { |attr| json[attr.to_s] })
|
|
24
22
|
end
|
|
25
23
|
|
|
26
24
|
def description
|
data/lib/teaspoon/runner.rb
CHANGED
|
@@ -3,13 +3,12 @@ require "teaspoon/result"
|
|
|
3
3
|
|
|
4
4
|
module Teaspoon
|
|
5
5
|
class Runner
|
|
6
|
-
|
|
7
6
|
attr_reader :failure_count
|
|
8
7
|
|
|
9
8
|
def initialize(suite_name = :default)
|
|
10
9
|
@suite_name = suite_name
|
|
11
10
|
@failure_count = 0
|
|
12
|
-
@formatters = Teaspoon.configuration.formatters.map{ |f| resolve_formatter(f) }
|
|
11
|
+
@formatters = Teaspoon.configuration.formatters.map { |f| resolve_formatter(f) }
|
|
13
12
|
end
|
|
14
13
|
|
|
15
14
|
def process(line)
|
data/lib/teaspoon/server.rb
CHANGED
|
@@ -4,7 +4,6 @@ require "webrick"
|
|
|
4
4
|
|
|
5
5
|
module Teaspoon
|
|
6
6
|
class Server
|
|
7
|
-
|
|
8
7
|
attr_accessor :port
|
|
9
8
|
|
|
10
9
|
def initialize
|
|
@@ -12,6 +11,8 @@ module Teaspoon
|
|
|
12
11
|
end
|
|
13
12
|
|
|
14
13
|
def start
|
|
14
|
+
return if responsive?
|
|
15
|
+
|
|
15
16
|
thread = Thread.new do
|
|
16
17
|
disable_logging
|
|
17
18
|
server = Rack::Server.new(rack_options)
|
data/lib/teaspoon/suite.rb
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
module Teaspoon
|
|
2
2
|
class Suite
|
|
3
|
-
|
|
4
3
|
def self.all
|
|
5
4
|
@all ||= Teaspoon.configuration.suite_configs.keys.map { |suite| Teaspoon::Suite.new(suite: suite) }
|
|
6
5
|
end
|
|
@@ -8,14 +7,14 @@ module Teaspoon
|
|
|
8
7
|
def self.resolve_spec_for(file)
|
|
9
8
|
all.each do |suite|
|
|
10
9
|
spec = suite.include_spec_for?(file)
|
|
11
|
-
return {suite: suite.name, path: spec} if spec
|
|
10
|
+
return { suite: suite.name, path: spec } if spec
|
|
12
11
|
end
|
|
13
12
|
false
|
|
14
13
|
end
|
|
15
14
|
|
|
16
15
|
attr_accessor :config, :name
|
|
17
|
-
delegate
|
|
18
|
-
|
|
16
|
+
delegate :helper, :stylesheets, :javascripts, :boot_partial, :body_partial, :no_coverage, :hooks,
|
|
17
|
+
to: :config
|
|
19
18
|
|
|
20
19
|
def initialize(options = {})
|
|
21
20
|
@options = options
|
|
@@ -25,7 +24,7 @@ module Teaspoon
|
|
|
25
24
|
end
|
|
26
25
|
|
|
27
26
|
def spec_files
|
|
28
|
-
glob.map { |file| {path: file, name: asset_from_file(file)} }
|
|
27
|
+
glob.map { |file| { path: file, name: asset_from_file(file) } }
|
|
29
28
|
end
|
|
30
29
|
|
|
31
30
|
def spec_assets(include_helper = true)
|
|
@@ -38,9 +37,20 @@ module Teaspoon
|
|
|
38
37
|
glob.include?(file)
|
|
39
38
|
end
|
|
40
39
|
|
|
40
|
+
def ignored_file?(file)
|
|
41
|
+
for ignored in no_coverage
|
|
42
|
+
if ignored.is_a?(String)
|
|
43
|
+
return true if File.basename(file) == ignored
|
|
44
|
+
elsif ignored.is_a?(Regexp)
|
|
45
|
+
return true if file =~ ignored
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
false
|
|
49
|
+
end
|
|
50
|
+
|
|
41
51
|
def include_spec_for?(file)
|
|
42
52
|
return file if glob.include?(file)
|
|
43
|
-
paths = glob.select { |path| path.include?(file)
|
|
53
|
+
paths = glob.select { |path| path.include?(file) }
|
|
44
54
|
return paths unless paths.empty?
|
|
45
55
|
false
|
|
46
56
|
end
|
|
@@ -54,9 +64,9 @@ module Teaspoon
|
|
|
54
64
|
end
|
|
55
65
|
|
|
56
66
|
def asset_tree(sources)
|
|
57
|
-
sources.
|
|
67
|
+
sources.map do |source|
|
|
58
68
|
asset = @env.find_asset(source)
|
|
59
|
-
if asset && asset.respond_to?(:logical_path)
|
|
69
|
+
if asset && asset.respond_to?(:logical_path) && config.expand_assets
|
|
60
70
|
asset.to_a.map { |a| asset_url(a) }
|
|
61
71
|
else
|
|
62
72
|
source unless source.blank?
|
|
@@ -72,14 +82,7 @@ module Teaspoon
|
|
|
72
82
|
|
|
73
83
|
def instrument_file?(file)
|
|
74
84
|
return false unless @options[:coverage] || Teaspoon.configuration.use_coverage
|
|
75
|
-
return false if include_spec?(file)
|
|
76
|
-
for ignored in no_coverage
|
|
77
|
-
if ignored.is_a?(String)
|
|
78
|
-
return false if File.basename(file) == ignored
|
|
79
|
-
elsif ignored.is_a?(Regexp)
|
|
80
|
-
return false if file =~ ignored
|
|
81
|
-
end
|
|
82
|
-
end
|
|
85
|
+
return false if include_spec?(file) || ignored_file?(file)
|
|
83
86
|
true
|
|
84
87
|
end
|
|
85
88
|
|
|
@@ -94,7 +97,7 @@ module Teaspoon
|
|
|
94
97
|
end
|
|
95
98
|
|
|
96
99
|
def normalize_js_extension(filename)
|
|
97
|
-
filename.gsub(
|
|
100
|
+
filename.gsub(".erb", "").gsub(/(\.js\.coffee|\.coffee)$/, ".js")
|
|
98
101
|
end
|
|
99
102
|
|
|
100
103
|
def glob
|
data/lib/teaspoon/utility.rb
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
module Teaspoon
|
|
2
2
|
module Utility
|
|
3
|
-
|
|
4
3
|
# Cross-platform way of finding an executable in the $PATH.
|
|
5
4
|
# http://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
|
|
6
|
-
#
|
|
7
5
|
def which(cmd)
|
|
8
6
|
exts = ENV["PATHEXT"] ? ENV["PATHEXT"].split(";") : [""]
|
|
9
7
|
|
|
10
8
|
ENV["PATH"].split(File::PATH_SEPARATOR).each do |path|
|
|
11
9
|
exts.each do |ext|
|
|
12
10
|
exe = "#{path}/#{cmd}#{ext}"
|
|
13
|
-
return exe if File.executable?(exe)
|
|
11
|
+
return exe if File.file?(exe) && File.executable?(exe)
|
|
14
12
|
end
|
|
15
13
|
end
|
|
16
14
|
|
data/lib/teaspoon/version.rb
CHANGED
|
@@ -3,30 +3,26 @@ require File.expand_path('../boot', __FILE__)
|
|
|
3
3
|
require "action_controller/railtie"
|
|
4
4
|
require "sprockets/railtie"
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# Require the gems listed in Gemfile, including any gems
|
|
7
|
+
# you've limited to :test, :development, or :production.
|
|
8
|
+
Bundler.require(*Rails.groups)
|
|
7
9
|
|
|
8
10
|
module Dummy
|
|
9
11
|
class Application < Rails::Application
|
|
10
|
-
#
|
|
11
|
-
|
|
12
|
+
# Settings in config/environments/* take precedence over those specified here.
|
|
13
|
+
# Application configuration should go into files in config/initializers
|
|
14
|
+
# -- all .rb files in that directory are automatically loaded.
|
|
12
15
|
|
|
13
|
-
#
|
|
14
|
-
|
|
16
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
|
17
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
|
18
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
|
15
19
|
|
|
16
|
-
#
|
|
17
|
-
config.
|
|
18
|
-
|
|
19
|
-
# Moved from initializers.
|
|
20
|
-
config.session_store :cookie_store, key: '_dummy_session'
|
|
21
|
-
config.secret_token = 'bc510a13d2fb96575782e90e9f2f64afc0ba4e63e5869b6139613686f104d4d3dd92ee696468de5bcbbb74daedb702d3da97554efbc6792abe75091b9df0a2ab'
|
|
22
|
-
config.secret_key_base = 'bc510a13d2fb96575782e90e9f2f64afc0ba4e63e5869b6139613686f104d4d3dd92ee696468de5bcbbb74daedb702d3da97554efbc6792abe75091b9df0a2ab'
|
|
23
|
-
|
|
24
|
-
# Enable the asset pipeline
|
|
25
|
-
config.assets.enabled = true
|
|
26
|
-
|
|
27
|
-
# Version of your assets, change this if you want to expire all your assets
|
|
28
|
-
config.assets.version = '1.0'
|
|
20
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
|
21
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
|
22
|
+
# config.i18n.default_locale = :de
|
|
29
23
|
|
|
24
|
+
# Change our relative root url to show that if relative paths are setup properly, teaspoon will
|
|
25
|
+
# continue to work and load the proper urls.
|
|
30
26
|
config.relative_url_root = "/relative"
|
|
31
27
|
config.assets.prefix = "/relative/assets" # this must be set for any asset paths to be correct!
|
|
32
28
|
end
|
data/spec/dummy/config/boot.rb
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
|
2
2
|
|
|
3
|
-
# Set up gems listed in the Gemfile.
|
|
4
|
-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../../Gemfile", __FILE__)
|
|
5
|
-
|
|
6
|
-
require "bundler/setup" if File.exists?(ENV["BUNDLE_GEMFILE"])
|
|
7
|
-
require "rubygems"
|
|
3
|
+
require 'bundler/setup' # Set up gems listed in the Gemfile.
|