test_squad 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +28 -8
  3. data/Rakefile +1 -0
  4. data/lib/generators/test_squad/install/install_generator.rb +92 -62
  5. data/lib/generators/test_squad/install/templates/test_squad.rb.erb +24 -1
  6. data/lib/tasks/test_squad_tasks.rake +7 -35
  7. data/lib/test_squad.rb +8 -7
  8. data/lib/test_squad/configuration.rb +65 -0
  9. data/lib/test_squad/runner.rb +58 -0
  10. data/lib/test_squad/version.rb +1 -1
  11. data/phantomjs/helpers.js +8 -1
  12. data/phantomjs/runner.js +39 -13
  13. data/test/controllers/test_squad_controller_test.rb +50 -0
  14. data/test/dummy/log/test.log +2161 -0
  15. data/test/dummy/tmp/cache/assets/sprockets/v3.0/--Jr18gSi0dWQfX8IpGoxIeyt0ar6Z4qNtYBzt5o_U0.cache +1 -0
  16. data/test/dummy/tmp/cache/assets/sprockets/v3.0/15vEz7HBqhg9JjDp9KyF_iFJ9DOccQCaj2XecY7ENdw.cache +0 -0
  17. data/test/dummy/tmp/cache/assets/sprockets/v3.0/1bShYtup0I7zDOa8whDdypfQEZxH4rVEVKmz8aeDuS0.cache +2 -0
  18. data/test/dummy/tmp/cache/assets/sprockets/v3.0/1fidLos4TsMC1Jzat66F4EuJMnvA4Ek4Yq3Wx_diqLA.cache +2 -0
  19. data/test/dummy/tmp/cache/assets/sprockets/v3.0/1p035rqBDJG2S9jFXm8UVt4XiETe3l4TsAshRjkfgJU.cache +2 -0
  20. data/test/dummy/tmp/cache/assets/sprockets/v3.0/28dNMvxD5YFKVJdljn6gcuwnJaQGlzKN1B_uJwfpWAQ.cache +1 -0
  21. data/test/dummy/tmp/cache/assets/sprockets/v3.0/48aEVfcYY6MwkyeeyUtk-udKX4sVI6wCzCoGdcrXoHE.cache +0 -0
  22. data/test/dummy/tmp/cache/assets/sprockets/v3.0/4oXbqlOtQXa7YIXA7S4jJT8mAZdpoSJ2oX9kXMr9Ouw.cache +3 -0
  23. data/test/dummy/tmp/cache/assets/sprockets/v3.0/5BbgAT98H6HVF2DtEaZeL3jSwsvFzHkl6-vwuQ1UoGQ.cache +3 -0
  24. data/test/dummy/tmp/cache/assets/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +2 -0
  25. data/test/dummy/tmp/cache/assets/sprockets/v3.0/6Y-2fFELXy514cZ-fXlvcoKlvvCMCHgIZ_Q06PZoMsg.cache +0 -0
  26. data/test/dummy/tmp/cache/assets/sprockets/v3.0/7yaZL2RIxe_zCwIWBeGtIKMbQQcvZU1Rvt1sfZGpAcY.cache +1 -0
  27. data/test/dummy/tmp/cache/assets/sprockets/v3.0/BNfX-jq9S00e7dFjTRaWBt2BNThtsO0_vKQiBGYmus8.cache +1 -0
  28. data/test/dummy/tmp/cache/assets/sprockets/v3.0/BT2K9suBmG7JzM_3FoJ5mpH8wti3_Phlsl7X-8nut_A.cache +0 -0
  29. data/test/dummy/tmp/cache/assets/sprockets/v3.0/BY7dYj9QBZDvgqyzjw19Cs4S7rhvgaB6Tx-3ByAfR1o.cache +1 -0
  30. data/test/dummy/tmp/cache/assets/sprockets/v3.0/BkUiqZe-edco2CWEnwq71RR7OlncirMqtHSAXxRiS58.cache +1 -0
  31. data/test/dummy/tmp/cache/assets/sprockets/v3.0/CI3wmSM2mvTHVtxrm8aAXPicSU_UPT54tEsOxoL8674.cache +1 -0
  32. data/test/dummy/tmp/cache/assets/sprockets/v3.0/CcqHY0ztO4n-nBK-XGEP6h0DrL6x2A0G_MXIYfLdOAc.cache +0 -0
  33. data/test/dummy/tmp/cache/assets/sprockets/v3.0/DOjJwX_4kbLug1vCo5qKu8WhGWrlS3CO5ueJcLwHAiw.cache +1 -0
  34. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Dj11DIpk6AMooko4HIrIRLle_Pku6Z3wm6JGkv6tQhY.cache +0 -0
  35. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Dld2HJ_h197OmHkWuEk-msUaZ5dF27-KHGDNE37nJ94.cache +4 -0
  36. data/test/dummy/tmp/cache/assets/sprockets/v3.0/DnkprrM0pXn0tWZjZQUbxw9czuz9Eqc3qXokFvQPADk.cache +1 -0
  37. data/test/dummy/tmp/cache/assets/sprockets/v3.0/EvacufxhwsfPRuHbaKUtaE49aNAI6zySGzBX6QZ46fU.cache +1 -0
  38. data/test/dummy/tmp/cache/assets/sprockets/v3.0/FXjOrhU0u21QlvjYFb8z9MZGZc39etPqywbESQ0wYWI.cache +1 -0
  39. data/test/dummy/tmp/cache/assets/sprockets/v3.0/JlEfkGFQp4-hMkyCydaWpBH-k7TRHDnWVO4UICTABdE.cache +0 -0
  40. data/test/dummy/tmp/cache/assets/sprockets/v3.0/JuyiNe16-3iPuyN77g0yLMm0Q4Yha01pWdNSfnYVfNE.cache +0 -0
  41. data/test/dummy/tmp/cache/assets/sprockets/v3.0/JylXKmnNAPjfcYjj1jraIxmw8aRPbZ3LoWTzewaMHPU.cache +1 -0
  42. data/test/dummy/tmp/cache/assets/sprockets/v3.0/MK8k0x0C6Wxn0o4iqysgqSy-vz5Ol5PWtsPh2uT8aRE.cache +1 -0
  43. data/test/dummy/tmp/cache/assets/sprockets/v3.0/N8yUPpqki-1jUIftlMUzksb-3ImtAXdo0HK0yogXp98.cache +0 -0
  44. data/test/dummy/tmp/cache/assets/sprockets/v3.0/NBnLLGZS0L0-K0XDp8wPfKEbULh0IdSnEnq5My6uLsg.cache +1 -0
  45. data/test/dummy/tmp/cache/assets/sprockets/v3.0/NYqEn9nriI_u_tmIhqigPcBG-xaL_4DNAXcZZedduxo.cache +1 -0
  46. data/test/dummy/tmp/cache/assets/sprockets/v3.0/NiaLRSbNa312S2yLs6OK99DsCk-OK5_WVSP5vlohbrU.cache +0 -0
  47. data/test/dummy/tmp/cache/assets/sprockets/v3.0/O8AdQ9KuR_WslT3OMU_CB_XmZPkD3koya8_y3D1vQSg.cache +1 -0
  48. data/test/dummy/tmp/cache/assets/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +2 -0
  49. data/test/dummy/tmp/cache/assets/sprockets/v3.0/OOE0vr9ZxtP3cSlMNmlKreGc5OdJjjZeAulus5KkgWg.cache +0 -0
  50. data/test/dummy/tmp/cache/assets/sprockets/v3.0/SVj7Xea5NdHsDZVgKDO33zwoRmPu8dsPEPUc--ZoSBA.cache +3 -0
  51. data/test/dummy/tmp/cache/assets/sprockets/v3.0/UWG7vqp9QHDXQ8K7rWHxSLtTJjgpwAXa0VQeMC79S9c.cache +3 -0
  52. data/test/dummy/tmp/cache/assets/sprockets/v3.0/UYzP9BM42aDQbQL2Hwzu7E_VjzmKRMEDUMn_YNwYJZQ.cache +0 -0
  53. data/test/dummy/tmp/cache/assets/sprockets/v3.0/V04j3gLzI35tOG8HB1FQnZC0FkgXNiVo6CFAKe-vm08.cache +0 -0
  54. data/test/dummy/tmp/cache/assets/sprockets/v3.0/W90wLqYLEL21UhoMzunmDZagcl_J-waowL_syTXFTfg.cache +2 -0
  55. data/test/dummy/tmp/cache/assets/sprockets/v3.0/WRplQSvSLBRFE4SnNgUTaqjaD6QcugFgemVGJl-TcH0.cache +3 -0
  56. data/test/dummy/tmp/cache/assets/sprockets/v3.0/XZHJ4q_Vqm8z67XoLCSR9Bf3bxRrNVgxY-Zn2Dl1_oc.cache +2 -0
  57. data/test/dummy/tmp/cache/assets/sprockets/v3.0/ZpLasZgWCtI5ARba6j0TztDVBfvefbN_VeEm6WS4AlE.cache +1 -0
  58. data/test/dummy/tmp/cache/assets/sprockets/v3.0/_ml2aIb-f7tzJpo9MTCAldaDVHqHn89WTB9ZmCoAVHI.cache +0 -0
  59. data/test/dummy/tmp/cache/assets/sprockets/v3.0/bakkhKWQav5zpy-VjOssp_XTDY4mccVjeCQjmTWcvEQ.cache +1 -0
  60. data/test/dummy/tmp/cache/assets/sprockets/v3.0/bqgbepkpHrkLsvcws1h6NEku20i6s1HNfRwUf3ds_bM.cache +1 -0
  61. data/test/dummy/tmp/cache/assets/sprockets/v3.0/btifyRUVKrnuNOyCfHPRBE_b4IHXPAs-gwaNEtZNqR4.cache +2 -0
  62. data/test/dummy/tmp/cache/assets/sprockets/v3.0/eBHGAOFSIHdU3R6gC__U1b2OtNaMsdZ8M6kKd6rX3uA.cache +1 -0
  63. data/test/dummy/tmp/cache/assets/sprockets/v3.0/ez1f_nTzpCVZp99l-TSKf5mnDr-FNT0AuA40By6h7nU.cache +3 -0
  64. data/test/dummy/tmp/cache/assets/sprockets/v3.0/fOMwhE_LoK6PBz43rr86imRHqStpfn-j0zKwNCEFA7A.cache +2 -0
  65. data/test/dummy/tmp/cache/assets/sprockets/v3.0/fk0Xn9aqGZauDCUL4PDM1A0riiRU3nTGEF8T0tfVi9Q.cache +3 -0
  66. data/test/dummy/tmp/cache/assets/sprockets/v3.0/g6PEU0mrTD1F_JY1UnmLjn6OD29tp6XAa7CRxtbnssU.cache +1 -0
  67. data/test/dummy/tmp/cache/assets/sprockets/v3.0/k9vjsOgT-S2u8LSPksFS2VZO5JJYQB1kOSOfkmBmncA.cache +1 -0
  68. data/test/dummy/tmp/cache/assets/sprockets/v3.0/kB1DR3T5YiVkiJ5JQAjwNFNLjKoCrBWbjHzmUWQxwuE.cache +1 -0
  69. data/test/dummy/tmp/cache/assets/sprockets/v3.0/l-Fy5bdFTh-kc8fFcJaPEiIprPT_Zro3btmmfaOSFGk.cache +3 -0
  70. data/test/dummy/tmp/cache/assets/sprockets/v3.0/lk8cNS9qlZOFztN2ZtkUuLMG5il9UFV_6L9mzl0gJgs.cache +1 -0
  71. data/test/dummy/tmp/cache/assets/sprockets/v3.0/lurwEsNalR_pkE6uX047tDOvODA4-5i3gDIrHi_4sWU.cache +1 -0
  72. data/test/dummy/tmp/cache/assets/sprockets/v3.0/m4xIJn-Zz18i6rjvKkARjTE_Ogb7Y33Z1d1dkpwjIqc.cache +2 -0
  73. data/test/dummy/tmp/cache/assets/sprockets/v3.0/mwqO_5fkZLqyQ6yJZPYvfEasJmaJTDBUxg0WMRs1qb8.cache +0 -0
  74. data/test/dummy/tmp/cache/assets/sprockets/v3.0/nv2dwJTpEmjPq5nrQ5gYwOUkAdhKxPmwxfhzuIGq9tc.cache +0 -0
  75. data/test/dummy/tmp/cache/assets/sprockets/v3.0/o_4WHxITiPaOrX75j567d0VpQJ3ibKEfwp5kLyz0g6I.cache +2 -0
  76. data/test/dummy/tmp/cache/assets/sprockets/v3.0/pH8BdTuZBGfdsHebnGCXW4xKlDq20EJYTXXWDQ4pwF8.cache +2 -0
  77. data/test/dummy/tmp/cache/assets/sprockets/v3.0/pfueHOXdqh2SVlAKfvEFrdhOpobUofsH-rxLMv9HeAo.cache +1 -0
  78. data/test/dummy/tmp/cache/assets/sprockets/v3.0/qGl34xE7nyT_5bv_0LdftjhOhWqeaUsSD8RRR5e2LhE.cache +1 -0
  79. data/test/dummy/tmp/cache/assets/sprockets/v3.0/r16KTswcSzCfPAeYpPsI3pB60v7bXkXdzIC9F0depbo.cache +3 -0
  80. data/test/dummy/tmp/cache/assets/sprockets/v3.0/s1qM0DtayvbvOieVFIeEejbL_uzBbLhdJt4J-eDdfVs.cache +0 -0
  81. data/test/dummy/tmp/cache/assets/sprockets/v3.0/sKmQ0vmdki8bEnqnNv5R6SxInKZ3wr6OYKZso5pK3A8.cache +1 -0
  82. data/test/dummy/tmp/cache/assets/sprockets/v3.0/t3Llqx0uA6Qvi3W3tzxEvd6vCx1bNDEaOx3cv3jk7F8.cache +2 -0
  83. data/test/dummy/tmp/cache/assets/sprockets/v3.0/t4CSlKWlnNjWc4HjzVuGu_xkGPJrf2XDT_z36WqPW10.cache +0 -0
  84. data/test/dummy/tmp/cache/assets/sprockets/v3.0/tTT_rRtFLpee6FOwJBDH0h8tFNayUZozM9CRDjxh_0M.cache +0 -0
  85. data/test/dummy/tmp/cache/assets/sprockets/v3.0/uEbg-8OHCY_n1CRoUJ1NxO7ZA25rem-WvK_BMk9nzmA.cache +3 -0
  86. data/test/dummy/tmp/cache/assets/sprockets/v3.0/uhmMX7shFPI0NOePr7b3mCW2lOWT4osZ3sovJVlPyek.cache +1 -0
  87. data/test/dummy/tmp/cache/assets/sprockets/v3.0/vRHlJJvzk-cVDuhS4H0cS0JQ4XQxPvzCLHSuDSsBABY.cache +0 -0
  88. data/test/dummy/tmp/cache/assets/sprockets/v3.0/xqI5M8GTfQOT1WzlvBIaK6SBF84-BkQ162gE8xJibGY.cache +1 -0
  89. data/test/dummy/tmp/cache/assets/sprockets/v3.0/y1-icrLhuhHxxsTl1oMCwvaQljaPTUg8pGKp4ktBmHk.cache +0 -0
  90. data/test/dummy/tmp/cache/assets/sprockets/v3.0/yLDP63LRuXDtsRtf-U1w7iwCLO6TN0XaagOFr7ZMgJc.cache +3 -0
  91. data/test/dummy/tmp/cache/assets/test/sprockets/01201a5597c67fa4700f373e24e47cc0 +0 -0
  92. data/test/dummy/tmp/cache/assets/test/sprockets/087c6a74e34024016056782770f67751 +0 -0
  93. data/test/dummy/tmp/cache/assets/test/sprockets/0e0ce4a8684bd87eafc0db448ee74990 +0 -0
  94. data/test/dummy/tmp/cache/assets/test/sprockets/0e6aec2a845fd340ec76abec275415f8 +0 -0
  95. data/test/dummy/tmp/cache/assets/test/sprockets/13096efe03b0d8f02b0f492ee46f8498 +0 -0
  96. data/test/dummy/tmp/cache/assets/test/sprockets/21822855ec5066372f2708fcc72bc18a +0 -0
  97. data/test/dummy/tmp/cache/assets/test/sprockets/29369685706447987989cf495e746507 +0 -0
  98. data/test/dummy/tmp/cache/assets/test/sprockets/32e8c6b5f20fbc62c2c377ce3fd7d093 +0 -0
  99. data/test/dummy/tmp/cache/assets/test/sprockets/42b2a14b671c8f56aa1808a5ba8599e3 +0 -0
  100. data/test/dummy/tmp/cache/assets/test/sprockets/5254c3aa24743307528db89892e34ce7 +0 -0
  101. data/test/dummy/tmp/cache/assets/test/sprockets/54aa66a560f82535d5aff8761aa61689 +0 -0
  102. data/test/dummy/tmp/cache/assets/test/sprockets/55edadf6cfe27ddb6130791f7cb794c2 +0 -0
  103. data/test/dummy/tmp/cache/assets/test/sprockets/5b781f9fca11e70f837e07e3e9446a2d +0 -0
  104. data/test/dummy/tmp/cache/assets/test/sprockets/60323fc3606b2c2ae59ff65886e957ef +0 -0
  105. data/test/dummy/tmp/cache/assets/test/sprockets/63196e522f128686f2b1873406c06638 +0 -0
  106. data/test/dummy/tmp/cache/assets/test/sprockets/6d0f2dbd46d4ae67621d5544e74f789a +0 -0
  107. data/test/dummy/tmp/cache/assets/test/sprockets/6e05ee0c7bd8a56e0aa68e9981b874c4 +0 -0
  108. data/test/dummy/tmp/cache/assets/test/sprockets/7874191c45ca716229829e331bbb6657 +0 -0
  109. data/test/dummy/tmp/cache/assets/test/sprockets/7faca529de077394ba9cccf0f936bad1 +0 -0
  110. data/test/dummy/tmp/cache/assets/test/sprockets/98ad9eb574ed821f48f81b41bcd9639f +0 -0
  111. data/test/dummy/tmp/cache/assets/test/sprockets/991ff1c9e66557b891934a625e493439 +0 -0
  112. data/test/dummy/tmp/cache/assets/test/sprockets/9e0d5d4b56b478a2801215373bac8932 +0 -0
  113. data/test/dummy/tmp/cache/assets/test/sprockets/c95208cba67d830cebbbcb8c049d45d1 +0 -0
  114. data/test/dummy/tmp/cache/assets/test/sprockets/c9bd74b86a038dcdd4436a8dcf03041c +0 -0
  115. data/test/dummy/tmp/cache/assets/test/sprockets/cf932323f346664ed0c3dd4af9a426f3 +0 -0
  116. data/test/dummy/tmp/cache/assets/test/sprockets/ec868f5486b890ab315724a887be51fc +0 -0
  117. data/test/dummy/tmp/generators/Gemfile +8 -0
  118. data/test/dummy/tmp/generators/test/javascript/dummy/answer_spec.js +6 -0
  119. data/test/dummy/tmp/generators/test/javascript/spec_helper.js +12 -0
  120. data/test/dummy/tmp/generators/test/javascript/test_squad.rb +28 -0
  121. data/test/lib/generators/test_squad/install_generator/ember_test.rb +48 -0
  122. data/test/lib/generators/test_squad/install_generator/jasmine_test.rb +44 -0
  123. data/test/lib/generators/test_squad/install_generator/mocha_test.rb +45 -0
  124. data/test/lib/generators/test_squad/install_generator/qunit_test.rb +44 -0
  125. data/test/lib/generators/test_squad/install_generator_test.rb +40 -0
  126. data/test/lib/test_squad/configuration_test.rb +68 -0
  127. data/test/lib/test_squad/runner_test.rb +66 -0
  128. data/test/test_helper.rb +10 -2
  129. data/test/test_squad_test.rb +1 -1
  130. data/vendor/assets/libs/jasmine/boot.js +2 -1
  131. data/vendor/assets/libs/jasmine/console.js +1 -1
  132. data/vendor/assets/libs/jasmine/jasmine-html.js +17 -5
  133. data/vendor/assets/libs/jasmine/jasmine.css +10 -10
  134. data/vendor/assets/libs/jasmine/jasmine.js +295 -155
  135. metadata +278 -9
  136. data/lib/terminal.png +0 -0
  137. data/test/integration/navigation_test.rb +0 -9
  138. data/test/lib/generators/squad/install_generator_test.rb +0 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8558931146248c1acab78a3a1927c68d27fac067
4
- data.tar.gz: f852e96638b6e735c0380aef4067c5660d207a5e
3
+ metadata.gz: 8d8a0e6e00da040f75e75852c90c0596c0febad6
4
+ data.tar.gz: 23449b3538b4afc02ed5f771438bff21cb31d56a
5
5
  SHA512:
6
- metadata.gz: 7f4084ca3a280d2fc46c8a152e28832b507cb2f49899650ad07ab17d7c55c01737add06d838afbce4680d92fb9e5600d927ee3ed3320f0555946502ff58a04dc
7
- data.tar.gz: 8793c9502f41d95046be6aed10cdcfbaee7176f0b30b6e371bd4228bd275f44d84202962d238a91f1927f33273b9968041abd1f142be486597f50f6a054feb56
6
+ metadata.gz: b51083b6c2848eb848e8d668e4857ab5b0d4bcb6b24153a1d33cde3bb91d3409bb381ba42625bf22410938c2e759182ca8c9734a2e797a789acdd880ca4f444f
7
+ data.tar.gz: a54bc57fa49a7b2e27af6f25a395dfe804860dc84b6249517381cebfadb0fce3ee2139e44f7d8a04c1826713252900e458dc7f570937f67ba395ecb254d01fc2
data/README.md CHANGED
@@ -1,15 +1,20 @@
1
1
  # TestSquad
2
2
 
3
+ [![Build Status](https://travis-ci.org/fnando/test_squad.svg)](https://travis-ci.org/fnando/test_squad)
4
+ [![Code Climate](https://codeclimate.com/github/fnando/test_squad/badges/gpa.svg)](https://codeclimate.com/github/fnando/test_squad)
5
+ [![Test Coverage](https://codeclimate.com/github/fnando/test_squad/badges/coverage.svg)](https://codeclimate.com/github/fnando/test_squad)
6
+
3
7
  Running JavaScript tests on your Rails app, the easy way.
4
8
 
5
- - Supports QUnit, Ember.js, Mocha and Jasmine
9
+ - Supports [QUnit](http://qunitjs.com), [Ember.js](http://emberjs.com), [Mocha](http://mochajs.org) and [Jasmine](http://jasmine.github.io/)
6
10
  - Go headless with [Phantom.js](http://phantomjs.org)
7
11
  - Colored output
8
12
  - Asset pipeline support
13
+ - [Rails Assets](http://rails-assets.org) support (Bower Proxy)
9
14
 
10
15
  ## Installation
11
16
 
12
- Add these lines to your application's Gemfile:
17
+ Add these lines to your application's `Gemfile`:
13
18
 
14
19
  ```ruby
15
20
  group :development, :test do
@@ -25,7 +30,7 @@ $ bundle
25
30
 
26
31
  ## Usage
27
32
 
28
- After installing TestSquad, generate your tests skeleton. The generator will detect if you're using RSpec or TestUnit and will generate the `javascript` directory basead on that detection. Just use the command `rails generate test_squad:install --framework FRAMEWORK`.
33
+ After installing TestSquad, generate your tests skeleton. The generator will detect if you're using RSpec or TestUnit and will generate the `javascript` directory based on that detection. Just use the command `rails generate test_squad:install --framework FRAMEWORK`.
29
34
 
30
35
  ```console
31
36
  $ rails generate test_squad:install --framework jasmine
@@ -49,6 +54,8 @@ You can run your tests with `rake test_squad`. You can also visit `http://localh
49
54
 
50
55
  ![Terminal](https://github.com/fnando/test_squad/raw/master/screenshots/terminal.png)
51
56
 
57
+ ![Ember](https://github.com/fnando/test_squad/raw/master/screenshots/terminal-ember.png)
58
+
52
59
  ### Configure Ember
53
60
 
54
61
  When using the Ember framework, you must configure your application name. It'll default to your Rails application name.
@@ -148,11 +155,24 @@ Otherwise you won't be able to to run your in-browser tests.
148
155
 
149
156
  The rake task accepts some env variables.
150
157
 
151
- - `HOST`: the binding host. Defaults to `localhost`.
152
- - `PORT`: the server port. Defaults to `50000`.
153
- - `TIMEOUT`: how much time a test can take. Defaults to `10` (seconds).
154
- - `LOG`: set if console messages should be logged. Defaults to `false`.
155
- - `PHANTOMJS_BIN`: set the PhantomJS binary. Defaults to `phantomjs`.
158
+ - `TEST_SQUAD_SERVER_HOST`: the binding host. Defaults to `localhost`.
159
+ - `TEST_SQUAD_SERVER_PORT`: the server port. Defaults to `50000`.
160
+ - `TEST_SQUAD_SERVER_PATH`: the server path. Defaults to `/tests`.
161
+ - `TEST_SQUAD_TIMEOUT`: how much time a test can take. Defaults to `10` (seconds).
162
+ - `TEST_SQUAD_PHANTOMJS_BIN`: set the PhantomJS binary. Defaults to `phantomjs`.
163
+
164
+ You can configure these options using the `{test,spec}/javascript/test_squad.rb` file.
165
+
166
+ ```ruby
167
+ TestSquad.configure do |config|
168
+ config.framework = 'qunit'
169
+ config.server_host = '127.0.0.1'
170
+ config.server_port = 50000
171
+ config.server_path = '/tests'
172
+ config.timeout = 10
173
+ config.phantomjs_bin = 'phantomjs'
174
+ end
175
+ ```
156
176
 
157
177
  ## Contributing
158
178
 
data/Rakefile CHANGED
@@ -13,6 +13,7 @@ Rake::TestTask.new(:test) do |t|
13
13
  t.libs << 'test'
14
14
  t.pattern = 'test/**/*_test.rb'
15
15
  t.verbose = false
16
+ t.warning = false
16
17
  end
17
18
 
18
19
  task default: :test
@@ -1,86 +1,116 @@
1
- class TestSquad::InstallGenerator < Rails::Generators::Base
2
- source_root File.expand_path('../templates', __FILE__)
1
+ module TestSquad
2
+ class InstallGenerator < Rails::Generators::Base
3
+ source_root File.expand_path("../templates", __FILE__)
3
4
 
4
- class_option :framework,
5
- type: 'string',
6
- desc: 'Select the JavaScript framework. Can be jasmine, qunit, mocha or ember.',
7
- aliases: '-f',
8
- required: true
5
+ SKIP_RAILS_ASSETS = %w[jasmine]
9
6
 
10
- def generate
11
- send "generate_#{options[:framework]}"
12
- end
7
+ class_option :framework,
8
+ type: "string",
9
+ desc: "Select the JavaScript framework. Can be jasmine, qunit, mocha or ember.",
10
+ aliases: "-f",
11
+ required: true
13
12
 
14
- def generate_defaults
15
- add_source 'https://rails-assets.org'
16
- empty_directory test_directory
17
- template 'test_squad.rb.erb', "#{test_directory}/test_squad.rb"
18
- end
13
+ class_option :skip_source,
14
+ type: "boolean",
15
+ desc: "Skip adding gem source to Gemfile",
16
+ aliases: "-s"
19
17
 
20
- private
18
+ def generate
19
+ send "generate_#{framework}"
20
+ end
21
21
 
22
- def test_directory
23
- TestSquad.test_directory
24
- end
22
+ def generate_defaults
23
+ empty_directory test_directory
24
+ template "test_squad.rb.erb", "#{test_directory}/test_squad.rb"
25
+ end
25
26
 
26
- def app_name
27
- app_class_name.underscore
28
- end
27
+ private
29
28
 
30
- def app_class_name
31
- TestSquad.app_class_name
32
- end
29
+ def framework
30
+ options[:framework]
31
+ end
33
32
 
34
- def generate_qunit
35
- empty_directory "#{test_directory}/#{app_name}"
36
- create_file "#{test_directory}/#{app_name}/.keep"
37
- template 'qunit/test_helper.js.erb', "#{test_directory}/test_helper.js"
38
- copy_file 'qunit/answer_test.js', "#{test_directory}/#{app_name}/answer_test.js"
33
+ def test_directory
34
+ if File.exist?(File.join(destination_root, "spec"))
35
+ "spec/javascript"
36
+ else
37
+ "test/javascript"
38
+ end
39
+ end
39
40
 
40
- gem_group :development, :test do
41
- gem 'rails-assets-qunit'
41
+ def app_name
42
+ app_class_name.underscore
42
43
  end
43
- end
44
44
 
45
- def generate_jasmine
46
- empty_directory "#{test_directory}/#{app_name}"
47
- create_file "#{test_directory}/#{app_name}/.keep"
48
- template 'jasmine/spec_helper.js.erb', "#{test_directory}/spec_helper.js"
49
- copy_file 'jasmine/answer_spec.js', "#{test_directory}/#{app_name}/answer_spec.js"
50
- end
45
+ def app_class_name
46
+ TestSquad.app_class_name
47
+ end
51
48
 
52
- def generate_mocha
53
- empty_directory "#{test_directory}/#{app_name}"
54
- create_file "#{test_directory}/#{app_name}/.keep"
55
- template 'mocha/spec_helper.js.erb', "#{test_directory}/spec_helper.js"
56
- copy_file 'mocha/answer_spec.js', "#{test_directory}/#{app_name}/answer_spec.js"
49
+ def generate_qunit
50
+ empty_directory "#{test_directory}/#{app_name}"
51
+ create_file "#{test_directory}/#{app_name}/.keep"
52
+ template "qunit/test_helper.js.erb", "#{test_directory}/test_helper.js"
53
+ copy_file "qunit/answer_test.js", "#{test_directory}/#{app_name}/answer_test.js"
57
54
 
58
- gem_group :development, :test do
59
- gem 'rails-assets-mocha'
60
- gem 'rails-assets-expect'
55
+ rails_assets do
56
+ gem "rails-assets-qunit"
57
+ end unless options[:skip_source]
61
58
  end
62
- end
63
59
 
64
- def generate_ember
65
- empty_directory "#{test_directory}/unit"
66
- copy_file 'ember/router_test.js', "#{test_directory}/unit/router_test.js"
60
+ def generate_jasmine
61
+ empty_directory "#{test_directory}/#{app_name}"
62
+ create_file "#{test_directory}/#{app_name}/.keep"
63
+ template "jasmine/spec_helper.js.erb", "#{test_directory}/spec_helper.js"
64
+ copy_file "jasmine/answer_spec.js", "#{test_directory}/#{app_name}/answer_spec.js"
65
+ end
66
+
67
+ def generate_mocha
68
+ empty_directory "#{test_directory}/#{app_name}"
69
+ create_file "#{test_directory}/#{app_name}/.keep"
70
+ template "mocha/spec_helper.js.erb", "#{test_directory}/spec_helper.js"
71
+ copy_file "mocha/answer_spec.js", "#{test_directory}/#{app_name}/answer_spec.js"
72
+
73
+ rails_assets do
74
+ gem_group :development, :test do
75
+ gem "rails-assets-mocha"
76
+ gem "rails-assets-expect"
77
+ end
78
+ end unless options[:skip_source]
79
+ end
80
+
81
+ def generate_ember
82
+ empty_directory "#{test_directory}/unit"
83
+ copy_file "ember/router_test.js", "#{test_directory}/unit/router_test.js"
84
+
85
+ empty_directory "#{test_directory}/routes"
86
+ create_file "#{test_directory}/routes/.keep"
87
+
88
+ empty_directory "#{test_directory}/components"
89
+ create_file "#{test_directory}/components/.keep"
67
90
 
68
- empty_directory "#{test_directory}/routes"
69
- create_file "#{test_directory}/routes/.keep"
91
+ empty_directory "#{test_directory}/views"
92
+ create_file "#{test_directory}/views/.keep"
70
93
 
71
- empty_directory "#{test_directory}/components"
72
- create_file "#{test_directory}/components/.keep"
94
+ empty_directory "#{test_directory}/models"
95
+ create_file "#{test_directory}/models/.keep"
73
96
 
74
- empty_directory "#{test_directory}/views"
75
- create_file "#{test_directory}/views/.keep"
97
+ template "ember/test_helper.js.erb", "#{test_directory}/test_helper.js"
98
+
99
+ rails_assets do
100
+ gem_group :development, :test do
101
+ gem "rails-assets-qunit"
102
+ end
103
+ end unless options[:skip_source]
104
+ end
76
105
 
77
- empty_directory "#{test_directory}/models"
78
- create_file "#{test_directory}/models/.keep"
106
+ def rails_assets(&block)
107
+ in_root do
108
+ append_file "Gemfile", %[\nsource "https://rails-assets.org" do], force: true
79
109
 
80
- template 'ember/test_helper.js.erb', "#{test_directory}/test_helper.js"
110
+ instance_eval(&block)
81
111
 
82
- gem_group :development, :test do
83
- gem 'rails-assets-qunit'
112
+ append_file "Gemfile", "\nend\n", force: true
113
+ end
84
114
  end
85
115
  end
86
116
  end
@@ -1,5 +1,28 @@
1
1
  TestSquad.configure do |config|
2
2
  # Set the testing framework.
3
3
  # Can be jasmine, qunit, mocha or ember.
4
- config.framework = '<%= options[:framework] %>'
4
+ config.framework = "<%= options[:framework] %>"
5
+
6
+ # Set the test server host.
7
+ # This can also be set through the TEST_SQUAD_SEVER_HOST env var.
8
+ # config.server_host = "127.0.0.1"
9
+
10
+ # Set the test server port.
11
+ # This can also be set through the TEST_SQUAD_SERVER_PORT env var.
12
+ # config.server_port = 50000
13
+
14
+ # Set the test server path.
15
+ # You may map the tests path to something else. This change
16
+ # must be reflected here. This can also be set through the
17
+ # TEST_SQUAD_SERVER_PATH env var.
18
+ # config.server_path = "/tests"
19
+
20
+ # Set the test timeout.
21
+ # This can also be set through the TEST_SQUAD_TIMEOUT env var.
22
+ # It defaults to 10 seconds.
23
+ # config.timeout = 10
24
+
25
+ # Set the phantomjs bin path.
26
+ # This can also be set through the TEST_SQUAD_PHANTOMJS_BIN env var.
27
+ # config.phantomjs_bin = "phantomjs"
5
28
  end
@@ -1,39 +1,11 @@
1
- desc 'Run JavaScript tests'
1
+ desc "Run JavaScript tests"
2
2
  task :test_squad do
3
- ENV['RAILS_ENV'] = 'test'
4
- ENV['RACK_ENV'] = 'test'
3
+ ENV["RAILS_ENV"] = "test"
4
+ ENV["RACK_ENV"] = "test"
5
5
 
6
- require './config/environment'
7
- require 'stringio'
6
+ require "./config/environment"
7
+ config_file = Rails.root.join(TestSquad.test_directory, "test_squad.rb")
8
+ load config_file if config_file.exist?
8
9
 
9
- phantomjs_bin = ENV.fetch('PHANTOMJS_BIN', 'phantomjs')
10
- port = ENV.fetch('PORT', 50000)
11
- host = ENV.fetch('HOST', 'localhost')
12
- path = ENV.fetch('TEST_PATH', '/tests')
13
- timeout = ENV.fetch('TIMEOUT', '10')
14
- log = ENV.fetch('LOG', 'false')
15
- url = File.join("http://#{host}:#{port}", path)
16
- logger = Logger.new(StringIO.new)
17
-
18
- handler = Rack::Handler.pick(['puma', 'thin', 'webrick'])
19
-
20
- Rails.configuration.logger = logger
21
-
22
- thread = Thread.new {
23
- handler.run Rails.application,
24
- Port: port,
25
- Host: host,
26
- Logger: logger,
27
- AccessLog: []
28
- }
29
-
30
- thread.abort_on_exception = true
31
-
32
- system phantomjs_bin,
33
- File.expand_path('../../../phantomjs/runner.js', __FILE__),
34
- url,
35
- timeout,
36
- log
37
-
38
- exit $?.exitstatus
10
+ TestSquad::Runner.run
39
11
  end
data/lib/test_squad.rb CHANGED
@@ -1,9 +1,10 @@
1
- require 'test_squad/engine'
2
- require 'ostruct'
1
+ require "test_squad/engine"
2
+ require "test_squad/runner"
3
+ require "test_squad/configuration"
3
4
 
4
5
  module TestSquad
5
6
  def self.configuration
6
- @configuration ||= OpenStruct.new
7
+ @configuration ||= Configuration.new
7
8
  end
8
9
 
9
10
  def self.configure(&block)
@@ -11,15 +12,15 @@ module TestSquad
11
12
  end
12
13
 
13
14
  def self.app_class_name
14
- Rails.application.class.name.split('::').first
15
+ Rails.application.class.name.split("::").first
15
16
  end
16
17
 
17
18
  def self.test_directory
18
19
  @test_directory ||= begin
19
- if Rails.root.join('spec').exist?
20
- 'spec/javascript'
20
+ if Rails.root.join("spec").exist?
21
+ "spec/javascript"
21
22
  else
22
- 'test/javascript'
23
+ "test/javascript"
23
24
  end
24
25
  end
25
26
  end
@@ -0,0 +1,65 @@
1
+ module TestSquad
2
+ class Configuration
3
+ # Set the enabled JavaScript library.
4
+ attr_accessor :framework
5
+
6
+ # Set the phantomjs bin path.
7
+ # This can also be set through the TEST_SQUAD_PHANTOMJS_BIN env var.
8
+ # It defaults to `phantomjs`.
9
+ attr_writer :phantomjs_bin
10
+
11
+ # Set the test server host.
12
+ # This can also be set through the TEST_SQUAD_SERVER_HOST env var.
13
+ # It defaults to `127.0.0.1`
14
+ attr_writer :server_host
15
+
16
+ # Set the test server port.
17
+ # This can also be set through the TEST_SQUAD_SERVER_PORT env var.
18
+ # It defaults to `42424`
19
+ attr_writer :server_port
20
+
21
+ # Set the test server path.
22
+ # You may map the tests path to something else. This change
23
+ # must be reflected here. This can also be set through the
24
+ # TEST_SQUAD_SERVER_PATH env var.
25
+ # It defaults to `/tests`.
26
+ attr_writer :server_path
27
+
28
+ # Set the test timeout.
29
+ # This can also be set through the TEST_SQUAD_TIMEOUT env var.
30
+ # It defaults to `10` seconds.
31
+ attr_writer :timeout
32
+
33
+ def server_uri
34
+ File.join("http://#{server_host}:#{server_port}", server_path)
35
+ end
36
+
37
+ def phantomjs_bin
38
+ get_value("TEST_SQUAD_PHANTOMJS_BIN", __method__, "phantomjs")
39
+ end
40
+
41
+ def server_host
42
+ get_value("TEST_SQUAD_SERVER_HOST", __method__, "127.0.0.1")
43
+ end
44
+
45
+ def server_port
46
+ get_value("TEST_SQUAD_SERVER_PORT", __method__, 42_424)
47
+ end
48
+
49
+ def server_path
50
+ get_value("TEST_SQUAD_SERVER_PATH", __method__, "/tests")
51
+ end
52
+
53
+ def timeout
54
+ get_value("TEST_SQUAD_TIMEOUT", __method__, 10)
55
+ end
56
+
57
+ private
58
+
59
+ def get_value(env_var, option_name, default_value)
60
+ ENV[env_var] ||
61
+ instance_variable_get("@#{option_name}") ||
62
+ default_value
63
+ end
64
+ end
65
+ end