teaspoon 0.7.9 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +382 -260
- data/app/assets/javascripts/teaspoon-angular.js +108 -26241
- data/app/assets/javascripts/teaspoon-jasmine.js +103 -2642
- data/app/assets/javascripts/teaspoon-mocha.js +109 -5416
- data/app/assets/javascripts/teaspoon-qunit.js +107 -2255
- data/app/assets/javascripts/teaspoon-teaspoon.js +0 -1
- data/app/assets/javascripts/teaspoon/angular.coffee +3 -1
- data/app/assets/javascripts/teaspoon/base/hook.coffee +21 -0
- data/app/assets/javascripts/teaspoon/base/reporters/html.coffee +26 -14
- data/app/assets/javascripts/teaspoon/base/reporters/html/progress_view.coffee +1 -1
- data/app/assets/javascripts/teaspoon/base/reporters/html/template.coffee +3 -3
- data/app/assets/javascripts/teaspoon/base/teaspoon.coffee +10 -1
- data/app/assets/javascripts/teaspoon/jasmine.coffee +3 -1
- data/app/assets/javascripts/teaspoon/mocha.coffee +3 -1
- data/app/assets/javascripts/teaspoon/mocha/reporters/html.coffee +1 -1
- data/app/assets/javascripts/teaspoon/qunit.coffee +3 -1
- data/app/assets/javascripts/teaspoon/qunit/reporters/html.coffee +1 -1
- data/app/assets/javascripts/teaspoon/teaspoon.coffee +0 -1
- data/app/assets/stylesheets/teaspoon.css +12 -8
- data/app/controllers/teaspoon/suite_controller.rb +32 -0
- data/app/views/teaspoon/suite/_body.html.erb +0 -0
- data/app/views/teaspoon/suite/_boot.html.erb +4 -0
- data/app/views/teaspoon/suite/_boot_require_js.html.erb +19 -0
- data/app/views/teaspoon/{spec/suites.html.erb → suite/index.html.erb} +6 -7
- data/app/views/teaspoon/suite/show.html.erb +19 -0
- data/bin/teaspoon +1 -1
- data/config/routes.rb +14 -4
- data/lib/generators/teaspoon/install/POST_INSTALL +2 -2
- data/lib/generators/teaspoon/install/install_generator.rb +22 -11
- data/lib/generators/teaspoon/install/templates/_body.html.erb +0 -0
- data/lib/generators/teaspoon/install/templates/_boot.html.erb +4 -0
- data/lib/generators/teaspoon/install/templates/jasmine/env.rb +11 -0
- data/lib/generators/teaspoon/install/templates/jasmine/env_comments.rb +182 -0
- data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.coffee +8 -6
- data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.js +8 -7
- data/lib/generators/teaspoon/install/templates/mocha/env.rb +11 -0
- data/lib/generators/teaspoon/install/templates/mocha/env_comments.rb +182 -0
- data/lib/generators/teaspoon/install/templates/mocha/spec_helper.coffee +13 -13
- data/lib/generators/teaspoon/install/templates/mocha/spec_helper.js +13 -13
- data/lib/generators/teaspoon/install/templates/qunit/env.rb +11 -0
- data/lib/generators/teaspoon/install/templates/qunit/env_comments.rb +182 -0
- data/lib/generators/teaspoon/install/templates/qunit/test_helper.coffee +6 -5
- data/lib/generators/teaspoon/install/templates/qunit/test_helper.js +6 -5
- data/lib/tasks/teaspoon.rake +9 -2
- data/lib/teaspoon.rb +4 -6
- data/lib/teaspoon/command_line.rb +116 -134
- data/lib/teaspoon/configuration.rb +144 -66
- data/lib/teaspoon/console.rb +70 -37
- data/lib/teaspoon/coverage.rb +42 -15
- data/lib/teaspoon/deprecated.rb +65 -0
- data/lib/teaspoon/drivers/base.rb +10 -0
- data/lib/teaspoon/drivers/phantomjs/runner.js +9 -11
- data/lib/teaspoon/drivers/phantomjs_driver.rb +21 -21
- data/lib/teaspoon/drivers/selenium_driver.rb +32 -13
- data/lib/teaspoon/engine.rb +32 -12
- data/lib/teaspoon/environment.rb +16 -12
- data/lib/teaspoon/exceptions.rb +41 -5
- data/lib/teaspoon/exporter.rb +52 -0
- data/lib/teaspoon/formatters/base.rb +171 -0
- data/lib/teaspoon/formatters/clean_formatter.rb +2 -4
- data/lib/teaspoon/formatters/documentation_formatter.rb +60 -0
- data/lib/teaspoon/formatters/dot_formatter.rb +12 -90
- data/lib/teaspoon/formatters/json_formatter.rb +36 -0
- data/lib/teaspoon/formatters/junit_formatter.rb +51 -32
- data/lib/teaspoon/formatters/modules/report_module.rb +76 -0
- data/lib/teaspoon/formatters/pride_formatter.rb +23 -27
- data/lib/teaspoon/formatters/snowday_formatter.rb +7 -11
- data/lib/teaspoon/formatters/swayze_or_oprah_formatter.rb +88 -64
- data/lib/teaspoon/formatters/tap_formatter.rb +18 -27
- data/lib/teaspoon/formatters/tap_y_formatter.rb +35 -45
- data/lib/teaspoon/formatters/teamcity_formatter.rb +69 -31
- data/lib/teaspoon/instrumentation.rb +33 -33
- data/lib/teaspoon/result.rb +2 -1
- data/lib/teaspoon/runner.rb +40 -28
- data/lib/teaspoon/server.rb +23 -25
- data/lib/teaspoon/suite.rb +52 -72
- data/lib/teaspoon/utility.rb +3 -14
- data/lib/teaspoon/version.rb +1 -1
- data/spec/dummy/app/assets/javascripts/integration/integration_spec.coffee +3 -0
- data/spec/dummy/app/assets/javascripts/integration/spec_helper.coffee +2 -0
- data/spec/dummy/config/application.rb +3 -0
- data/spec/features/console_reporter_spec.rb +48 -18
- data/spec/features/hooks_spec.rb +23 -41
- data/spec/features/html_reporter_spec.rb +38 -21
- data/spec/features/install_generator_spec.rb +34 -20
- data/spec/features/instrumentation_spec.rb +3 -2
- data/spec/fixtures/coverage.json +243 -0
- data/spec/javascripts/fixtures/_body.html.erb +1 -0
- data/spec/javascripts/jasmine_helper.coffee +1 -1
- data/spec/javascripts/teaspoon/base/fixture_spec.coffee +4 -4
- data/spec/javascripts/teaspoon/base/reporters/html_spec.coffee +9 -10
- data/spec/javascripts/teaspoon/mocha/reporters/html_mspec.coffee +0 -6
- data/spec/javascripts/teaspoon/phantomjs/runner_spec.coffee +5 -6
- data/spec/javascripts/turbolinks_helper.coffee +1 -1
- data/spec/spec_helper.rb +3 -4
- data/spec/teaspoon/command_line_spec.rb +139 -23
- data/spec/teaspoon/configuration_spec.rb +164 -46
- data/spec/teaspoon/console_spec.rb +142 -47
- data/spec/teaspoon/coverage_spec.rb +98 -28
- data/spec/teaspoon/drivers/base_spec.rb +5 -0
- data/spec/teaspoon/drivers/phantomjs_driver_spec.rb +32 -14
- data/spec/teaspoon/drivers/selenium_driver_spec.rb +32 -24
- data/spec/teaspoon/engine_spec.rb +8 -5
- data/spec/teaspoon/environment_spec.rb +56 -33
- data/spec/teaspoon/exceptions_spec.rb +57 -0
- data/spec/teaspoon/exporter_spec.rb +96 -0
- data/spec/teaspoon/formatters/base_spec.rb +259 -0
- data/spec/teaspoon/formatters/clean_formatter_spec.rb +37 -0
- data/spec/teaspoon/formatters/documentation_formatter_spec.rb +127 -0
- data/spec/teaspoon/formatters/dot_formatter_spec.rb +52 -56
- data/spec/teaspoon/formatters/json_formatter_spec.rb +77 -0
- data/spec/teaspoon/formatters/junit_formatter_spec.rb +72 -35
- data/spec/teaspoon/formatters/pride_formatter_spec.rb +37 -0
- data/spec/teaspoon/formatters/snowday_formatter_spec.rb +35 -0
- data/spec/teaspoon/formatters/tap_formatter_spec.rb +29 -81
- data/spec/teaspoon/formatters/tap_y_formatter_spec.rb +31 -141
- data/spec/teaspoon/formatters/teamcity_formatter_spec.rb +99 -42
- data/spec/teaspoon/instrumentation_spec.rb +44 -44
- data/spec/teaspoon/result_spec.rb +37 -0
- data/spec/teaspoon/runner_spec.rb +70 -59
- data/spec/teaspoon/server_spec.rb +34 -52
- data/spec/teaspoon/suite_spec.rb +42 -188
- data/spec/teaspoon_env.rb +39 -28
- data/vendor/assets/javascripts/{angular-scenario-1.0.5.js → angular/1.0.5.js} +0 -0
- data/vendor/assets/javascripts/{angular-scenario-1.0.5.MIT-LICENSE → angular/MIT-LICENSE} +0 -0
- data/vendor/assets/javascripts/{jasmine-1.3.1.js → jasmine/1.3.1.js} +0 -0
- data/vendor/assets/javascripts/jasmine/2.0.0.js +2412 -0
- data/vendor/assets/javascripts/{jasmine-1.3.1.MIT.LICENSE → jasmine/MIT.LICENSE} +0 -0
- data/vendor/assets/javascripts/{mocha-1.10.0.js → mocha/1.10.0.js} +1 -0
- data/vendor/assets/javascripts/mocha/1.17.1.js +5813 -0
- data/vendor/assets/javascripts/{mocha-1.10.1.MIT.LICENSE → mocha/MIT.LICENSE} +0 -0
- data/vendor/assets/javascripts/{qunit-1.12.0.js → qunit/1.12.0.js} +1 -1
- data/vendor/assets/javascripts/qunit/1.14.0.js +2288 -0
- data/vendor/assets/javascripts/{qunit-1.12.0.MIT.LICENSE → qunit/MIT.LICENSE} +0 -0
- data/vendor/assets/javascripts/support/chai.js +827 -385
- data/vendor/assets/javascripts/support/jasmine-jquery-1.7.0.js +720 -0
- data/vendor/assets/javascripts/support/jasmine-jquery-2.0.0.js +812 -0
- data/vendor/assets/javascripts/support/sinon-chai.js +17 -0
- data/vendor/assets/javascripts/support/sinon.js +1138 -643
- metadata +57 -36
- data/app/controllers/teaspoon/spec_controller.rb +0 -38
- data/app/helpers/teaspoon/spec_helper.rb +0 -36
- data/app/views/teaspoon/spec/_require_js.html.erb +0 -21
- data/app/views/teaspoon/spec/_standard.html.erb +0 -4
- data/app/views/teaspoon/spec/runner.html.erb +0 -19
- data/lib/generators/teaspoon/install/templates/env.rb +0 -38
- data/lib/generators/teaspoon/install/templates/jasmine/initializer.rb +0 -64
- data/lib/generators/teaspoon/install/templates/mocha/initializer.rb +0 -64
- data/lib/generators/teaspoon/install/templates/qunit/initializer.rb +0 -64
- data/lib/teaspoon/check_coverage.rb +0 -33
- data/lib/teaspoon/drivers/base_driver.rb +0 -10
- data/lib/teaspoon/exception_handling.rb +0 -18
- data/lib/teaspoon/formatters/base_formatter.rb +0 -63
- data/spec/dummy/config/initializers/teaspoon.rb +0 -41
- data/spec/teaspoon/check_coverage_spec.rb +0 -50
- data/spec/teaspoon/formatters/base_formatter_spec.rb +0 -45
- data/vendor/assets/javascripts/support/chai.MIT.LICENSE +0 -22
- data/vendor/assets/javascripts/support/expect.MIT.LICENSE +0 -22
- data/vendor/assets/javascripts/support/jasmine-jquery.MIT.LICENSE +0 -20
- data/vendor/assets/javascripts/support/jasmine-jquery.js +0 -659
- data/vendor/assets/javascripts/support/sinon-chai.MIT-ISH.LICENSE +0 -13
- data/vendor/assets/javascripts/support/sinon.BSD.LICENSE +0 -27
data/lib/teaspoon/utility.rb
CHANGED
@@ -4,28 +4,17 @@ module Teaspoon
|
|
4
4
|
# Cross-platform way of finding an executable in the $PATH.
|
5
5
|
# http://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
|
6
6
|
#
|
7
|
-
# @example
|
8
|
-
# which('ruby') #=> /usr/bin/ruby
|
9
|
-
#
|
10
|
-
# @param cmd [String] the executable to find
|
11
|
-
# @return [String, nil] the path to the executable
|
12
|
-
#
|
13
7
|
def which(cmd)
|
14
|
-
exts = ENV[
|
8
|
+
exts = ENV["PATHEXT"] ? ENV["PATHEXT"].split(";") : [""]
|
15
9
|
|
16
|
-
ENV[
|
10
|
+
ENV["PATH"].split(File::PATH_SEPARATOR).each do |path|
|
17
11
|
exts.each do |ext|
|
18
|
-
exe = "#{
|
12
|
+
exe = "#{path}/#{cmd}#{ext}"
|
19
13
|
return exe if File.executable?(exe)
|
20
14
|
end
|
21
15
|
end
|
22
16
|
|
23
17
|
nil
|
24
18
|
end
|
25
|
-
|
26
|
-
def istanbul()
|
27
|
-
# find istanbul in path or local npm install
|
28
|
-
which("istanbul") || (File.executable?("./node_modules/.bin/istanbul") ? "./node_modules/.bin/istanbul" : nil)
|
29
|
-
end
|
30
19
|
end
|
31
20
|
end
|
data/lib/teaspoon/version.rb
CHANGED
@@ -26,5 +26,8 @@ module Dummy
|
|
26
26
|
|
27
27
|
# Version of your assets, change this if you want to expire all your assets
|
28
28
|
config.assets.version = '1.0'
|
29
|
+
|
30
|
+
config.relative_url_root = "/relative"
|
31
|
+
config.assets.prefix = "/relative/assets" # this must be set for any asset paths to be correct!
|
29
32
|
end
|
30
33
|
end
|
@@ -3,31 +3,61 @@ require "spec_helper"
|
|
3
3
|
feature "testing with teaspoon in the console", aruba: true do
|
4
4
|
|
5
5
|
scenario "gives me the expected results" do
|
6
|
-
run_simple("bundle exec teaspoon -r ../../spec/teaspoon_env --suite=default app/assets/javascripts/integration/integration_spec.coffee", false)
|
6
|
+
run_simple("bundle exec teaspoon -r ../../spec/teaspoon_env.rb --suite=default app/assets/javascripts/integration/integration_spec.coffee", false)
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
expected = <<-OUTPUT.strip_heredoc
|
9
|
+
Teaspoon running default suite at http://127.0.0.1:31337/teaspoon/default
|
10
|
+
TypeError: 'undefined' is not a function (evaluating 'foo()')
|
11
|
+
# http://127.0.0.1:31337/relative/assets/integration/spec_helper.js:12
|
12
|
+
# http://127.0.0.1:31337/relative/assets/integration/spec_helper.js:14
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
Integration tests pending is allowed
|
16
|
-
# Not yet implemented
|
14
|
+
testing console output
|
15
|
+
..FF.*.
|
17
16
|
|
18
|
-
|
17
|
+
Pending:
|
18
|
+
Integration tests pending is allowed
|
19
|
+
# Not yet implemented
|
19
20
|
|
20
|
-
|
21
|
-
|
21
|
+
Failures:
|
22
|
+
|
23
|
+
1) Integration tests allows failing specs
|
24
|
+
Failure/Error: Expected true to be false.
|
25
|
+
|
26
|
+
2) Integration tests allows erroring specs
|
27
|
+
Failure/Error: ReferenceError: Can't find variable: foo in http://127.0.0.1:31337/relative/assets/integration/integration_spec.js?body=1 (line 14)
|
28
|
+
|
29
|
+
Finished in 0.31337 seconds
|
30
|
+
7 examples, 2 failures, 1 pending
|
31
|
+
|
32
|
+
Failed examples:
|
33
|
+
|
34
|
+
teaspoon -s default --filter="Integration tests allows failing specs."
|
35
|
+
teaspoon -s default --filter="Integration tests allows erroring specs."
|
22
36
|
OUTPUT
|
23
|
-
|
37
|
+
output = all_output.gsub(/Finished in [\d\.]+ seconds/, "Finished in 0.31337 seconds")
|
38
|
+
output = output.gsub(/127\.0\.0\.1:\d+/, "127.0.0.1:31337")
|
39
|
+
assert_partial_output(expected, output)
|
24
40
|
end
|
25
41
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
42
|
+
describe "with coverage" do
|
43
|
+
|
44
|
+
scenario "displays coverage information" do
|
45
|
+
pending("needs istanbul to be installed") unless Teaspoon::Instrumentation.executable
|
46
|
+
pending("needs to be figured out")
|
47
|
+
# for some reason when loaded in the specs the instrumentation isn't working, though it is working in practice
|
48
|
+
# confirmed that no data is coming through to Teaspoon::Coverage in the result reported by the console reporter
|
49
|
+
# confirmed that instrument=true is being added to the asset source urls
|
50
|
+
# which means that our sprockets/rack shim doesn't work in this environment
|
51
|
+
run_simple("bundle exec teaspoon -r ../../spec/teaspoon_env.rb --coverage=default app/assets/javascripts/integration/integration_spec.coffee", false)
|
52
|
+
|
53
|
+
assert_partial_output("=============================== Coverage summary ===============================", all_output)
|
54
|
+
assert_partial_output("Statements : 92.31% ( 12/13 )", all_output)
|
55
|
+
assert_partial_output("Branches : 100% ( 0/0 )", all_output)
|
56
|
+
assert_partial_output("Functions : 75% ( 3/4 )", all_output)
|
57
|
+
assert_partial_output("Lines : 92.31% ( 12/13 )", all_output)
|
58
|
+
assert_partial_output("================================================================================", all_output)
|
59
|
+
end
|
30
60
|
|
31
|
-
assert_partial_output("| % Stmts |% Branches | % Funcs | % Lines |", all_output)
|
32
61
|
end
|
62
|
+
|
33
63
|
end
|
data/spec/features/hooks_spec.rb
CHANGED
@@ -5,61 +5,43 @@ require "fileutils"
|
|
5
5
|
feature "testing hooks in the browser" do
|
6
6
|
include Rack::Test::Methods
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
}
|
14
|
-
end
|
15
|
-
|
16
|
-
let(:temp_file) { 'tmp/before_hook_test' }
|
17
|
-
|
18
|
-
def app
|
19
|
-
Dummy::Application
|
20
|
-
end
|
8
|
+
let(:app) { Dummy::Application }
|
9
|
+
let(:suites) {{
|
10
|
+
"suite1" => {block: proc{ |suite| suite.hook :before, &proc{ File.write(temp_file, "") } }},
|
11
|
+
"suite2" => {block: proc{ |suite| suite.hook :after, &proc{ File.write(temp_file, "") } }}
|
12
|
+
}}
|
21
13
|
|
22
14
|
before do
|
23
|
-
|
15
|
+
Teaspoon.configuration.stub(:suite_configs).and_return(suites)
|
16
|
+
FileUtils.mkdir_p('tmp')
|
24
17
|
File.delete(temp_file) if File.exists?(temp_file)
|
25
|
-
end
|
26
|
-
|
27
|
-
scenario "gives me the expected results" do
|
28
18
|
expect(File.exists?(temp_file)).to eql(false)
|
19
|
+
end
|
29
20
|
|
30
|
-
|
31
|
-
|
32
|
-
expect(File.exists?(temp_file)).to eql(true)
|
21
|
+
after do
|
22
|
+
File.delete(temp_file) if File.exists?(temp_file)
|
33
23
|
end
|
34
|
-
end
|
35
24
|
|
36
|
-
|
37
|
-
include Rack::Test::Methods
|
25
|
+
describe "requesting a before hook by name (using POST)" do
|
38
26
|
|
39
|
-
|
40
|
-
Teaspoon.configuration.stub(:suites).and_return "default" => proc{ |suite|
|
41
|
-
suite.hook :default do
|
42
|
-
File.write('tmp/default_hook_test', '')
|
43
|
-
end
|
44
|
-
}
|
45
|
-
end
|
27
|
+
let(:temp_file) { "tmp/before_hook_test" }
|
46
28
|
|
47
|
-
|
29
|
+
scenario "gives me the expected results" do
|
30
|
+
post("/teaspoon/suite1/before")
|
31
|
+
expect(File.exists?(temp_file)).to be_true
|
32
|
+
end
|
48
33
|
|
49
|
-
def app
|
50
|
-
Dummy::Application
|
51
34
|
end
|
52
35
|
|
53
|
-
|
54
|
-
FileUtils.mkdir 'tmp' unless File.directory?('tmp')
|
55
|
-
File.delete(temp_file) if File.exists?(temp_file)
|
56
|
-
end
|
36
|
+
describe "requesting an after hook by name (using GET)" do
|
57
37
|
|
58
|
-
|
59
|
-
expect(File.exists?(temp_file)).to eql(false)
|
38
|
+
let(:temp_file) { "tmp/after_hook_test" }
|
60
39
|
|
61
|
-
|
40
|
+
scenario "gives me the expected results" do
|
41
|
+
post("/teaspoon/suite2/after")
|
42
|
+
expect(File.exists?(temp_file)).to be_true
|
43
|
+
end
|
62
44
|
|
63
|
-
expect(File.exists?(temp_file)).to eql(true)
|
64
45
|
end
|
46
|
+
|
65
47
|
end
|
@@ -2,15 +2,17 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
feature "testing with teaspoon in the browser", js: true do
|
4
4
|
|
5
|
+
let(:spec_helper) { nil }
|
6
|
+
|
5
7
|
before do
|
6
|
-
Teaspoon.configuration.stub(:
|
8
|
+
Teaspoon.configuration.stub(:suite_configs).and_return "integration" => {block: proc{ |suite|
|
7
9
|
suite.matcher = "spec/dummy/app/assets/javascripts/integration/*_spec.{js,js.coffee,coffee}"
|
8
|
-
suite.helper =
|
9
|
-
}
|
10
|
+
suite.helper = spec_helper
|
11
|
+
}}
|
10
12
|
end
|
11
13
|
|
12
14
|
scenario "gives me the expected results" do
|
13
|
-
visit "/teaspoon/integration
|
15
|
+
visit "/teaspoon/integration"
|
14
16
|
|
15
17
|
within("#teaspoon-progress") do
|
16
18
|
expect(find("em")).to have_text("100%")
|
@@ -18,36 +20,51 @@ feature "testing with teaspoon in the browser", js: true do
|
|
18
20
|
|
19
21
|
within("#teaspoon-stats") do
|
20
22
|
expect(find("li:nth-child(1)")).to have_text("passes: 4")
|
21
|
-
expect(find("li:nth-child(2)")).to have_text("failures:
|
23
|
+
expect(find("li:nth-child(2)")).to have_text("failures: 2")
|
22
24
|
expect(find("li:nth-child(3)")).to have_text("skipped: 1")
|
23
25
|
end
|
24
26
|
|
25
27
|
within("#teaspoon-report-failures") do
|
26
|
-
expect(find("li.spec")).to have_text("Integration tests allows failing specs.")
|
28
|
+
expect(find("li.spec:first-child")).to have_text("Integration tests allows failing specs.")
|
27
29
|
end
|
28
30
|
|
29
31
|
expect(find("#spec_helper_el")).to have_text("this was generated by the spec_helper")
|
30
32
|
end
|
31
|
-
end
|
32
33
|
|
33
|
-
|
34
|
-
before do
|
35
|
-
Teaspoon.configuration.stub(:suites).and_return "integration" => proc{ |suite|
|
36
|
-
suite.matcher = "spec/dummy/app/assets/javascripts/integration/*_spec.{js,js.coffee,coffee}"
|
37
|
-
suite.helper = "turbolinks_helper"
|
38
|
-
}
|
39
|
-
end
|
34
|
+
describe "toggle buttons" do
|
40
35
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
36
|
+
scenario "progress toggle button toggles progress display" do
|
37
|
+
visit "/teaspoon/integration?reporter=HTML"
|
38
|
+
|
39
|
+
find("#teaspoon-display-progress").click
|
40
|
+
expect(page).not_to have_text("100%")
|
41
|
+
|
42
|
+
find("#teaspoon-display-progress").click
|
43
|
+
expect(page).to have_text("100%")
|
45
44
|
end
|
46
45
|
|
47
|
-
|
46
|
+
end
|
48
47
|
|
49
|
-
|
50
|
-
|
48
|
+
describe "using turbolinks doesn't break things" do
|
49
|
+
|
50
|
+
let(:spec_helper) { "turbolinks_helper" }
|
51
|
+
|
52
|
+
scenario "executes in each page navigation" do
|
53
|
+
visit "/teaspoon/integration"
|
54
|
+
|
55
|
+
within("#teaspoon-progress") do
|
56
|
+
expect(find("em")).to have_text("100%")
|
57
|
+
end
|
58
|
+
|
59
|
+
within("#teaspoon-report-failures") do
|
60
|
+
find("li.spec:first-child a").click
|
61
|
+
end
|
62
|
+
|
63
|
+
within("#teaspoon-progress") do
|
64
|
+
expect(find("em")).to have_text("100%")
|
65
|
+
end
|
51
66
|
end
|
67
|
+
|
52
68
|
end
|
69
|
+
|
53
70
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
feature "
|
3
|
+
feature "Installation", aruba: true do
|
4
4
|
|
5
5
|
before do
|
6
6
|
unset_bundler_env_vars
|
@@ -10,32 +10,46 @@ feature "installing teaspoon with the generator", aruba: true do
|
|
10
10
|
run_simple("bundle install --local")
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
describe "running the generator" do
|
14
|
+
|
15
|
+
scenario "installs the basic files" do
|
16
|
+
run_simple("bundle exec rails generate teaspoon:install --trace")
|
17
|
+
|
18
|
+
expected = <<-OUTPUT
|
17
19
|
create spec/teaspoon_env.rb
|
18
20
|
create spec/javascripts/support
|
19
21
|
create spec/javascripts/fixtures
|
20
22
|
create spec/javascripts/spec_helper.js
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
OUTPUT
|
24
|
+
assert_partial_output(expected, all_output)
|
25
|
+
|
26
|
+
check_file_presence(["spec/teaspoon_env.rb"], true)
|
27
|
+
check_file_presence(["spec/javascripts/spec_helper.js"], true)
|
28
|
+
end
|
29
|
+
|
26
30
|
end
|
27
31
|
|
28
|
-
|
29
|
-
|
30
|
-
|
32
|
+
describe "specifying options" do
|
33
|
+
|
34
|
+
scenario "installs with coffeescript spec helpers" do
|
35
|
+
run_simple("bundle exec rails generate teaspoon:install --trace --coffee")
|
36
|
+
|
37
|
+
expected = <<-OUTPUT
|
31
38
|
create spec/javascripts/spec_helper.coffee
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
39
|
+
OUTPUT
|
40
|
+
assert_partial_output(expected, all_output)
|
41
|
+
|
42
|
+
check_file_presence(["spec/teaspoon_env.rb"], true)
|
43
|
+
check_file_presence(["spec/javascripts/spec_helper.coffee"], true)
|
44
|
+
end
|
45
|
+
|
46
|
+
scenario "installs using the mocha framework" do
|
47
|
+
run_simple("bundle exec rails generate teaspoon:install --trace --framework=mocha")
|
48
|
+
|
49
|
+
check_file_content("spec/teaspoon_env.rb", %{ suite.use_framework :mocha}, true)
|
50
|
+
check_file_content("spec/teaspoon_env.rb", %{ #suite.javascripts = ["mocha/1.17.1", "teaspoon-mocha"]}, true)
|
51
|
+
end
|
36
52
|
|
37
|
-
scenario "allows installing using the mocha framework" do
|
38
|
-
run_simple("bundle exec rails generate teaspoon:install --trace --framework=mocha")
|
39
|
-
check_file_content("config/initializers/teaspoon.rb", %{ suite.javascripts = ["teaspoon-mocha"]}, true)
|
40
53
|
end
|
54
|
+
|
41
55
|
end
|
@@ -3,16 +3,17 @@ require "spec_helper"
|
|
3
3
|
feature "instrumenting javascript" do
|
4
4
|
|
5
5
|
before do
|
6
|
-
pending("needs istanbul to be installed") unless Teaspoon::Instrumentation.
|
6
|
+
pending("needs istanbul to be installed") unless Teaspoon::Instrumentation.executable
|
7
7
|
end
|
8
8
|
|
9
9
|
scenario "requesting with instrument=true adds istanbul instrumentation" do
|
10
|
-
pending
|
10
|
+
pending("needs to be figured out")
|
11
11
|
visit "/assets/instrumented1.js?instrument=true"
|
12
12
|
expect(html).to include("if (typeof __coverage__ === 'undefined') { __coverage__ = {}; }")
|
13
13
|
end
|
14
14
|
|
15
15
|
scenario "requesting without instrument=true doesn't do anything" do
|
16
|
+
pending("needs to be figured out")
|
16
17
|
visit "/assets/instrumented2.js?instrument=false"
|
17
18
|
expect(html).to_not include("if (typeof __coverage__ === 'undefined') { __coverage__ = {}; }")
|
18
19
|
end
|
@@ -0,0 +1,243 @@
|
|
1
|
+
{
|
2
|
+
"/Users/jejacks0n/Projects/teaspoon/spec/dummy/app/assets/javascripts/integration/integration.coffee":{
|
3
|
+
"path":"/Users/jejacks0n/Projects/teaspoon/spec/dummy/app/assets/javascripts/integration/integration.coffee",
|
4
|
+
"s":{
|
5
|
+
"1":1,
|
6
|
+
"2":1,
|
7
|
+
"3":1,
|
8
|
+
"4":0
|
9
|
+
},
|
10
|
+
"b":{
|
11
|
+
|
12
|
+
},
|
13
|
+
"f":{
|
14
|
+
"1":1,
|
15
|
+
"2":0
|
16
|
+
},
|
17
|
+
"fnMap":{
|
18
|
+
"1":{
|
19
|
+
"name":"(anonymous_1)",
|
20
|
+
"line":1,
|
21
|
+
"loc":{
|
22
|
+
"start":{
|
23
|
+
"line":1,
|
24
|
+
"column":1
|
25
|
+
},
|
26
|
+
"end":{
|
27
|
+
"line":1,
|
28
|
+
"column":12
|
29
|
+
}
|
30
|
+
}
|
31
|
+
},
|
32
|
+
"2":{
|
33
|
+
"name":"(anonymous_2)",
|
34
|
+
"line":4,
|
35
|
+
"loc":{
|
36
|
+
"start":{
|
37
|
+
"line":4,
|
38
|
+
"column":16
|
39
|
+
},
|
40
|
+
"end":{
|
41
|
+
"line":4,
|
42
|
+
"column":27
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
},
|
47
|
+
"statementMap":{
|
48
|
+
"1":{
|
49
|
+
"start":{
|
50
|
+
"line":1,
|
51
|
+
"column":0
|
52
|
+
},
|
53
|
+
"end":{
|
54
|
+
"line":8,
|
55
|
+
"column":14
|
56
|
+
}
|
57
|
+
},
|
58
|
+
"2":{
|
59
|
+
"start":{
|
60
|
+
"line":2,
|
61
|
+
"column":2
|
62
|
+
},
|
63
|
+
"end":{
|
64
|
+
"line":2,
|
65
|
+
"column":18
|
66
|
+
}
|
67
|
+
},
|
68
|
+
"3":{
|
69
|
+
"start":{
|
70
|
+
"line":4,
|
71
|
+
"column":2
|
72
|
+
},
|
73
|
+
"end":{
|
74
|
+
"line":6,
|
75
|
+
"column":4
|
76
|
+
}
|
77
|
+
},
|
78
|
+
"4":{
|
79
|
+
"start":{
|
80
|
+
"line":5,
|
81
|
+
"column":4
|
82
|
+
},
|
83
|
+
"end":{
|
84
|
+
"line":5,
|
85
|
+
"column":17
|
86
|
+
}
|
87
|
+
}
|
88
|
+
},
|
89
|
+
"branchMap":{
|
90
|
+
|
91
|
+
},
|
92
|
+
"code":[
|
93
|
+
"(function () { (function() {",
|
94
|
+
" var integration;",
|
95
|
+
"",
|
96
|
+
" integration = function() {",
|
97
|
+
" return 'foo';",
|
98
|
+
" };",
|
99
|
+
"",
|
100
|
+
"}).call(this);",
|
101
|
+
"",
|
102
|
+
"}());"
|
103
|
+
]
|
104
|
+
},
|
105
|
+
"/Users/jejacks0n/Projects/teaspoon/spec/dummy/app/assets/javascripts/integration/spec_helper.coffee":{
|
106
|
+
"path":"/Users/jejacks0n/Projects/teaspoon/spec/dummy/app/assets/javascripts/integration/spec_helper.coffee",
|
107
|
+
"s":{
|
108
|
+
"1":1,
|
109
|
+
"2":1,
|
110
|
+
"3":1,
|
111
|
+
"4":1,
|
112
|
+
"5":1,
|
113
|
+
"6":1,
|
114
|
+
"7":1
|
115
|
+
},
|
116
|
+
"b":{
|
117
|
+
|
118
|
+
},
|
119
|
+
"f":{
|
120
|
+
"1":1,
|
121
|
+
"2":1
|
122
|
+
},
|
123
|
+
"fnMap":{
|
124
|
+
"1":{
|
125
|
+
"name":"(anonymous_1)",
|
126
|
+
"line":1,
|
127
|
+
"loc":{
|
128
|
+
"start":{
|
129
|
+
"line":1,
|
130
|
+
"column":1
|
131
|
+
},
|
132
|
+
"end":{
|
133
|
+
"line":1,
|
134
|
+
"column":12
|
135
|
+
}
|
136
|
+
}
|
137
|
+
},
|
138
|
+
"2":{
|
139
|
+
"name":"(anonymous_2)",
|
140
|
+
"line":2,
|
141
|
+
"loc":{
|
142
|
+
"start":{
|
143
|
+
"line":2,
|
144
|
+
"column":18
|
145
|
+
},
|
146
|
+
"end":{
|
147
|
+
"line":2,
|
148
|
+
"column":29
|
149
|
+
}
|
150
|
+
}
|
151
|
+
}
|
152
|
+
},
|
153
|
+
"statementMap":{
|
154
|
+
"1":{
|
155
|
+
"start":{
|
156
|
+
"line":1,
|
157
|
+
"column":0
|
158
|
+
},
|
159
|
+
"end":{
|
160
|
+
"line":10,
|
161
|
+
"column":14
|
162
|
+
}
|
163
|
+
},
|
164
|
+
"2":{
|
165
|
+
"start":{
|
166
|
+
"line":2,
|
167
|
+
"column":2
|
168
|
+
},
|
169
|
+
"end":{
|
170
|
+
"line":8,
|
171
|
+
"column":4
|
172
|
+
}
|
173
|
+
},
|
174
|
+
"3":{
|
175
|
+
"start":{
|
176
|
+
"line":3,
|
177
|
+
"column":4
|
178
|
+
},
|
179
|
+
"end":{
|
180
|
+
"line":3,
|
181
|
+
"column":11
|
182
|
+
}
|
183
|
+
},
|
184
|
+
"4":{
|
185
|
+
"start":{
|
186
|
+
"line":4,
|
187
|
+
"column":4
|
188
|
+
},
|
189
|
+
"end":{
|
190
|
+
"line":4,
|
191
|
+
"column":39
|
192
|
+
}
|
193
|
+
},
|
194
|
+
"5":{
|
195
|
+
"start":{
|
196
|
+
"line":5,
|
197
|
+
"column":4
|
198
|
+
},
|
199
|
+
"end":{
|
200
|
+
"line":5,
|
201
|
+
"column":29
|
202
|
+
}
|
203
|
+
},
|
204
|
+
"6":{
|
205
|
+
"start":{
|
206
|
+
"line":6,
|
207
|
+
"column":4
|
208
|
+
},
|
209
|
+
"end":{
|
210
|
+
"line":6,
|
211
|
+
"column":59
|
212
|
+
}
|
213
|
+
},
|
214
|
+
"7":{
|
215
|
+
"start":{
|
216
|
+
"line":7,
|
217
|
+
"column":4
|
218
|
+
},
|
219
|
+
"end":{
|
220
|
+
"line":7,
|
221
|
+
"column":41
|
222
|
+
}
|
223
|
+
}
|
224
|
+
},
|
225
|
+
"branchMap":{
|
226
|
+
|
227
|
+
},
|
228
|
+
"code":[
|
229
|
+
"(function () { (function() {",
|
230
|
+
" window.onload = function() {",
|
231
|
+
" var el;",
|
232
|
+
" el = document.createElement(\"DIV\");",
|
233
|
+
" el.id = \"spec_helper_el\";",
|
234
|
+
" el.innerHTML = \"this was generated by the spec_helper\";",
|
235
|
+
" return document.body.appendChild(el);",
|
236
|
+
" };",
|
237
|
+
"",
|
238
|
+
"}).call(this);",
|
239
|
+
"",
|
240
|
+
"}());"
|
241
|
+
]
|
242
|
+
}
|
243
|
+
}
|