teabag 0.4.6 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. data/README.md +83 -92
  2. data/app/assets/javascripts/teabag-jasmine.js +5 -2
  3. data/app/assets/javascripts/teabag-mocha.js +5 -2
  4. data/app/assets/javascripts/teabag-qunit.js +5 -2
  5. data/app/assets/javascripts/teabag/base/reporters/console.coffee +2 -1
  6. data/app/assets/javascripts/teabag/base/reporters/html/progress_view.coffee +1 -1
  7. data/app/controllers/teabag/spec_controller.rb +2 -2
  8. data/app/helpers/teabag/spec_helper.rb +11 -2
  9. data/app/views/teabag/spec/index.html.erb +1 -1
  10. data/bin/teabag +6 -0
  11. data/config/routes.rb +2 -2
  12. data/lib/generators/teabag/install/POST_INSTALL +0 -2
  13. data/lib/generators/teabag/install/install_generator.rb +46 -5
  14. data/lib/generators/teabag/install/templates/env.rb +28 -0
  15. data/lib/generators/teabag/install/templates/{initializer.rb → jasmine/initializer.rb} +5 -13
  16. data/lib/generators/teabag/install/templates/jasmine/spec_helper.coffee +25 -0
  17. data/lib/generators/teabag/install/templates/jasmine/spec_helper.js +25 -0
  18. data/lib/generators/teabag/install/templates/mocha/initializer.rb +58 -0
  19. data/lib/generators/teabag/install/templates/mocha/spec_helper.coffee +25 -0
  20. data/lib/generators/teabag/install/templates/mocha/spec_helper.js +25 -0
  21. data/lib/generators/teabag/install/templates/qunit/initializer.rb +58 -0
  22. data/lib/generators/teabag/install/templates/qunit/test_helper.coffee +24 -0
  23. data/lib/generators/teabag/install/templates/qunit/test_helper.js +24 -0
  24. data/lib/tasks/teabag.rake +1 -1
  25. data/lib/teabag/command_line.rb +96 -0
  26. data/lib/teabag/configuration.rb +25 -35
  27. data/lib/teabag/console.rb +19 -7
  28. data/lib/teabag/drivers/phantomjs/runner.coffee +2 -2
  29. data/lib/teabag/drivers/selenium_driver.rb +2 -2
  30. data/lib/teabag/environment.rb +46 -0
  31. data/lib/teabag/exceptions.rb +1 -0
  32. data/lib/teabag/formatters/base_formatter.rb +5 -0
  33. data/lib/teabag/formatters/dot_formatter.rb +3 -2
  34. data/lib/teabag/formatters/junit_formatter.rb +19 -0
  35. data/lib/teabag/formatters/swayze_or_oprah_formatter.rb +7 -2
  36. data/lib/teabag/formatters/tap_y_formatter.rb +1 -0
  37. data/lib/teabag/runner.rb +1 -1
  38. data/lib/teabag/suite.rb +15 -6
  39. data/lib/teabag/version.rb +1 -1
  40. data/spec/dummy/log/development.log +62925 -0
  41. data/spec/dummy/log/test.log +614 -0
  42. data/spec/dummy/tmp/cache/assets/C35/A30/sprockets%2F29906bf540f7d2e081088494b2554989 +0 -0
  43. data/spec/dummy/tmp/cache/assets/C4E/9B0/sprockets%2Fa807397434c9262c3d62da3e91152184 +0 -0
  44. data/spec/dummy/tmp/cache/assets/C59/250/sprockets%2Fa80d3fe493d2476e58c4323996064512 +0 -0
  45. data/spec/dummy/tmp/cache/assets/C72/150/sprockets%2F4194031b4b51b6422c14ac697e3455e5 +0 -0
  46. data/spec/dummy/tmp/cache/assets/C75/D50/sprockets%2F5302968a40e08d2c011aa38666d273f6 +0 -0
  47. data/spec/dummy/tmp/cache/assets/C78/F80/sprockets%2F9161622ddd251097a4ab816b8220984c +0 -0
  48. data/spec/dummy/tmp/cache/assets/C7A/EC0/sprockets%2F5c16e4214f5662e1b27932a57c43491b +0 -0
  49. data/spec/dummy/tmp/cache/assets/C89/700/sprockets%2F259935a7704fef0069303ea63fa89408 +0 -0
  50. data/spec/dummy/tmp/cache/assets/C8A/460/sprockets%2F77bffd9959420103906722b404ae8d59 +0 -0
  51. data/spec/dummy/tmp/cache/assets/C91/FA0/sprockets%2F2eb81283f5789ae91a69344552db3856 +0 -0
  52. data/spec/dummy/tmp/cache/assets/C9D/E90/sprockets%2F3045c9533f179d3e1c805d163ed002a0 +0 -0
  53. data/spec/dummy/tmp/cache/assets/CA6/DF0/sprockets%2F7da83747ce56e49393b6b8726587f846 +0 -0
  54. data/spec/dummy/tmp/cache/assets/CA9/C40/sprockets%2F932b7e2cd1e067289ab51190800814df +0 -0
  55. data/spec/dummy/tmp/cache/assets/CAA/0C0/sprockets%2F057b0ce384f16d9202ae84473436cc35 +0 -0
  56. data/spec/dummy/tmp/cache/assets/CAD/410/sprockets%2F651414e5c7e86f05c5108dc71626b25c +0 -0
  57. data/spec/dummy/tmp/cache/assets/CAF/0F0/sprockets%2F6000e67cf3f2377f860c24da7c819701 +0 -0
  58. data/spec/dummy/tmp/cache/assets/CB7/2B0/sprockets%2Fdf3d317564a780186148134f2ddd59a9 +0 -0
  59. data/spec/dummy/tmp/cache/assets/CBB/FA0/sprockets%2F74922109263bdc965b2e9567eec6d154 +0 -0
  60. data/spec/dummy/tmp/cache/assets/CBD/AF0/sprockets%2Fd687ec33822256e9444e8cd04f1b4873 +0 -0
  61. data/spec/dummy/tmp/cache/assets/CBF/630/sprockets%2F707d2db81468088470d476abff35388d +0 -0
  62. data/spec/dummy/tmp/cache/assets/CC1/DB0/sprockets%2F95e6273223502af230a0dbaa25410de8 +0 -0
  63. data/spec/dummy/tmp/cache/assets/CC2/EC0/sprockets%2F76bf80cb571ca530357f78db78167866 +0 -0
  64. data/spec/dummy/tmp/cache/assets/CCE/C50/sprockets%2Fe12774c2fea852112414bb379a71f31a +0 -0
  65. data/spec/dummy/tmp/cache/assets/CD1/620/sprockets%2F06a3eb05fcb4175a679d6084a06026a6 +0 -0
  66. data/spec/dummy/tmp/cache/assets/CD3/460/sprockets%2F7f3f6802b0b309ed142d0b671c9640c4 +0 -0
  67. data/spec/dummy/tmp/cache/assets/CD9/DD0/sprockets%2Fe5774759168a731da1c1149ecf0e1b03 +0 -0
  68. data/spec/dummy/tmp/cache/assets/CE0/090/sprockets%2F48d5d35ae87d0723318b8bc257fa2237 +0 -0
  69. data/spec/dummy/tmp/cache/assets/CE3/1F0/sprockets%2Fe69a515d3a9d14c669be8871012a7d07 +0 -0
  70. data/spec/dummy/tmp/cache/assets/CE6/270/sprockets%2F2c98152560d18470fec8cf4c6829b4d0 +0 -0
  71. data/spec/dummy/tmp/cache/assets/CE6/7C0/sprockets%2Fa03a2c86ce6724be8542295e1cf24798 +0 -0
  72. data/spec/dummy/tmp/cache/assets/CE7/A60/sprockets%2Ff58eee249aa167d23f8220087bb46684 +0 -0
  73. data/spec/dummy/tmp/cache/assets/CE9/9E0/sprockets%2F135480d497ed7e4884462dc0ef0b80d7 +0 -0
  74. data/spec/dummy/tmp/cache/assets/CEB/680/sprockets%2F67f0794ef8c0576d5c7da34f4437305a +0 -0
  75. data/spec/dummy/tmp/cache/assets/CEB/B40/sprockets%2F1150bf8d912aa100a132251eefaf6045 +0 -0
  76. data/spec/dummy/tmp/cache/assets/CF4/6F0/sprockets%2Fed96f92571224b862b84d7078b86ded3 +0 -0
  77. data/spec/dummy/tmp/cache/assets/CF8/780/sprockets%2F8845b81ff27cdb57c835836c9f91a265 +0 -0
  78. data/spec/dummy/tmp/cache/assets/CFA/D20/sprockets%2Fb26796b39b3c5d6ed70be7989637a493 +0 -0
  79. data/spec/dummy/tmp/cache/assets/CFB/210/sprockets%2F9104695bfbf9a9d4b94382e6e90487a9 +0 -0
  80. data/spec/dummy/tmp/cache/assets/CFC/380/sprockets%2Fa7443cbd671446a589867dd5f4a4f989 +0 -0
  81. data/spec/dummy/tmp/cache/assets/D00/110/sprockets%2F6a6353b7723a8b21708e0fbfe04bd422 +0 -0
  82. data/spec/dummy/tmp/cache/assets/D00/F60/sprockets%2F42e279b52511c47d26c0adb125fd04e8 +0 -0
  83. data/spec/dummy/tmp/cache/assets/D03/630/sprockets%2F5d8da32dba6a7be70426a1d554773701 +0 -0
  84. data/spec/dummy/tmp/cache/assets/D04/170/sprockets%2F76ab1dc02e6c7618852708a1e05a2df3 +0 -0
  85. data/spec/dummy/tmp/cache/assets/D04/480/sprockets%2F8bd8f10500b21d2f9d94e4cd1401c936 +0 -0
  86. data/spec/dummy/tmp/cache/assets/D05/8D0/sprockets%2F319f8f235f452343f1ebf03cb262d23d +0 -0
  87. data/spec/dummy/tmp/cache/assets/D09/BF0/sprockets%2F9e6bca5d26f50d9484385d51ba04312c +0 -0
  88. data/spec/dummy/tmp/cache/assets/D0E/570/sprockets%2F90fe371bf8091e88a712124d9cdae260 +0 -0
  89. data/spec/dummy/tmp/cache/assets/D15/750/sprockets%2F8effdd3e668a4036260a3e370f3b6657 +0 -0
  90. data/spec/dummy/tmp/cache/assets/D17/710/sprockets%2Ffa49fb6823d466e79a195e0cd71340c5 +0 -0
  91. data/spec/dummy/tmp/cache/assets/D1A/D30/sprockets%2F815a5177e9edba0c5c996182ef1b3675 +0 -0
  92. data/spec/dummy/tmp/cache/assets/D1D/560/sprockets%2F1ca784ee7ba1922465147e7f8963eae5 +0 -0
  93. data/spec/dummy/tmp/cache/assets/D1E/AA0/sprockets%2F5c8741a556bc955cd36e61c88582b6dc +0 -0
  94. data/spec/dummy/tmp/cache/assets/D31/9C0/sprockets%2Fbd102a4f5a4985c3519dd6ab0295a1c6 +0 -0
  95. data/spec/dummy/tmp/cache/assets/D35/7C0/sprockets%2Ff536a2606eaf7d542c0985104cb62baf +0 -0
  96. data/spec/dummy/tmp/cache/assets/D37/FF0/sprockets%2F96841ca4cfae32c515077f3f5fc303b2 +0 -0
  97. data/spec/dummy/tmp/cache/assets/D3C/840/sprockets%2Fc6202ec91d567a85bd3d46dc43ea9108 +0 -0
  98. data/spec/dummy/tmp/cache/assets/D44/E90/sprockets%2F05cfc0bf7c9938963d1d1c63248db80d +0 -0
  99. data/spec/dummy/tmp/cache/assets/D45/C30/sprockets%2Fcc744877558178a3adb77c441cadce70 +0 -0
  100. data/spec/dummy/tmp/cache/assets/D47/A90/sprockets%2Fe7ca382b607c595ea6505853f7fb63da +0 -0
  101. data/spec/dummy/tmp/cache/assets/D49/1F0/sprockets%2F773b56f87127c6605e7d1d3faf2b6af6 +0 -0
  102. data/spec/dummy/tmp/cache/assets/D49/A10/sprockets%2Fc4656bd995a6f297c26d19b13aadb963 +0 -0
  103. data/spec/dummy/tmp/cache/assets/D50/D70/sprockets%2Fe2a3e6c95b11e0801a4eebae3a026026 +0 -0
  104. data/spec/dummy/tmp/cache/assets/D51/400/sprockets%2Ff5e433d8a31e80985b75ce598de236be +0 -0
  105. data/spec/dummy/tmp/cache/assets/D5C/710/sprockets%2F9427d05cee2caa721241a25a9af1d08f +0 -0
  106. data/spec/dummy/tmp/cache/assets/D5C/CC0/sprockets%2Faa8bf6de211f2765b0a26f112b971f0c +0 -0
  107. data/spec/dummy/tmp/cache/assets/D5E/FA0/sprockets%2Fc81c371ae2d61a6aa1708262fba79e0d +0 -0
  108. data/spec/dummy/tmp/cache/assets/D61/1F0/sprockets%2F0c7a6176d2fc4db00bb9a74d36380fe1 +0 -0
  109. data/spec/dummy/tmp/cache/assets/D67/BC0/sprockets%2F35d2c2b45981ade5a2db2a9c7f37a615 +0 -0
  110. data/spec/dummy/tmp/cache/assets/D69/F90/sprockets%2F6a0795b7b38bd7e6142cd1b88211dade +0 -0
  111. data/spec/dummy/tmp/cache/assets/D6A/950/sprockets%2F429b1806cb7580ebf29f9a12c33cbea6 +0 -0
  112. data/spec/dummy/tmp/cache/assets/D6B/6E0/sprockets%2F266d99da1afe084cac250a6ba864c565 +0 -0
  113. data/spec/dummy/tmp/cache/assets/D6D/DA0/sprockets%2Fac936bf40b42227a2bf9d474ae9ec149 +0 -0
  114. data/spec/dummy/tmp/cache/assets/D6F/5B0/sprockets%2F5dcc801a7a6c340c5baf525839f9b8b6 +0 -0
  115. data/spec/dummy/tmp/cache/assets/D77/B30/sprockets%2F946cf2f17c7eb41037f9ee08ad67ec40 +0 -0
  116. data/spec/dummy/tmp/cache/assets/D78/2F0/sprockets%2F3c61f8915b8f717b1de788e6ecad122c +0 -0
  117. data/spec/dummy/tmp/cache/assets/D7E/C10/sprockets%2F747c98c3cc7494a62dd882752adffb2b +0 -0
  118. data/spec/dummy/tmp/cache/assets/D8C/520/sprockets%2F221cd58a042baac534d27e4cfedc1188 +0 -0
  119. data/spec/dummy/tmp/cache/assets/D93/BD0/sprockets%2Ff5e1b60201e08e3ddf8d3de5211f3d5e +0 -0
  120. data/spec/dummy/tmp/cache/assets/DA0/330/sprockets%2Fcbbb4de706387d50f48a72ee6c9c1b80 +0 -0
  121. data/spec/dummy/tmp/cache/assets/DA5/0A0/sprockets%2F7a4b5928cec69ab65afff309a04d6b47 +0 -0
  122. data/spec/dummy/tmp/cache/assets/DA9/BF0/sprockets%2Fc59f8f7bf494fe030610bc86bb7cc5e5 +0 -0
  123. data/spec/dummy/tmp/cache/assets/DAC/9B0/sprockets%2F5e58701704fefbc8f88ae24c549fab6b +0 -0
  124. data/spec/dummy/tmp/cache/assets/DAE/6C0/sprockets%2F77c7a8676aeefa73156c55dfcf51cc46 +0 -0
  125. data/spec/dummy/tmp/cache/assets/DB3/5D0/sprockets%2Fce1d4d75832c9bdeafd869f6f7b61725 +0 -0
  126. data/spec/dummy/tmp/cache/assets/DB4/1F0/sprockets%2F69ad2749d7bfe831c0e74e7d7fc4dc57 +0 -0
  127. data/spec/dummy/tmp/cache/assets/DB5/040/sprockets%2F9a9da5df88713663b9fbc945facca891 +0 -0
  128. data/spec/dummy/tmp/cache/assets/DC3/230/sprockets%2Fdf52e72eb73be91eccc60182191aed0b +0 -0
  129. data/spec/dummy/tmp/cache/assets/DC7/A10/sprockets%2F84a8af0fcbf401864e1ae5bf092cba94 +0 -0
  130. data/spec/dummy/tmp/cache/assets/DCD/EB0/sprockets%2F4f77f509126ecbced7ea2a5ab290c8d4 +0 -0
  131. data/spec/dummy/tmp/cache/assets/DE4/140/sprockets%2F139e4ab85d1aacb22c115fa136afdc8a +0 -0
  132. data/spec/dummy/tmp/cache/assets/DEB/110/sprockets%2F2dbdab0ce5babca645cdb5780004f875 +0 -0
  133. data/spec/dummy/tmp/cache/assets/DF6/0E0/sprockets%2F85b10db6e1afe643aba6d396abdd77f0 +0 -0
  134. data/spec/dummy/tmp/cache/assets/DF7/E10/sprockets%2F25e4253aba9a9adcefb72552fb1ff0c8 +0 -0
  135. data/spec/dummy/tmp/cache/assets/DFC/C20/sprockets%2Fd9178ad7e3b401c9fceafd64ea2b50d6 +0 -0
  136. data/spec/dummy/tmp/cache/assets/DFC/C30/sprockets%2Fb50a07cb30b0bd0eec8e98e5de79d65d +0 -0
  137. data/spec/dummy/tmp/cache/assets/E02/6E0/sprockets%2F63d6a5cdb8cefa64ef76b5c6e0fd3720 +0 -0
  138. data/spec/dummy/tmp/cache/assets/E08/BB0/sprockets%2Fefac99af1af28543aef6fb607faa4973 +0 -0
  139. data/spec/dummy/tmp/cache/assets/E08/F20/sprockets%2F4fc5cdcd6974efe7adfe809b30bd6513 +0 -0
  140. data/spec/dummy/tmp/cache/assets/E16/D30/sprockets%2Fd69469e6e7439baacd8df989c0fdacc2 +0 -0
  141. data/spec/dummy/tmp/cache/assets/E17/EF0/sprockets%2Fa291ad64a26afd055dfadabbdf03f154 +0 -0
  142. data/spec/dummy/tmp/cache/assets/E2F/790/sprockets%2F7fac280deaa7ef20a77d5c9b5b9cfc34 +0 -0
  143. data/spec/dummy/tmp/cache/assets/E41/250/sprockets%2F97cf8fe3d7ffaff076f655aefb36da03 +0 -0
  144. data/spec/dummy/tmp/cache/assets/E64/1E0/sprockets%2F81ab4c863fbbdec8dd66afc97ebf034d +0 -0
  145. data/spec/dummy/tmp/cache/assets/E6E/260/sprockets%2Fd9f8ab8b91ef582cc6c99a3ba0dedfe6 +0 -0
  146. data/spec/dummy/tmp/cache/assets/F79/360/sprockets%2F0ce035fefee5ebdabc8efabfbdbd6ee4 +0 -0
  147. data/spec/javascripts/spec_helper.coffee +2 -0
  148. data/spec/javascripts/support/json2.js +486 -0
  149. data/spec/javascripts/teabag/base/reporters/console_spec.coffee +14 -2
  150. data/spec/javascripts/teabag/base/teabag_spec.coffee +1 -0
  151. data/spec/javascripts/teabag/mocha/mocha_mspec.coffee +1 -1
  152. data/spec/javascripts/teabag/phantomjs/runner_spec.coffee +1 -0
  153. data/spec/teabag/command_line_spec.rb +50 -0
  154. data/spec/teabag/console_spec.rb +32 -3
  155. data/spec/teabag/drivers/selenium_driver_spec.rb +2 -2
  156. data/spec/teabag/environment_spec.rb +88 -0
  157. data/spec/teabag/formatters/dot_formatter_spec.rb +2 -2
  158. data/spec/teabag/runner_spec.rb +4 -0
  159. data/spec/teabag/suite_spec.rb +8 -2
  160. data/spec/teabag_env.rb +27 -0
  161. metadata +40 -8
  162. data/app/assets/images/teabag/photo-white.jpg +0 -0
  163. data/lib/generators/teabag/install/templates/spec_helper.js +0 -31
data/README.md CHANGED
@@ -5,11 +5,11 @@ Teabag
5
5
 
6
6
  Teabag is a Javascript test runner built on top of Rails. It can run tests in the browser, or headlessly using PhantomJS or with Selenium WebDriver.
7
7
 
8
- Ok, another Javascript test runner, right? Really? Yeah, that's tough, but we're pretty confident Teabag is one of the nicest you'll find at the moment. And if you disagree, you can swing by our offices in Denver and we'll buy you a beer if you're so inclined -- and probably fix whatever it is that you didn't like.
8
+ It's objective is to be the simplest, while also being the most complete Javascript testing solution for Rails. It takes full advantage of the asset pipeline and ships with support for Jasmine, Mocha and QUnit.
9
9
 
10
- The goal for Teabag is to be the simplest and most complete Javascript testing solution for Rails. Teabag takes full advantage of the asset pipeline and ships with support for Jasmine, Mocha and QUnit.
10
+ Ok, another Javascript test runner, right? Really? Yeah, that's tough, but we're pretty confident Teabag is one of the nicest you'll find at the moment. And if you disagree, you can swing by our offices in Denver and we'll buy you a beer if you're so inclined -- and probably fix whatever it is that you didn't like.
11
11
 
12
- Feedback, ideas and pull requests are always welcome, or you can hit us up [@modeset_](https://twitter.com/modeset_).
12
+ Feedback, ideas and pull requests are always welcome, or you can hit us up on Twitter [@modeset_](https://twitter.com/modeset_).
13
13
 
14
14
 
15
15
  ## Screenshots
@@ -27,15 +27,14 @@ Feedback, ideas and pull requests are always welcome, or you can hit us up [@mod
27
27
  ## Table of Contents
28
28
 
29
29
  1. [Installation](#installation)
30
- 2. [Quickstart](#quickstart)
31
- 3. [Usage](#usage)
32
- 4. [Writing Specs](#writing-specs)
33
- 5. [Fixtures](#fixtures)
34
- 6. [Suites](#suites)
35
- 7. [Configuration](#configuration)
36
- 8. [Test Frameworks](#test-frameworks)
37
- 9. [Support Libraries](#support-libraries)
38
- 10. [CI Support](#ci-support)
30
+ 2. [Usage](#usage)
31
+ 3. [Writing Specs](#writing-specs)
32
+ 4. [Fixtures](#fixtures)
33
+ 5. [Suites](#suites)
34
+ 6. [Configuration](#configuration)
35
+ 7. [Test Frameworks](#test-frameworks)
36
+ 8. [Support Libraries](#support-libraries)
37
+ 9. [CI Support](#ci-support)
39
38
 
40
39
  ## Installation
41
40
 
@@ -53,97 +52,69 @@ Optionally run the install generator to get the initializer and a basic spec hel
53
52
  rails generate teabag:install
54
53
  ```
55
54
 
56
- ## Quick Start
57
-
58
- 1. Create a new Rails app
59
- 2. Install Teabag and bootstrap it with the generator (`rails g teabag:install`)
60
- 3. Write your first spec (explained in a sec)
61
- 4. Run the test suite
62
- 5. red. green. refactor.
63
-
64
- ### Writing your first spec
65
-
66
- The install generator will create a `spec/javascripts` directory for you. Teabag will automatically pick up any specs written in that folder named `[classname]_spec.(js|coffee|js.coffee)`.
55
+ You can tell the generator which framework you want to use, if you want coffeescript spec helper files, and if you want the env file created (used by the command line interface).
67
56
 
68
- Let's write a basic implementation in CoffeeScript using Jasmine (you could just as easily use vanilla Javascript). Create a `spec/javascripts/calculator_spec.coffee` and put this in it:
57
+ ```
58
+ rails generate teabag:install --framework=mocha --coffee
59
+ ```
69
60
 
70
- ```coffeescript
71
- #= require calculator
72
- describe "Calculator", ->
73
61
 
74
- it "should add two digits", ->
75
- expect( new Calculator().add(2,2) ).toBe(4)
76
- ```
62
+ ## Usage
77
63
 
78
- Now let's create an `app/assets/javascripts/calculator.coffee` and add:
64
+ Teabag uses the Rails asset pipeline to serve files. This allows you to use `= require` in your test files, and allows you use things like HAML or RABL/JBuilder within your fixtures. You can run Teabag in three ways -- in the browser, via the rake task, and using the command line interface.
79
65
 
80
- ```coffeescript
81
- class @Calculator
82
- ```
66
+ Here's a great [Quick Start Walkthrough](https://github.com/modeset/teabag/wiki/Quick-Start-Walkthrough) for writing and running your first tests.
83
67
 
84
- Run `rake teabag` - you should see your first failing spec.
68
+ ### Browser
85
69
 
86
70
  ```
87
- Failures:
88
-
89
- 1) Calculator should add two numbers.
90
- Failure/Error: TypeError: 'undefined' is not a function
71
+ http://localhost:3000/teabag
91
72
  ```
92
73
 
93
- To make the test pass we just need to implement the `add` method.
74
+ ### Rake
94
75
 
95
- ```coffeescript
96
- add: (a, b) ->
97
- a + b
76
+ ```
77
+ rake teabag
98
78
  ```
99
79
 
100
- `rake teabag` again and that spec should be passing!
101
-
102
- If you'd prefer, you can also run your tests in the browser. Fire up your Rails server and visit [localhost:3000/teabag](http://localhost:3000/teabag) to run the specs in whichever browser you want.
103
-
104
-
105
- ## Usage
106
-
107
- Teabag uses the Rails asset pipeline to serve files. This simplifies the fixtures as well and lets you use things like HAML or RABL/JBuilder to generate your fixtures.
108
-
109
- ### Browser
80
+ Specify the suite by using:
110
81
 
111
82
  ```
112
- http://localhost:3000/teabag
83
+ rake teabag suite=my_fantastic_suite
113
84
  ```
114
85
 
115
- To run a specific suite use:
86
+ ### CLI
87
+
88
+ The command line interface requires a teabag_env.rb file that you can get by running the generator. This file is used to load the Rails environment so Teabag can run within the context of Rails.
116
89
 
117
90
  ```
118
- http://localhost:3000/teabag/my_fantastic_suite
91
+ bundle exec teabag
119
92
  ```
120
93
 
121
- ### Console
94
+ Specify the suite by using:
122
95
 
123
96
  ```
124
- rake teabag
97
+ bundle exec teabag --suite=my_fantastic_suite
125
98
  ```
126
99
 
127
- Specify the suite by using:
100
+ Get full command line help:
128
101
 
129
102
  ```
130
- rake teabag suite=my_fantastic_suite
103
+ bundle exec teabag --help
131
104
  ```
132
105
 
133
- You can override some configurations by using environment variables. `FAIL_FAST=[true/false]`, `SUPPRESS_LOGS=[false/true]`, `FORMATTERS=tap_y`, and `DRIVER=selenium` (read more about [configuration](#configuration) below.)
134
-
135
106
  Teabag also has support for [tapout](https://github.com/rubyworks/tapout). Use the tap_y formatter and pipe the results to tapout to use any of the reporters that tapout provides.
136
107
 
137
108
  ```
138
- rake teabag SUPPRESS_LOG=true FORMATTERS=tap_y | tapout progress
109
+ bundle exec teabag -q --format=tap_y | tapout progress
139
110
  ```
140
111
 
141
- **Note:** By default the rake task runs within the development environment, but you can specify the environment using `RAILS_ENV=test rake teabag`. This is to stay consistent with what you might see in the browser (since that's likely running in development).
112
+ **Note:** By default the rake task and command line interface run within the development environment, but you can specify the environment using `RAILS_ENV=test rake teabag`. This is to stay consistent with what you might see in the browser (since that's likely running in development).
142
113
 
143
114
 
144
115
  ## Writing Specs
145
116
 
146
- Depending on what framework you use this can be slightly different. There's an expectation that you have a certain level of familiarity with the test framework that you're using. Right now we support [Jasmine](http://pivotal.github.com/jasmine), [Mocha](http://visionmedia.github.com/mocha) and [QUnit](http://qunitjs.com).
117
+ Depending on what framework you use this can be slightly different. There's an expectation that you have a certain level of familiarity with the test framework that you're using. Right now Teabag supports [Jasmine](http://pivotal.github.com/jasmine), [Mocha](http://visionmedia.github.com/mocha) and [QUnit](http://qunitjs.com).
147
118
 
148
119
  Since we have the asset pipeline at our fingertips you can feel free to use the `= require` directive throughout your specs and spec helpers.
149
120
 
@@ -165,9 +136,9 @@ Check out examples of a [Mocha Spec](https://github.com/modeset/teabag/wiki/Usin
165
136
 
166
137
  ### Pending Specs
167
138
 
168
- We've normalized declaring that a spec is pending between Mocha and Jasmine. Since Jasmine lacks the concept we've added it in, and since Mocha has several ways to accomplish it we thought it would be worth mentioning what we consider the standard between the two to be.
139
+ We've normalized declaring that a spec is pending between Mocha and Jasmine. Since Jasmine lacks the concept we've added it in, and since Mocha has several ways to accomplish it we thought it would be worth mentioning what we consider the standard between the two to be. QUnit doesn't support specifying a test as pending.
169
140
 
170
- To mark a spec as pending you can either not provide a function as the second argument to `it`, or you can use `xit` and `xdescribe`. Mocha provides some additional ways to accomplish this, but to keep it consistent we've normalized on what they both support.
141
+ To mark a spec as pending you can either not provide a function as the second argument to `it`, or you can use `xit` and `xdescribe`. Mocha provides some additional ways to accomplish this, but to keep it consistent we've normalized on what they both support.
171
142
 
172
143
  ```coffeescript
173
144
  describe "My great feature", ->
@@ -183,24 +154,23 @@ describe "My great feature", ->
183
154
  expect(true).to.be(false)
184
155
  ```
185
156
 
186
- If you're using a specific framework and you want to take advantage of the things that framework provides you're free to do so. This is provided as the standard as the Teabag reporters understand the techniques above and have specs for them. QUnit doesn't support specifying a test as pending.
157
+ If you're using a specific framework and you want to take advantage of the things that framework provides you're free to do so. This is provided as the standard as the Teabag reporters understand the techniques above and have specs for them.
187
158
 
188
159
  ### Deferring Execution
189
160
 
190
161
  Teabag allows deferring execution in the cases when you're using AMD or other asynchronous libraries. This is especially useful if you're using [CommonJS](http://www.commonjs.org/) or [RequireJS](http://requirejs.org/), etc. You can tell Teabag to defer and then execute the runner yourself later -- after loading asychronously.
191
162
 
192
- ```coffeescript
163
+ ```javascript
193
164
  Teabag.defer = true
194
- setTimeout(Teabag.execute, 1000) # defers execution for 1 second
165
+ setTimeout(Teabag.execute, 1000) // defers execution for 1 second
195
166
  ```
196
167
 
197
168
 
198
169
  ## Fixtures
199
170
 
200
- You're free to use your own fixture library (like jasmine-jquery, which we've included as a support library), but Teabag ships with a fixture library that works with Mocha, Jasmine, and QUnit with a minimum of effort and a nice API.
201
-
202
- The fixture path is configurable within Teabag, and the views will be rendered by a standard controller. This allows you to use things like RABL/JBuilder if you're building JSON, or HAML if you're building markup. The element that Teabag creates is "#teabag-fixtures", in case you need to access it directly.
171
+ You're free to use your own fixture library (like jasmine-jquery, which we've included as a support library), but Teabag ships with a fixture library that works with Jasmine, Mocha, and QUnit with a minimum of effort and a nice consistent API.
203
172
 
173
+ The fixture path is configurable within Teabag, and the views will be rendered by a standard controller. This allows you to use things like RABL/JBuilder if you're building JSON, or HAML if you're building markup. The element that Teabag creates is "#teabag-fixtures", in case you need to access it directly -- or you can access it via `fixture.el` after loading fixtures.
204
174
 
205
175
  ### Loading Files
206
176
 
@@ -271,7 +241,7 @@ end
271
241
 
272
242
  ### Manifest Style
273
243
 
274
- Teabag is happy to look for files for you, but you can disable this feature and maintain a manifest yourself. Each suite can utilize a different spec helper and you can use these to create your own manifest using the `= require` directive.
244
+ Teabag is happy to look for files for you, but you can disable this feature and maintain a manifest yourself. Each suite can utilize a different spec helper and you can use these to create your own manifest using the `= require` directive. This limits your abilities to run specific files from the command line interface, but it's available if you want to use it.
275
245
 
276
246
  Tell the suite that you don't want it to match any files, and then require files in your spec helper.
277
247
 
@@ -292,7 +262,6 @@ You can specify a file matcher and all matching files will be loaded when the su
292
262
 
293
263
  **default:** `"{spec/javascripts,app/assets}/**/*_spec.{js,js.coffee,coffee}"`
294
264
 
295
-
296
265
  #### `helper`
297
266
 
298
267
  Each suite can load a different spec helper, which can in turn require additional files. This file is loaded before your specs are loaded, and can be used as a manifest.
@@ -303,7 +272,7 @@ Each suite can load a different spec helper, which can in turn require additiona
303
272
 
304
273
  These are the core Teabag javascripts. It's strongly encouraged to include only the base files here. You can require other support libraries in your spec helper, which allows you to change them without having to restart the server.
305
274
 
306
- Available frameworks: teabag-jasmine, teabag-mocha, teabag-qunit
275
+ Available: teabag-jasmine, teabag-mocha, teabag-qunit
307
276
 
308
277
  **Note:** To use the CoffeeScript source files use `"teabag/jasmine"` etc.
309
278
 
@@ -318,7 +287,7 @@ If you want to change how Teabag looks, or include your own stylesheets you can
318
287
 
319
288
  ## Configuration
320
289
 
321
- The best way to read about the configuration options is to generate the initializer, but we've included the info here too.
290
+ The best way to read about the configuration options is to generate the initializer and env, but we've included the info here as well.
322
291
 
323
292
  **Note:** `Teabag.setup` may not be available in all environments. The generator provides a check wrapped around Teabag.setup.
324
293
 
@@ -346,48 +315,68 @@ Fixtures are rendered through a standard controller. This means you can use thin
346
315
 
347
316
  **default:** `"spec/javascripts/fixtures"`
348
317
 
349
- #### `server_timeout`
350
-
351
- Timeout for starting the server in seconds. If your server is slow to start you may have to bump this, or you may want to lower this if you know it shouldn't take long to start.
318
+ ### Console Runner Specific
352
319
 
353
- **default:** `20`
320
+ These configuration directives are applicable only when running via the rake task or command line interface and should be set within the teabag_env.rb file. You can get this file by running the generator.
354
321
 
355
322
  #### `driver`
356
323
 
357
- Allows you to specify which driver you want to run your specs with -- Supports [PhantomJS](http://phantomjs.org/) and [Selenium Webdriver](http://seleniumhq.org/docs/03_webdriver.jsp). Check the wiki for more information about [Using Selenium WebDriver](https://github.com/modeset/teabag/wiki/Using-Selenium-WebDriver), and this one if you're having issues with [PhantomJS on Linux](https://github.com/modeset/teabag/wiki/PhantomJS-on-Linux).
324
+ Allows you to specify which driver you want to run your specs with -- Supports [PhantomJS](http://phantomjs.org/) and [Selenium Webdriver](http://seleniumhq.org/docs/03_webdriver.jsp). Check this wiki article for information about [Using Selenium WebDriver](https://github.com/modeset/teabag/wiki/Using-Selenium-WebDriver), and this one if you're having issues with [PhantomJS on Linux](https://github.com/modeset/teabag/wiki/PhantomJS-on-Linux).
358
325
 
359
- Supported drivers: phantomjs, selenium
326
+ Available: phantomjs, selenium
360
327
 
361
- **Note:** Override this directive by running `rake teabag DRIVER=selenium`.
328
+ - CLI: -d, --driver DRIVER
329
+ - ENV: DRIVER=selenium
362
330
 
363
331
  **default:** `"phantomjs"`
364
332
 
365
- #### `formatters`
366
-
367
- You can specify the formatters that Teabag will use when outputting the results.
333
+ #### `server_timeout`
368
334
 
369
- Supported formatters: dot, tap_y, swayze_or_oprah
335
+ Timeout for starting the server in seconds. If your server is slow to start you may have to bump this, or you may want to lower this if you know it shouldn't take long to start.
370
336
 
371
- **Note:** Override this directive by running `rake teabag FORMATTERS=dot,swayze_or_oprah`.
337
+ - CLI: --server-timeout SECONDS
338
+ - ENV: SERVER_TIMEOUT=10
372
339
 
373
- **default:** `"dot"`
340
+ **default:** `20`
374
341
 
375
342
  #### `fail_fast`
376
343
 
377
344
  If you have several suites it can be useful to make Teabag fail directly after any suite contains failures, but in environments like CI this may not be desirable.
378
345
 
379
- **Note:** Override this directive by running `rake teabag FAIL_FAST=false`
346
+ - CLI: --[no-]fail-fast
347
+ - ENV: FAIL_FAST=false
380
348
 
381
349
  **default:** `true`
382
350
 
351
+ #### `formatters`
352
+
353
+ You can specify the formatters that Teabag will use when outputting the results.
354
+
355
+ Supported formatters: dot, tap_y, swayze_or_oprah
356
+
357
+ - CLI: -f, --format FORMATTERS
358
+ - ENV: FORMATTERS=dot,swayze_or_oprah
359
+
360
+ **default:** `"dot"`
361
+
383
362
  #### `suppress_log`
384
363
 
385
364
  Teabag pipes all console[log/debug/error] calls to STDOUT. This is useful to catch places where you've forgotten to remove them, but in verbose applications this may not be desirable.
386
365
 
387
- **Note:** Override this directive by running `rake teabag SUPPRESS_LOG=true`
366
+ - CLI: -q, --[no-]suppress-log
367
+ - ENV: SUPPRESS_LOG=true
388
368
 
389
369
  **default:** `false`
390
370
 
371
+ #### `color`
372
+
373
+ Specify if you want color output by default.
374
+
375
+ - CLI: --[no-]color
376
+ - ENV: COLOR=false
377
+
378
+ **default:** `true`
379
+
391
380
 
392
381
  ## Test Frameworks
393
382
 
@@ -432,3 +421,5 @@ All licenses for the [bundled Javascript libraries](https://github.com/modeset/t
432
421
 
433
422
 
434
423
  ## Make Code Not War
424
+ ![crest](https://secure.gravatar.com/avatar/aa8ea677b07f626479fd280049b0e19f?s=75)
425
+
@@ -3200,7 +3200,7 @@ jasmine.version_= {
3200
3200
  if (Teabag.Reporters.HTML.RadialProgressView.supported) {
3201
3201
  return new Teabag.Reporters.HTML.RadialProgressView();
3202
3202
  } else {
3203
- return Teabag.Reporters.HTML.SimpleProgressView();
3203
+ return new Teabag.Reporters.HTML.SimpleProgressView();
3204
3204
  }
3205
3205
  };
3206
3206
 
@@ -3502,6 +3502,9 @@ jasmine.version_= {
3502
3502
  var result;
3503
3503
  this.spec = new Teabag.Spec(spec);
3504
3504
  result = this.spec.result();
3505
+ if (result.skipped) {
3506
+ return;
3507
+ }
3505
3508
  this.reportSuites();
3506
3509
  switch (result.status) {
3507
3510
  case "pending":
@@ -3544,7 +3547,7 @@ jasmine.version_= {
3544
3547
  label: this.spec.description,
3545
3548
  status: result.status,
3546
3549
  skipped: result.skipped,
3547
- link: this.spec.link,
3550
+ link: this.spec.fullDescription,
3548
3551
  message: error.message,
3549
3552
  trace: error.stack || error.message || "Stack Trace Unavailable"
3550
3553
  }));
@@ -5611,7 +5611,7 @@
5611
5611
  if (Teabag.Reporters.HTML.RadialProgressView.supported) {
5612
5612
  return new Teabag.Reporters.HTML.RadialProgressView();
5613
5613
  } else {
5614
- return Teabag.Reporters.HTML.SimpleProgressView();
5614
+ return new Teabag.Reporters.HTML.SimpleProgressView();
5615
5615
  }
5616
5616
  };
5617
5617
 
@@ -5913,6 +5913,9 @@
5913
5913
  var result;
5914
5914
  this.spec = new Teabag.Spec(spec);
5915
5915
  result = this.spec.result();
5916
+ if (result.skipped) {
5917
+ return;
5918
+ }
5916
5919
  this.reportSuites();
5917
5920
  switch (result.status) {
5918
5921
  case "pending":
@@ -5955,7 +5958,7 @@
5955
5958
  label: this.spec.description,
5956
5959
  status: result.status,
5957
5960
  skipped: result.skipped,
5958
- link: this.spec.link,
5961
+ link: this.spec.fullDescription,
5959
5962
  message: error.message,
5960
5963
  trace: error.stack || error.message || "Stack Trace Unavailable"
5961
5964
  }));
@@ -2576,7 +2576,7 @@
2576
2576
  if (Teabag.Reporters.HTML.RadialProgressView.supported) {
2577
2577
  return new Teabag.Reporters.HTML.RadialProgressView();
2578
2578
  } else {
2579
- return Teabag.Reporters.HTML.SimpleProgressView();
2579
+ return new Teabag.Reporters.HTML.SimpleProgressView();
2580
2580
  }
2581
2581
  };
2582
2582
 
@@ -2878,6 +2878,9 @@
2878
2878
  var result;
2879
2879
  this.spec = new Teabag.Spec(spec);
2880
2880
  result = this.spec.result();
2881
+ if (result.skipped) {
2882
+ return;
2883
+ }
2881
2884
  this.reportSuites();
2882
2885
  switch (result.status) {
2883
2886
  case "pending":
@@ -2920,7 +2923,7 @@
2920
2923
  label: this.spec.description,
2921
2924
  status: result.status,
2922
2925
  skipped: result.skipped,
2923
- link: this.spec.link,
2926
+ link: this.spec.fullDescription,
2924
2927
  message: error.message,
2925
2928
  trace: error.stack || error.message || "Stack Trace Unavailable"
2926
2929
  }));
@@ -25,6 +25,7 @@ class Teabag.Reporters.Console
25
25
  reportSpecResults: (spec) ->
26
26
  @spec = new Teabag.Spec(spec)
27
27
  result = @spec.result()
28
+ return if result.skipped
28
29
  @reportSuites()
29
30
  switch result.status
30
31
  when "pending" then @trackPending()
@@ -57,7 +58,7 @@ class Teabag.Reporters.Console
57
58
  label: @spec.description
58
59
  status: result.status
59
60
  skipped: result.skipped
60
- link: @spec.link
61
+ link: @spec.fullDescription
61
62
  message: error.message
62
63
  trace: error.stack || error.message || "Stack Trace Unavailable"
63
64
 
@@ -5,7 +5,7 @@ class Teabag.Reporters.HTML.ProgressView extends Teabag.Reporters.BaseView
5
5
  if Teabag.Reporters.HTML.RadialProgressView.supported
6
6
  new Teabag.Reporters.HTML.RadialProgressView()
7
7
  else
8
- Teabag.Reporters.HTML.SimpleProgressView()
8
+ new Teabag.Reporters.HTML.SimpleProgressView()
9
9
 
10
10
 
11
11
  build: ->
@@ -4,11 +4,11 @@ class Teabag::SpecController < ActionController::Base
4
4
  layout false
5
5
 
6
6
  unless Rails.application.config.assets.debug
7
- rescue_from Teabag::AssetNotServable, with: :javascript_exception
7
+ rescue_from Exception, with: :javascript_exception
8
8
  end
9
9
 
10
10
  def index
11
- @suite = Teabag::Suite.new(params[:suite])
11
+ @suite = Teabag::Suite.new(params)
12
12
  end
13
13
 
14
14
  def fixtures