teaspoon 0.7.9 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +382 -260
  3. data/app/assets/javascripts/teaspoon-angular.js +108 -26241
  4. data/app/assets/javascripts/teaspoon-jasmine.js +103 -2642
  5. data/app/assets/javascripts/teaspoon-mocha.js +109 -5416
  6. data/app/assets/javascripts/teaspoon-qunit.js +107 -2255
  7. data/app/assets/javascripts/teaspoon-teaspoon.js +0 -1
  8. data/app/assets/javascripts/teaspoon/angular.coffee +3 -1
  9. data/app/assets/javascripts/teaspoon/base/hook.coffee +21 -0
  10. data/app/assets/javascripts/teaspoon/base/reporters/html.coffee +26 -14
  11. data/app/assets/javascripts/teaspoon/base/reporters/html/progress_view.coffee +1 -1
  12. data/app/assets/javascripts/teaspoon/base/reporters/html/template.coffee +3 -3
  13. data/app/assets/javascripts/teaspoon/base/teaspoon.coffee +10 -1
  14. data/app/assets/javascripts/teaspoon/jasmine.coffee +3 -1
  15. data/app/assets/javascripts/teaspoon/mocha.coffee +3 -1
  16. data/app/assets/javascripts/teaspoon/mocha/reporters/html.coffee +1 -1
  17. data/app/assets/javascripts/teaspoon/qunit.coffee +3 -1
  18. data/app/assets/javascripts/teaspoon/qunit/reporters/html.coffee +1 -1
  19. data/app/assets/javascripts/teaspoon/teaspoon.coffee +0 -1
  20. data/app/assets/stylesheets/teaspoon.css +12 -8
  21. data/app/controllers/teaspoon/suite_controller.rb +32 -0
  22. data/app/views/teaspoon/suite/_body.html.erb +0 -0
  23. data/app/views/teaspoon/suite/_boot.html.erb +4 -0
  24. data/app/views/teaspoon/suite/_boot_require_js.html.erb +19 -0
  25. data/app/views/teaspoon/{spec/suites.html.erb → suite/index.html.erb} +6 -7
  26. data/app/views/teaspoon/suite/show.html.erb +19 -0
  27. data/bin/teaspoon +1 -1
  28. data/config/routes.rb +14 -4
  29. data/lib/generators/teaspoon/install/POST_INSTALL +2 -2
  30. data/lib/generators/teaspoon/install/install_generator.rb +22 -11
  31. data/lib/generators/teaspoon/install/templates/_body.html.erb +0 -0
  32. data/lib/generators/teaspoon/install/templates/_boot.html.erb +4 -0
  33. data/lib/generators/teaspoon/install/templates/jasmine/env.rb +11 -0
  34. data/lib/generators/teaspoon/install/templates/jasmine/env_comments.rb +182 -0
  35. data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.coffee +8 -6
  36. data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.js +8 -7
  37. data/lib/generators/teaspoon/install/templates/mocha/env.rb +11 -0
  38. data/lib/generators/teaspoon/install/templates/mocha/env_comments.rb +182 -0
  39. data/lib/generators/teaspoon/install/templates/mocha/spec_helper.coffee +13 -13
  40. data/lib/generators/teaspoon/install/templates/mocha/spec_helper.js +13 -13
  41. data/lib/generators/teaspoon/install/templates/qunit/env.rb +11 -0
  42. data/lib/generators/teaspoon/install/templates/qunit/env_comments.rb +182 -0
  43. data/lib/generators/teaspoon/install/templates/qunit/test_helper.coffee +6 -5
  44. data/lib/generators/teaspoon/install/templates/qunit/test_helper.js +6 -5
  45. data/lib/tasks/teaspoon.rake +9 -2
  46. data/lib/teaspoon.rb +4 -6
  47. data/lib/teaspoon/command_line.rb +116 -134
  48. data/lib/teaspoon/configuration.rb +144 -66
  49. data/lib/teaspoon/console.rb +70 -37
  50. data/lib/teaspoon/coverage.rb +42 -15
  51. data/lib/teaspoon/deprecated.rb +65 -0
  52. data/lib/teaspoon/drivers/base.rb +10 -0
  53. data/lib/teaspoon/drivers/phantomjs/runner.js +9 -11
  54. data/lib/teaspoon/drivers/phantomjs_driver.rb +21 -21
  55. data/lib/teaspoon/drivers/selenium_driver.rb +32 -13
  56. data/lib/teaspoon/engine.rb +32 -12
  57. data/lib/teaspoon/environment.rb +16 -12
  58. data/lib/teaspoon/exceptions.rb +41 -5
  59. data/lib/teaspoon/exporter.rb +52 -0
  60. data/lib/teaspoon/formatters/base.rb +171 -0
  61. data/lib/teaspoon/formatters/clean_formatter.rb +2 -4
  62. data/lib/teaspoon/formatters/documentation_formatter.rb +60 -0
  63. data/lib/teaspoon/formatters/dot_formatter.rb +12 -90
  64. data/lib/teaspoon/formatters/json_formatter.rb +36 -0
  65. data/lib/teaspoon/formatters/junit_formatter.rb +51 -32
  66. data/lib/teaspoon/formatters/modules/report_module.rb +76 -0
  67. data/lib/teaspoon/formatters/pride_formatter.rb +23 -27
  68. data/lib/teaspoon/formatters/snowday_formatter.rb +7 -11
  69. data/lib/teaspoon/formatters/swayze_or_oprah_formatter.rb +88 -64
  70. data/lib/teaspoon/formatters/tap_formatter.rb +18 -27
  71. data/lib/teaspoon/formatters/tap_y_formatter.rb +35 -45
  72. data/lib/teaspoon/formatters/teamcity_formatter.rb +69 -31
  73. data/lib/teaspoon/instrumentation.rb +33 -33
  74. data/lib/teaspoon/result.rb +2 -1
  75. data/lib/teaspoon/runner.rb +40 -28
  76. data/lib/teaspoon/server.rb +23 -25
  77. data/lib/teaspoon/suite.rb +52 -72
  78. data/lib/teaspoon/utility.rb +3 -14
  79. data/lib/teaspoon/version.rb +1 -1
  80. data/spec/dummy/app/assets/javascripts/integration/integration_spec.coffee +3 -0
  81. data/spec/dummy/app/assets/javascripts/integration/spec_helper.coffee +2 -0
  82. data/spec/dummy/config/application.rb +3 -0
  83. data/spec/features/console_reporter_spec.rb +48 -18
  84. data/spec/features/hooks_spec.rb +23 -41
  85. data/spec/features/html_reporter_spec.rb +38 -21
  86. data/spec/features/install_generator_spec.rb +34 -20
  87. data/spec/features/instrumentation_spec.rb +3 -2
  88. data/spec/fixtures/coverage.json +243 -0
  89. data/spec/javascripts/fixtures/_body.html.erb +1 -0
  90. data/spec/javascripts/jasmine_helper.coffee +1 -1
  91. data/spec/javascripts/teaspoon/base/fixture_spec.coffee +4 -4
  92. data/spec/javascripts/teaspoon/base/reporters/html_spec.coffee +9 -10
  93. data/spec/javascripts/teaspoon/mocha/reporters/html_mspec.coffee +0 -6
  94. data/spec/javascripts/teaspoon/phantomjs/runner_spec.coffee +5 -6
  95. data/spec/javascripts/turbolinks_helper.coffee +1 -1
  96. data/spec/spec_helper.rb +3 -4
  97. data/spec/teaspoon/command_line_spec.rb +139 -23
  98. data/spec/teaspoon/configuration_spec.rb +164 -46
  99. data/spec/teaspoon/console_spec.rb +142 -47
  100. data/spec/teaspoon/coverage_spec.rb +98 -28
  101. data/spec/teaspoon/drivers/base_spec.rb +5 -0
  102. data/spec/teaspoon/drivers/phantomjs_driver_spec.rb +32 -14
  103. data/spec/teaspoon/drivers/selenium_driver_spec.rb +32 -24
  104. data/spec/teaspoon/engine_spec.rb +8 -5
  105. data/spec/teaspoon/environment_spec.rb +56 -33
  106. data/spec/teaspoon/exceptions_spec.rb +57 -0
  107. data/spec/teaspoon/exporter_spec.rb +96 -0
  108. data/spec/teaspoon/formatters/base_spec.rb +259 -0
  109. data/spec/teaspoon/formatters/clean_formatter_spec.rb +37 -0
  110. data/spec/teaspoon/formatters/documentation_formatter_spec.rb +127 -0
  111. data/spec/teaspoon/formatters/dot_formatter_spec.rb +52 -56
  112. data/spec/teaspoon/formatters/json_formatter_spec.rb +77 -0
  113. data/spec/teaspoon/formatters/junit_formatter_spec.rb +72 -35
  114. data/spec/teaspoon/formatters/pride_formatter_spec.rb +37 -0
  115. data/spec/teaspoon/formatters/snowday_formatter_spec.rb +35 -0
  116. data/spec/teaspoon/formatters/tap_formatter_spec.rb +29 -81
  117. data/spec/teaspoon/formatters/tap_y_formatter_spec.rb +31 -141
  118. data/spec/teaspoon/formatters/teamcity_formatter_spec.rb +99 -42
  119. data/spec/teaspoon/instrumentation_spec.rb +44 -44
  120. data/spec/teaspoon/result_spec.rb +37 -0
  121. data/spec/teaspoon/runner_spec.rb +70 -59
  122. data/spec/teaspoon/server_spec.rb +34 -52
  123. data/spec/teaspoon/suite_spec.rb +42 -188
  124. data/spec/teaspoon_env.rb +39 -28
  125. data/vendor/assets/javascripts/{angular-scenario-1.0.5.js → angular/1.0.5.js} +0 -0
  126. data/vendor/assets/javascripts/{angular-scenario-1.0.5.MIT-LICENSE → angular/MIT-LICENSE} +0 -0
  127. data/vendor/assets/javascripts/{jasmine-1.3.1.js → jasmine/1.3.1.js} +0 -0
  128. data/vendor/assets/javascripts/jasmine/2.0.0.js +2412 -0
  129. data/vendor/assets/javascripts/{jasmine-1.3.1.MIT.LICENSE → jasmine/MIT.LICENSE} +0 -0
  130. data/vendor/assets/javascripts/{mocha-1.10.0.js → mocha/1.10.0.js} +1 -0
  131. data/vendor/assets/javascripts/mocha/1.17.1.js +5813 -0
  132. data/vendor/assets/javascripts/{mocha-1.10.1.MIT.LICENSE → mocha/MIT.LICENSE} +0 -0
  133. data/vendor/assets/javascripts/{qunit-1.12.0.js → qunit/1.12.0.js} +1 -1
  134. data/vendor/assets/javascripts/qunit/1.14.0.js +2288 -0
  135. data/vendor/assets/javascripts/{qunit-1.12.0.MIT.LICENSE → qunit/MIT.LICENSE} +0 -0
  136. data/vendor/assets/javascripts/support/chai.js +827 -385
  137. data/vendor/assets/javascripts/support/jasmine-jquery-1.7.0.js +720 -0
  138. data/vendor/assets/javascripts/support/jasmine-jquery-2.0.0.js +812 -0
  139. data/vendor/assets/javascripts/support/sinon-chai.js +17 -0
  140. data/vendor/assets/javascripts/support/sinon.js +1138 -643
  141. metadata +57 -36
  142. data/app/controllers/teaspoon/spec_controller.rb +0 -38
  143. data/app/helpers/teaspoon/spec_helper.rb +0 -36
  144. data/app/views/teaspoon/spec/_require_js.html.erb +0 -21
  145. data/app/views/teaspoon/spec/_standard.html.erb +0 -4
  146. data/app/views/teaspoon/spec/runner.html.erb +0 -19
  147. data/lib/generators/teaspoon/install/templates/env.rb +0 -38
  148. data/lib/generators/teaspoon/install/templates/jasmine/initializer.rb +0 -64
  149. data/lib/generators/teaspoon/install/templates/mocha/initializer.rb +0 -64
  150. data/lib/generators/teaspoon/install/templates/qunit/initializer.rb +0 -64
  151. data/lib/teaspoon/check_coverage.rb +0 -33
  152. data/lib/teaspoon/drivers/base_driver.rb +0 -10
  153. data/lib/teaspoon/exception_handling.rb +0 -18
  154. data/lib/teaspoon/formatters/base_formatter.rb +0 -63
  155. data/spec/dummy/config/initializers/teaspoon.rb +0 -41
  156. data/spec/teaspoon/check_coverage_spec.rb +0 -50
  157. data/spec/teaspoon/formatters/base_formatter_spec.rb +0 -45
  158. data/vendor/assets/javascripts/support/chai.MIT.LICENSE +0 -22
  159. data/vendor/assets/javascripts/support/expect.MIT.LICENSE +0 -22
  160. data/vendor/assets/javascripts/support/jasmine-jquery.MIT.LICENSE +0 -20
  161. data/vendor/assets/javascripts/support/jasmine-jquery.js +0 -659
  162. data/vendor/assets/javascripts/support/sinon-chai.MIT-ISH.LICENSE +0 -13
  163. data/vendor/assets/javascripts/support/sinon.BSD.LICENSE +0 -27
@@ -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['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
8
+ exts = ENV["PATHEXT"] ? ENV["PATHEXT"].split(";") : [""]
15
9
 
16
- ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
10
+ ENV["PATH"].split(File::PATH_SEPARATOR).each do |path|
17
11
  exts.each do |ext|
18
- exe = "#{ path }/#{ cmd }#{ ext }"
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
@@ -1,3 +1,3 @@
1
1
  module Teaspoon
2
- VERSION = "0.7.9"
2
+ VERSION = "0.8.0"
3
3
  end
@@ -13,6 +13,9 @@ describe "Integration tests", ->
13
13
  it "allows failing specs", ->
14
14
  expect(true).toBe(false)
15
15
 
16
+ it "allows erroring specs", ->
17
+ foo()
18
+
16
19
  describe "nesting", ->
17
20
 
18
21
  it "is allowed", ->
@@ -3,3 +3,5 @@ window.onload = ->
3
3
  el.id = "spec_helper_el"
4
4
  el.innerHTML = "this was generated by the spec_helper"
5
5
  document.body.appendChild(el)
6
+
7
+ foo = foo()
@@ -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
- assert_partial_output("..F.*.", all_output)
9
- assert_partial_output("testing console output", all_output)
10
- assert_partial_output("6 examples, 1 failure, 1 pending", all_output)
11
- assert_partial_output('teaspoon -s default --filter="Integration tests allows failing specs."', all_output)
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
- expected = <<-OUTPUT
14
- Pending:
15
- Integration tests pending is allowed
16
- # Not yet implemented
14
+ testing console output
15
+ ..FF.*.
17
16
 
18
- Failures:
17
+ Pending:
18
+ Integration tests pending is allowed
19
+ # Not yet implemented
19
20
 
20
- 1) Integration tests allows failing specs
21
- Failure/Error: Expected true to be false.
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
- assert_partial_output(expected, all_output)
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
- scenario "displays coverage information" do
27
- pending "broken with rails 4"
28
- pending("needs istanbul to be installed") unless Teaspoon::Instrumentation.istanbul()
29
- run_simple("bundle exec teaspoon -r ../../spec/teaspoon_env --suite=default app/assets/javascripts/integration/integration_spec.coffee --coverage-reports=text", false)
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
@@ -5,61 +5,43 @@ require "fileutils"
5
5
  feature "testing hooks in the browser" do
6
6
  include Rack::Test::Methods
7
7
 
8
- before do
9
- Teaspoon.configuration.stub(:suites).and_return "before_hooks" => proc{ |suite|
10
- suite.hook :before do
11
- File.write('tmp/before_hook_test' , '')
12
- end
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
- FileUtils.mkdir 'tmp' unless File.directory?('tmp')
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
- post "/teaspoon/before_hooks/hooks/before"
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
- feature "testing after hooks in the browser" do
37
- include Rack::Test::Methods
25
+ describe "requesting a before hook by name (using POST)" do
38
26
 
39
- before do
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
- let(:temp_file) { 'tmp/default_hook_test' }
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
- before do
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
- scenario "gives me the expected results" do
59
- expect(File.exists?(temp_file)).to eql(false)
38
+ let(:temp_file) { "tmp/after_hook_test" }
60
39
 
61
- post "/teaspoon/default/hooks"
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(:suites).and_return "integration" => proc{ |suite|
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 = nil
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?reporter=HTML"
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: 1")
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
- feature "testing with teaspoon in the browser with turbolinks", js: true do
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
- scenario "executes teaspoon in each page navigation" do
42
- visit "/teaspoon/integration?reporter=HTML"
43
- within("#teaspoon-progress") do
44
- expect(find("em")).to have_text("100%")
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
- find("#teaspoon-report-failures li.spec a").click
46
+ end
48
47
 
49
- within("#teaspoon-progress") do
50
- expect(find("em")).to have_text("100%")
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 "installing teaspoon with the generator", aruba: true do
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
- scenario "installs the basic files" do
14
- run_simple("bundle exec rails generate teaspoon:install --trace")
15
- expected = <<-OUTPUT
16
- create config/initializers/teaspoon.rb
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
- OUTPUT
22
- assert_partial_output(expected, all_output)
23
- check_file_presence(["config/initializers/teaspoon.rb"], true)
24
- check_file_presence(["spec/teaspoon_env.rb"], true)
25
- check_file_presence(["spec/javascripts/spec_helper.js"], true)
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
- scenario "installs with coffeescript spec helpers" do
29
- run_simple("bundle exec rails generate teaspoon:install --trace --coffee")
30
- expected = <<-OUTPUT
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
- OUTPUT
33
- assert_partial_output(expected, all_output)
34
- check_file_presence(["config/initializers/teaspoon.rb"], true)
35
- end
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.istanbul()
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 "broken with rails 4"
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
+ }