teabag 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT.LICENSE +22 -0
- data/README.md +407 -0
- data/app/assets/images/teabag/photo-white.jpg +0 -0
- data/app/assets/javascripts/teabag-jasmine.js +3488 -0
- data/app/assets/javascripts/teabag-mocha.js +5923 -0
- data/app/assets/javascripts/teabag/base/reporters.coffee +105 -0
- data/app/assets/javascripts/teabag/base/reporters/console.coffee +58 -0
- data/app/assets/javascripts/teabag/base/reporters/html.coffee +177 -0
- data/app/assets/javascripts/teabag/base/reporters/html/failure_view.coffee +12 -0
- data/app/assets/javascripts/teabag/base/reporters/html/progress_view.coffee +67 -0
- data/app/assets/javascripts/teabag/base/reporters/html/spec_view.coffee +46 -0
- data/app/assets/javascripts/teabag/base/reporters/html/suite_view.coffee +39 -0
- data/app/assets/javascripts/teabag/base/runner.coffee +22 -0
- data/app/assets/javascripts/teabag/base/teabag.coffee +18 -0
- data/app/assets/javascripts/teabag/jasmine.coffee +38 -0
- data/app/assets/javascripts/teabag/jasmine/reporters/html.coffee +11 -0
- data/app/assets/javascripts/teabag/mocha.coffee +21 -0
- data/app/assets/javascripts/teabag/mocha/reporters/console.coffee +14 -0
- data/app/assets/javascripts/teabag/mocha/reporters/html.coffee +27 -0
- data/app/assets/stylesheets/teabag.css +332 -0
- data/app/controllers/teabag/spec_controller.rb +25 -0
- data/app/views/teabag/spec/index.html.erb +18 -0
- data/config/routes.rb +8 -0
- data/lib/generators/teabag/install/POST_INSTALL +6 -0
- data/lib/generators/teabag/install/install_generator.rb +24 -0
- data/lib/generators/teabag/install/templates/initializer.rb +115 -0
- data/lib/generators/teabag/install/templates/spec_helper.js +31 -0
- data/lib/tasks/teabag.rake +5 -0
- data/lib/teabag.rb +6 -0
- data/lib/teabag/configuration.rb +68 -0
- data/lib/teabag/console.rb +57 -0
- data/lib/teabag/engine.rb +16 -0
- data/lib/teabag/exceptions.rb +6 -0
- data/lib/teabag/formatters/base_formatter.rb +32 -0
- data/lib/teabag/formatters/progress_formatter.rb +93 -0
- data/lib/teabag/phantomjs/runner.coffee +61 -0
- data/lib/teabag/result.rb +46 -0
- data/lib/teabag/runner.rb +49 -0
- data/lib/teabag/server.rb +64 -0
- data/lib/teabag/suite.rb +39 -0
- data/lib/teabag/version.rb +3 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/javascripts/specs/asset_spec.js +11 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +15 -0
- data/spec/dummy/config/application.rb +54 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +27 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +29 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/teabag.rb +22 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +58 -0
- data/spec/dummy/log/development.log +308541 -0
- data/spec/dummy/log/production.log +402 -0
- data/spec/dummy/log/test.log +3459 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/tmp/cache/assets/C13/B50/sprockets%2F431452d41e5087d2211162d23c63789b +0 -0
- data/spec/dummy/tmp/cache/assets/C18/F90/sprockets%2F369a3f720404378b4162541fd432742d +0 -0
- data/spec/dummy/tmp/cache/assets/C28/650/sprockets%2F24278fc33d7566396414307f37b119b6 +0 -0
- data/spec/dummy/tmp/cache/assets/C2B/5D0/sprockets%2F98606f6051a5fc71379af24236793353 +0 -0
- data/spec/dummy/tmp/cache/assets/C35/510/sprockets%2Fb5f1121863a3025179f1a621e7127b10 +0 -0
- data/spec/dummy/tmp/cache/assets/C46/E90/sprockets%2F006527268e406896b12c930eb572f00a +0 -0
- data/spec/dummy/tmp/cache/assets/C4A/700/sprockets%2F233efef497080a6a0226928033c09166 +0 -0
- data/spec/dummy/tmp/cache/assets/C4C/5E0/sprockets%2Fcb61192e6366f0228a57c91459c00256 +0 -0
- data/spec/dummy/tmp/cache/assets/C4E/6A0/sprockets%2F6443716ba17b71f265656634b3b9441d +0 -0
- data/spec/dummy/tmp/cache/assets/C4E/9B0/sprockets%2Fa807397434c9262c3d62da3e91152184 +0 -0
- data/spec/dummy/tmp/cache/assets/C59/250/sprockets%2Fa80d3fe493d2476e58c4323996064512 +0 -0
- data/spec/dummy/tmp/cache/assets/C5C/D00/sprockets%2Fdd8fdc961143499e53f5327126721608 +0 -0
- data/spec/dummy/tmp/cache/assets/C64/630/sprockets%2F9435866920a6269633da595e0638ecf4 +0 -0
- data/spec/dummy/tmp/cache/assets/C64/740/sprockets%2Fa65d355185e6ed0699611739c38a6683 +0 -0
- data/spec/dummy/tmp/cache/assets/C6C/3A0/sprockets%2F35a43b3a31512a820f249c841b7b3862 +0 -0
- data/spec/dummy/tmp/cache/assets/C75/D50/sprockets%2F5302968a40e08d2c011aa38666d273f6 +0 -0
- data/spec/dummy/tmp/cache/assets/C78/EF0/sprockets%2F65f827a4a5337d05d037845161b41ab8 +0 -0
- data/spec/dummy/tmp/cache/assets/C78/F80/sprockets%2F9161622ddd251097a4ab816b8220984c +0 -0
- data/spec/dummy/tmp/cache/assets/C7D/730/sprockets%2F6c062828354bbf37032360766d652fea +0 -0
- data/spec/dummy/tmp/cache/assets/C80/EC0/sprockets%2F8ae4c854735563d420f90b1b236a3497 +0 -0
- data/spec/dummy/tmp/cache/assets/C80/F70/sprockets%2Fe5c9811902c221828ea647978f000be3 +0 -0
- data/spec/dummy/tmp/cache/assets/C81/630/sprockets%2F8914408137182ffb4a2f37176f2e207d +0 -0
- data/spec/dummy/tmp/cache/assets/C81/D20/sprockets%2F7979862b333720a8f2021a877a4af0f4 +0 -0
- data/spec/dummy/tmp/cache/assets/C83/C30/sprockets%2F9c8d8400390c4927ab703e2b785415d6 +0 -0
- data/spec/dummy/tmp/cache/assets/C85/D10/sprockets%2F01d329696710efd821850ec83292bc76 +0 -0
- data/spec/dummy/tmp/cache/assets/C87/850/sprockets%2F45dd8808f5c34633480a87058f025bc6 +0 -0
- data/spec/dummy/tmp/cache/assets/C88/720/sprockets%2F0b0cf4198eb5818ffc69908188301127 +0 -0
- data/spec/dummy/tmp/cache/assets/C89/700/sprockets%2F259935a7704fef0069303ea63fa89408 +0 -0
- data/spec/dummy/tmp/cache/assets/C8A/460/sprockets%2F77bffd9959420103906722b404ae8d59 +0 -0
- data/spec/dummy/tmp/cache/assets/C8D/8A0/sprockets%2F52b90ee84d6593767a35dc417b862228 +0 -0
- data/spec/dummy/tmp/cache/assets/C90/9D0/sprockets%2Ff8669a76788e96f11e6d8630a10113a8 +0 -0
- data/spec/dummy/tmp/cache/assets/C91/040/sprockets%2F8d009759ea4847ffd6171a1579f41634 +0 -0
- data/spec/dummy/tmp/cache/assets/C91/FA0/sprockets%2F2eb81283f5789ae91a69344552db3856 +0 -0
- data/spec/dummy/tmp/cache/assets/C94/7F0/sprockets%2F5511d2208b7b12aa9130a72ef07b6803 +0 -0
- data/spec/dummy/tmp/cache/assets/C96/A60/sprockets%2F6e220f96d15d5db885711f50876993e5 +0 -0
- data/spec/dummy/tmp/cache/assets/C9D/E90/sprockets%2F3045c9533f179d3e1c805d163ed002a0 +0 -0
- data/spec/dummy/tmp/cache/assets/CA2/7D0/sprockets%2F1f39d625b67ba277a4811d361074a2d1 +0 -0
- data/spec/dummy/tmp/cache/assets/CA2/F50/sprockets%2F86094c5d1b6399d614b0771a3a0a45b0 +0 -0
- data/spec/dummy/tmp/cache/assets/CA5/760/sprockets%2F06db38110a7245399c693831d01bcb6e +0 -0
- data/spec/dummy/tmp/cache/assets/CA6/2F0/sprockets%2F20040c18b672e4c4d2731a2a929d8b97 +0 -0
- data/spec/dummy/tmp/cache/assets/CA6/DF0/sprockets%2F7da83747ce56e49393b6b8726587f846 +0 -0
- data/spec/dummy/tmp/cache/assets/CA8/400/sprockets%2F7fb4801a4d3c5ed42610b9076362283f +0 -0
- data/spec/dummy/tmp/cache/assets/CA9/440/sprockets%2F488d156744e10731bee14b5a931a581d +0 -0
- data/spec/dummy/tmp/cache/assets/CAA/0C0/sprockets%2F057b0ce384f16d9202ae84473436cc35 +0 -0
- data/spec/dummy/tmp/cache/assets/CAD/410/sprockets%2F651414e5c7e86f05c5108dc71626b25c +0 -0
- data/spec/dummy/tmp/cache/assets/CB1/0D0/sprockets%2Fe3ca7997e9150f7731f50b227533d12c +0 -0
- data/spec/dummy/tmp/cache/assets/CB1/690/sprockets%2F7a8100c6511e848b1148287ad87cb47f +0 -0
- data/spec/dummy/tmp/cache/assets/CB2/640/sprockets%2Fd629e34645a3892189c1f2c052f6d2c2 +0 -0
- data/spec/dummy/tmp/cache/assets/CB3/240/sprockets%2Fb3935adb01833c52148cf492898db094 +0 -0
- data/spec/dummy/tmp/cache/assets/CB4/970/sprockets%2Fe4737223d2ba69d655f6611f0527d58b +0 -0
- data/spec/dummy/tmp/cache/assets/CB6/190/sprockets%2Ff18444022b08982685f9cd15b62b4dd7 +0 -0
- data/spec/dummy/tmp/cache/assets/CB6/C00/sprockets%2F4119946cb82f96e5a2793013a3bdd855 +0 -0
- data/spec/dummy/tmp/cache/assets/CB7/BF0/sprockets%2Fd56192b300ec0979b66d022e996fa079 +0 -0
- data/spec/dummy/tmp/cache/assets/CB8/E20/sprockets%2Fa593029687d6717431a3dc7360ca9dd9 +0 -0
- data/spec/dummy/tmp/cache/assets/CBB/FA0/sprockets%2F74922109263bdc965b2e9567eec6d154 +0 -0
- data/spec/dummy/tmp/cache/assets/CBC/E20/sprockets%2Faf708488d1178752bfbb925184f194c3 +0 -0
- data/spec/dummy/tmp/cache/assets/CBE/AB0/sprockets%2F3f8985f1b9c67404dd9a14f0647404c8 +0 -0
- data/spec/dummy/tmp/cache/assets/CBF/630/sprockets%2F707d2db81468088470d476abff35388d +0 -0
- data/spec/dummy/tmp/cache/assets/CC1/440/sprockets%2F17172f9f3b01ee6fc473047c76943e89 +0 -0
- data/spec/dummy/tmp/cache/assets/CC2/7B0/sprockets%2Ff35764dca2f5e55c5538589cf0125398 +0 -0
- data/spec/dummy/tmp/cache/assets/CC2/EC0/sprockets%2F76bf80cb571ca530357f78db78167866 +0 -0
- data/spec/dummy/tmp/cache/assets/CC4/800/sprockets%2Fdc523a6389fe6285945c07a90d58c792 +0 -0
- data/spec/dummy/tmp/cache/assets/CC4/CC0/sprockets%2F94470799e3269f582188fe8e5201acac +0 -0
- data/spec/dummy/tmp/cache/assets/CC4/D20/sprockets%2F580f5e966a053317b284bc9d99180ff9 +0 -0
- data/spec/dummy/tmp/cache/assets/CC6/D00/sprockets%2Fc3ad440856320f4a51301c6ecb6b6342 +0 -0
- data/spec/dummy/tmp/cache/assets/CCB/540/sprockets%2F304d8554d7e38ae101c47b0a027147bc +0 -0
- data/spec/dummy/tmp/cache/assets/CCD/560/sprockets%2Fc026ba3c1ad5675314735b56c2435ac7 +0 -0
- data/spec/dummy/tmp/cache/assets/CCE/960/sprockets%2F522c8e0801c33373edc7f5d3126a530c +0 -0
- data/spec/dummy/tmp/cache/assets/CCE/C50/sprockets%2Fe12774c2fea852112414bb379a71f31a +0 -0
- data/spec/dummy/tmp/cache/assets/CCF/390/sprockets%2F72dd112058cad36028c2450671ddf26d +0 -0
- data/spec/dummy/tmp/cache/assets/CD1/0B0/sprockets%2F5bf8f21172210208e5dce60265d40b9d +0 -0
- data/spec/dummy/tmp/cache/assets/CD1/620/sprockets%2F06a3eb05fcb4175a679d6084a06026a6 +0 -0
- data/spec/dummy/tmp/cache/assets/CD1/BD0/sprockets%2Fb2089774122944ac8c3abb32f70c23d3 +0 -0
- data/spec/dummy/tmp/cache/assets/CD3/460/sprockets%2F7f3f6802b0b309ed142d0b671c9640c4 +0 -0
- data/spec/dummy/tmp/cache/assets/CD4/050/sprockets%2F4c36a6e9e6874070516a6c40b0309daa +0 -0
- data/spec/dummy/tmp/cache/assets/CD4/D20/sprockets%2F40c6b1133a952429a7b8769c1d3c3dd0 +0 -0
- data/spec/dummy/tmp/cache/assets/CD7/B90/sprockets%2Fe3e49e4c1c68a1e32355620d1d3b7265 +0 -0
- data/spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/CD9/880/sprockets%2F2e8e3822ab8a2ce41cf39554226230d9 +0 -0
- data/spec/dummy/tmp/cache/assets/CD9/9B0/sprockets%2Fdc1f0447e4c5c2f990750b2f722c5900 +0 -0
- data/spec/dummy/tmp/cache/assets/CD9/DD0/sprockets%2Fe5774759168a731da1c1149ecf0e1b03 +0 -0
- data/spec/dummy/tmp/cache/assets/CDA/2B0/sprockets%2Fc3a13686484d2cdc5b859b2300b0d489 +0 -0
- data/spec/dummy/tmp/cache/assets/CDA/930/sprockets%2F7dd8506d171b15d410eb245f60b99b46 +0 -0
- data/spec/dummy/tmp/cache/assets/CDB/170/sprockets%2Ffd3d8740748be26004cf49b130680e1e +0 -0
- data/spec/dummy/tmp/cache/assets/CDB/630/sprockets%2Ffd1626fe1016c81d57217f7f80c4370a +0 -0
- data/spec/dummy/tmp/cache/assets/CDC/EB0/sprockets%2F627ab41907f375c3efc41a44e090d961 +0 -0
- data/spec/dummy/tmp/cache/assets/CDD/430/sprockets%2Fe201772e6124a4c0d53de19696ac8b94 +0 -0
- data/spec/dummy/tmp/cache/assets/CE0/190/sprockets%2F8d6df52167f36d9e1655f989e91699c7 +0 -0
- data/spec/dummy/tmp/cache/assets/CE0/CF0/sprockets%2Fea163522b70cf77176d95b4caa560939 +0 -0
- data/spec/dummy/tmp/cache/assets/CE1/250/sprockets%2Ffdc680a0d4383d37910e549ca96f5303 +0 -0
- data/spec/dummy/tmp/cache/assets/CE1/730/sprockets%2Fa1678837061e18d7aca0286c07acf676 +0 -0
- data/spec/dummy/tmp/cache/assets/CE2/9C0/sprockets%2F24939c09b831b5f057100fe4776dccf4 +0 -0
- data/spec/dummy/tmp/cache/assets/CE2/DA0/sprockets%2Ff3ac0c65e27949133e0ea9b8250a3977 +0 -0
- data/spec/dummy/tmp/cache/assets/CE2/E90/sprockets%2F442a112b6b94b9728d6fa0bc6f474694 +0 -0
- data/spec/dummy/tmp/cache/assets/CE3/1F0/sprockets%2Fe69a515d3a9d14c669be8871012a7d07 +0 -0
- data/spec/dummy/tmp/cache/assets/CE3/B20/sprockets%2F61ccc7dcd2082970836964ac01f54b96 +0 -0
- data/spec/dummy/tmp/cache/assets/CE4/580/sprockets%2F2296de52158bde693192f14282b5edf1 +0 -0
- data/spec/dummy/tmp/cache/assets/CE4/FD0/sprockets%2F4295ee9f678aa2db21f5b1565616a319 +0 -0
- data/spec/dummy/tmp/cache/assets/CE6/270/sprockets%2F2c98152560d18470fec8cf4c6829b4d0 +0 -0
- data/spec/dummy/tmp/cache/assets/CE6/7C0/sprockets%2Fa03a2c86ce6724be8542295e1cf24798 +0 -0
- data/spec/dummy/tmp/cache/assets/CE6/990/sprockets%2F02e1c54cebf6319465e469269b91ab66 +0 -0
- data/spec/dummy/tmp/cache/assets/CE7/A60/sprockets%2Ff58eee249aa167d23f8220087bb46684 +0 -0
- data/spec/dummy/tmp/cache/assets/CE9/9E0/sprockets%2F135480d497ed7e4884462dc0ef0b80d7 +0 -0
- data/spec/dummy/tmp/cache/assets/CEA/6D0/sprockets%2Fc95345583b2c6df7850cef943c5a0375 +0 -0
- data/spec/dummy/tmp/cache/assets/CEB/680/sprockets%2F67f0794ef8c0576d5c7da34f4437305a +0 -0
- data/spec/dummy/tmp/cache/assets/CEB/B20/sprockets%2F5c3535c9b266a5cb17824f5676a775dd +0 -0
- data/spec/dummy/tmp/cache/assets/CEB/B40/sprockets%2F1150bf8d912aa100a132251eefaf6045 +0 -0
- data/spec/dummy/tmp/cache/assets/CEB/D80/sprockets%2F8992063c286f1379f2075ebef3ae21c8 +0 -0
- data/spec/dummy/tmp/cache/assets/CED/A20/sprockets%2F38752bc804bdd87e3823be65866a0c87 +0 -0
- data/spec/dummy/tmp/cache/assets/CEF/960/sprockets%2F815667b28e33482c8f0ba479b72af5e9 +0 -0
- data/spec/dummy/tmp/cache/assets/CF1/C50/sprockets%2F57bd9ac92067ea01882feef075582758 +0 -0
- data/spec/dummy/tmp/cache/assets/CF2/6A0/sprockets%2F3f295ed908e399eaa764b3a187e52663 +0 -0
- data/spec/dummy/tmp/cache/assets/CF3/3A0/sprockets%2F6571249b82eb52e7c7e035c692df9b69 +0 -0
- data/spec/dummy/tmp/cache/assets/CF4/6F0/sprockets%2Fed96f92571224b862b84d7078b86ded3 +0 -0
- data/spec/dummy/tmp/cache/assets/CF7/F10/sprockets%2F8c45854ebd195b52cc42bf3f99996336 +0 -0
- data/spec/dummy/tmp/cache/assets/CF8/780/sprockets%2F8845b81ff27cdb57c835836c9f91a265 +0 -0
- data/spec/dummy/tmp/cache/assets/CF9/D00/sprockets%2F9da50f3d2073a00c62f35ca6c04a9561 +0 -0
- data/spec/dummy/tmp/cache/assets/CFA/C00/sprockets%2F455bb7218b44a4cc162b1ec574cb4044 +0 -0
- data/spec/dummy/tmp/cache/assets/CFB/210/sprockets%2F9104695bfbf9a9d4b94382e6e90487a9 +0 -0
- data/spec/dummy/tmp/cache/assets/CFB/CA0/sprockets%2F5fd863f7896134b607496c9b0c7b6d7f +0 -0
- data/spec/dummy/tmp/cache/assets/CFC/380/sprockets%2Fa7443cbd671446a589867dd5f4a4f989 +0 -0
- data/spec/dummy/tmp/cache/assets/D00/110/sprockets%2F6a6353b7723a8b21708e0fbfe04bd422 +0 -0
- data/spec/dummy/tmp/cache/assets/D00/470/sprockets%2Fedd35336ed5f26cb44251532813b0c4c +0 -0
- data/spec/dummy/tmp/cache/assets/D00/B50/sprockets%2F3c4e003ba820ca79b7c153287a7f8a04 +0 -0
- data/spec/dummy/tmp/cache/assets/D03/630/sprockets%2F5d8da32dba6a7be70426a1d554773701 +0 -0
- data/spec/dummy/tmp/cache/assets/D03/A90/sprockets%2F4b6f4d85185cdd8027a202c7d104a65b +0 -0
- data/spec/dummy/tmp/cache/assets/D04/170/sprockets%2F76ab1dc02e6c7618852708a1e05a2df3 +0 -0
- data/spec/dummy/tmp/cache/assets/D04/480/sprockets%2F8bd8f10500b21d2f9d94e4cd1401c936 +0 -0
- data/spec/dummy/tmp/cache/assets/D05/8D0/sprockets%2F319f8f235f452343f1ebf03cb262d23d +0 -0
- data/spec/dummy/tmp/cache/assets/D07/120/sprockets%2Fe65cdfadc710ed84710627360a50a738 +0 -0
- data/spec/dummy/tmp/cache/assets/D07/BE0/sprockets%2F41e21b4d2cbf56b9933e8239ea0e7032 +0 -0
- data/spec/dummy/tmp/cache/assets/D08/BD0/sprockets%2F22c1dd6fa27601451d5cf6c840e0668e +0 -0
- data/spec/dummy/tmp/cache/assets/D09/BF0/sprockets%2F9e6bca5d26f50d9484385d51ba04312c +0 -0
- data/spec/dummy/tmp/cache/assets/D09/D00/sprockets%2F8d94b71c7c7b5e05166e15ccd0a12447 +0 -0
- data/spec/dummy/tmp/cache/assets/D0B/210/sprockets%2Fb95ce127097fba0e4019f633e91b730d +0 -0
- data/spec/dummy/tmp/cache/assets/D0C/B80/sprockets%2Fc4891b60864cf8457af101c9a211db8d +0 -0
- data/spec/dummy/tmp/cache/assets/D0D/060/sprockets%2F03c3bda8931e83e888ea8c95106300ae +0 -0
- data/spec/dummy/tmp/cache/assets/D0D/5B0/sprockets%2Fd8056958f488bbbea304151530ea4cb9 +0 -0
- data/spec/dummy/tmp/cache/assets/D0E/920/sprockets%2F47b207ec61677ee25b0001de3f96f84b +0 -0
- data/spec/dummy/tmp/cache/assets/D0E/E60/sprockets%2F4d8960a63bdca7075662239ef4b1de14 +0 -0
- data/spec/dummy/tmp/cache/assets/D0F/E80/sprockets%2Fb13bf7ddc4ee98083c79011ad7271275 +0 -0
- data/spec/dummy/tmp/cache/assets/D10/CE0/sprockets%2F602cdc3188bd940ab8ecc88e62390291 +0 -0
- data/spec/dummy/tmp/cache/assets/D10/EF0/sprockets%2F413d56da9f4db84a99fa73b11d196142 +0 -0
- data/spec/dummy/tmp/cache/assets/D11/340/sprockets%2F1fee97021c532d76bb64f4f19e8a1813 +0 -0
- data/spec/dummy/tmp/cache/assets/D11/B00/sprockets%2F97aa86f14ae420f87553523e340acdf8 +0 -0
- data/spec/dummy/tmp/cache/assets/D11/E50/sprockets%2Fe384d6dc634ba600219e284f31bf991f +0 -0
- data/spec/dummy/tmp/cache/assets/D11/F80/sprockets%2F48961522f6cd1a15f2fe6e25f1b37a75 +0 -0
- data/spec/dummy/tmp/cache/assets/D15/0A0/sprockets%2F6b913f0e2d4e3355989bbc14650ed8d4 +0 -0
- data/spec/dummy/tmp/cache/assets/D15/210/sprockets%2F79b3efa76951f9a0b25a1df07751d672 +0 -0
- data/spec/dummy/tmp/cache/assets/D15/750/sprockets%2F8effdd3e668a4036260a3e370f3b6657 +0 -0
- data/spec/dummy/tmp/cache/assets/D15/F10/sprockets%2Fc132f823916bcefc67d546d719dd4351 +0 -0
- data/spec/dummy/tmp/cache/assets/D16/790/sprockets%2F816a88991903fab936c1de6a6bd1e280 +0 -0
- data/spec/dummy/tmp/cache/assets/D16/F20/sprockets%2Fe3c050514d0e8c750d2ac977a97a69e9 +0 -0
- data/spec/dummy/tmp/cache/assets/D17/450/sprockets%2Ffac8560813729f008ca8b09f4a76e0e9 +0 -0
- data/spec/dummy/tmp/cache/assets/D17/710/sprockets%2Ffa49fb6823d466e79a195e0cd71340c5 +0 -0
- data/spec/dummy/tmp/cache/assets/D18/3D0/sprockets%2Fef037f0fc7cb0f80478b5465f564246d +0 -0
- data/spec/dummy/tmp/cache/assets/D1A/D30/sprockets%2F815a5177e9edba0c5c996182ef1b3675 +0 -0
- data/spec/dummy/tmp/cache/assets/D1C/250/sprockets%2F22f9883fa2d48e35e7cf9407a9a391b1 +0 -0
- data/spec/dummy/tmp/cache/assets/D1C/AE0/sprockets%2F64f4a3d1ef3f457e9117c857dab97073 +0 -0
- data/spec/dummy/tmp/cache/assets/D1E/AA0/sprockets%2F5c8741a556bc955cd36e61c88582b6dc +0 -0
- data/spec/dummy/tmp/cache/assets/D20/4E0/sprockets%2F8996e772cbbc3462a4578bed8a07880b +0 -0
- data/spec/dummy/tmp/cache/assets/D20/710/sprockets%2Fa6ac072e74c49f8c7f1c93313976a6e9 +0 -0
- data/spec/dummy/tmp/cache/assets/D20/980/sprockets%2F7245e0b92e389903ef6bb8f9b263d1e8 +0 -0
- data/spec/dummy/tmp/cache/assets/D20/C60/sprockets%2F0acbe1111c581802127531ef0caea7b9 +0 -0
- data/spec/dummy/tmp/cache/assets/D21/010/sprockets%2F8424ac59b80ac6c7f7d8534ce1935e87 +0 -0
- data/spec/dummy/tmp/cache/assets/D25/A40/sprockets%2F3203df91221911b0a35e3dd1f954abbd +0 -0
- data/spec/dummy/tmp/cache/assets/D27/350/sprockets%2Fc5cadc26988e3e7544817fa817fc8806 +0 -0
- data/spec/dummy/tmp/cache/assets/D27/900/sprockets%2F64be39c8e378779e3323d4925ac94eaf +0 -0
- data/spec/dummy/tmp/cache/assets/D27/A30/sprockets%2F1d15efb1ce5c9a479c87919d58b69571 +0 -0
- data/spec/dummy/tmp/cache/assets/D29/350/sprockets%2Fb8c14bbb2c24d881ba2a54d56715031f +0 -0
- data/spec/dummy/tmp/cache/assets/D2C/720/sprockets%2F293d8f7e19eefc1f7d397417e077467b +0 -0
- data/spec/dummy/tmp/cache/assets/D2D/F00/sprockets%2Fe7c0aa671a08e35e084fd1dd00330a89 +0 -0
- data/spec/dummy/tmp/cache/assets/D2F/520/sprockets%2Fea2308e8add6880c1c4d47040ab710d7 +0 -0
- data/spec/dummy/tmp/cache/assets/D2F/AD0/sprockets%2Fc8087368a419b7a2a010173ebaca8d2f +0 -0
- data/spec/dummy/tmp/cache/assets/D30/480/sprockets%2Feb011f46c64dbefb1f7e21329644c240 +0 -0
- data/spec/dummy/tmp/cache/assets/D31/9C0/sprockets%2Fbd102a4f5a4985c3519dd6ab0295a1c6 +0 -0
- data/spec/dummy/tmp/cache/assets/D32/500/sprockets%2F6927df5a24d91c75d001e2b5600ab8be +0 -0
- data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/D33/910/sprockets%2F18789ea0bbe0ac29a960b15ab082638b +0 -0
- data/spec/dummy/tmp/cache/assets/D33/F10/sprockets%2F44e1ef2cd8b518f7d2411ce56a11440f +0 -0
- data/spec/dummy/tmp/cache/assets/D34/B10/sprockets%2F810a3d507db1d548a1d314c9cc59c66b +0 -0
- data/spec/dummy/tmp/cache/assets/D35/030/sprockets%2F30d01c0eb55160b6f97568b2bb16dfc9 +0 -0
- data/spec/dummy/tmp/cache/assets/D35/260/sprockets%2Fd02b5f0131a65460b9bd146dd7e98f3a +0 -0
- data/spec/dummy/tmp/cache/assets/D35/7C0/sprockets%2Ff536a2606eaf7d542c0985104cb62baf +0 -0
- data/spec/dummy/tmp/cache/assets/D35/F00/sprockets%2F8e7f22358123b7eb5e21d17f442ce0ac +0 -0
- data/spec/dummy/tmp/cache/assets/D36/3F0/sprockets%2F845a64b2a4fdd702bb8d325cc6715a28 +0 -0
- data/spec/dummy/tmp/cache/assets/D36/4C0/sprockets%2Fba10098fc535146ed4fb9744cf262a0c +0 -0
- data/spec/dummy/tmp/cache/assets/D36/E20/sprockets%2Fa6d48550d8c46cb4a91e2b1aa147647c +0 -0
- data/spec/dummy/tmp/cache/assets/D37/300/sprockets%2F2d0e503e6a7c7c7fdc9912501b2f6b43 +0 -0
- data/spec/dummy/tmp/cache/assets/D37/890/sprockets%2F4728d0522ff8b44c0230bc9feb46be25 +0 -0
- data/spec/dummy/tmp/cache/assets/D37/FF0/sprockets%2F96841ca4cfae32c515077f3f5fc303b2 +0 -0
- data/spec/dummy/tmp/cache/assets/D38/B00/sprockets%2F32615e65544417aa3b3f46beb86d8bab +0 -0
- data/spec/dummy/tmp/cache/assets/D38/EE0/sprockets%2Ff84b1f15209a63ac21fbca89354a466e +0 -0
- data/spec/dummy/tmp/cache/assets/D39/4A0/sprockets%2F021a93e3443aaeee934d31ace59b5298 +0 -0
- data/spec/dummy/tmp/cache/assets/D3B/750/sprockets%2F82e2c0b56fb8a696d2d21914ee435bb3 +0 -0
- data/spec/dummy/tmp/cache/assets/D3C/840/sprockets%2Fc6202ec91d567a85bd3d46dc43ea9108 +0 -0
- data/spec/dummy/tmp/cache/assets/D3C/DF0/sprockets%2F8c7116c8ff734a0445d01f6cc765aa2f +0 -0
- data/spec/dummy/tmp/cache/assets/D3D/CF0/sprockets%2F91b40ebc02b8e92d0c44af437f7a7747 +0 -0
- data/spec/dummy/tmp/cache/assets/D3D/EC0/sprockets%2F1aa82cb99ef076aea10d472b30a58979 +0 -0
- data/spec/dummy/tmp/cache/assets/D3E/6E0/sprockets%2Fe326381907f18ac9ebbbc4de4e551281 +0 -0
- data/spec/dummy/tmp/cache/assets/D3E/F00/sprockets%2Fc7cbb28f23435b47b55562633ebfd3e5 +0 -0
- data/spec/dummy/tmp/cache/assets/D40/840/sprockets%2F9fef661284bc4c706438d2629cada3b2 +0 -0
- data/spec/dummy/tmp/cache/assets/D40/BD0/sprockets%2Ff846b62ec1982fc9a08d8a5390bd2c11 +0 -0
- data/spec/dummy/tmp/cache/assets/D41/470/sprockets%2Fe3b48827fa5c8d5d6131a8632e2a6fe2 +0 -0
- data/spec/dummy/tmp/cache/assets/D42/240/sprockets%2Fb0a17667d30992ced7cb88ab27592e3a +0 -0
- data/spec/dummy/tmp/cache/assets/D43/A10/sprockets%2F8442b5fecbe0cef217a02cb732879678 +0 -0
- data/spec/dummy/tmp/cache/assets/D44/030/sprockets%2Fdc7a0bf839ad6259b834663cde80e522 +0 -0
- data/spec/dummy/tmp/cache/assets/D44/5E0/sprockets%2F68a138c150ab5c4805673fee71d7ffa8 +0 -0
- data/spec/dummy/tmp/cache/assets/D44/910/sprockets%2Ff64342f6e93f0fe77fb584e418ea00b0 +0 -0
- data/spec/dummy/tmp/cache/assets/D44/A20/sprockets%2Ff3fb7b03f18b606976ef357b5452faa4 +0 -0
- data/spec/dummy/tmp/cache/assets/D44/E90/sprockets%2F05cfc0bf7c9938963d1d1c63248db80d +0 -0
- data/spec/dummy/tmp/cache/assets/D45/C30/sprockets%2Fcc744877558178a3adb77c441cadce70 +0 -0
- data/spec/dummy/tmp/cache/assets/D47/A90/sprockets%2Fe7ca382b607c595ea6505853f7fb63da +0 -0
- data/spec/dummy/tmp/cache/assets/D47/CC0/sprockets%2F78f1463961f6712fa6a254aece0e5e6f +0 -0
- data/spec/dummy/tmp/cache/assets/D48/160/sprockets%2F32bae66fd65ce3643efb543182f2e885 +0 -0
- data/spec/dummy/tmp/cache/assets/D49/1F0/sprockets%2F773b56f87127c6605e7d1d3faf2b6af6 +0 -0
- data/spec/dummy/tmp/cache/assets/D49/9B0/sprockets%2F6d919ff7440d2b2a2f7e8912ddd8d640 +0 -0
- data/spec/dummy/tmp/cache/assets/D49/A10/sprockets%2Fc4656bd995a6f297c26d19b13aadb963 +0 -0
- data/spec/dummy/tmp/cache/assets/D4C/980/sprockets%2F813d8d2c9dfa2b6bb4907726dc4e9575 +0 -0
- data/spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/dummy/tmp/cache/assets/D4F/EC0/sprockets%2Ffb723a95fdf3f22571f8d2a5be657973 +0 -0
- data/spec/dummy/tmp/cache/assets/D50/D70/sprockets%2Fe2a3e6c95b11e0801a4eebae3a026026 +0 -0
- data/spec/dummy/tmp/cache/assets/D51/400/sprockets%2Ff5e433d8a31e80985b75ce598de236be +0 -0
- data/spec/dummy/tmp/cache/assets/D53/810/sprockets%2Fcea155118675976bd5fe591de76c7d2f +0 -0
- data/spec/dummy/tmp/cache/assets/D55/780/sprockets%2Ff2b8306673b8de97a955ad0bf9f59f07 +0 -0
- data/spec/dummy/tmp/cache/assets/D55/DF0/sprockets%2F65c7453638b948fce2c5da092f8d8b9c +0 -0
- data/spec/dummy/tmp/cache/assets/D56/5F0/sprockets%2Fde5fb7392753dffc426572fad96298f0 +0 -0
- data/spec/dummy/tmp/cache/assets/D57/C80/sprockets%2Fc48670f82e2725ba8a976ef89dbd14f7 +0 -0
- data/spec/dummy/tmp/cache/assets/D57/E80/sprockets%2F936422a2cde24ab55b13e1b7bc0477ab +0 -0
- data/spec/dummy/tmp/cache/assets/D58/A60/sprockets%2Ffbd202c6ff799289e8487dc6408c3fc3 +0 -0
- data/spec/dummy/tmp/cache/assets/D58/EB0/sprockets%2F711fd84e41ed999c5d4c5a257e4e69c8 +0 -0
- data/spec/dummy/tmp/cache/assets/D59/8C0/sprockets%2F669f568485ea47c9cdc9deb9c5430e60 +0 -0
- data/spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/D5B/040/sprockets%2F1fe2cdf73111b418f2050ffd24438cab +0 -0
- data/spec/dummy/tmp/cache/assets/D5C/710/sprockets%2F9427d05cee2caa721241a25a9af1d08f +0 -0
- data/spec/dummy/tmp/cache/assets/D5C/CC0/sprockets%2Faa8bf6de211f2765b0a26f112b971f0c +0 -0
- data/spec/dummy/tmp/cache/assets/D5E/000/sprockets%2Fd6ed282a19da1494e200cb546dd06fa1 +0 -0
- data/spec/dummy/tmp/cache/assets/D5E/2C0/sprockets%2F3bcd6824fda2af4d4271cf241064aa66 +0 -0
- data/spec/dummy/tmp/cache/assets/D5E/FA0/sprockets%2Fc81c371ae2d61a6aa1708262fba79e0d +0 -0
- data/spec/dummy/tmp/cache/assets/D5F/8D0/sprockets%2F81d09e3bf818cc04391abc11af2e551d +0 -0
- data/spec/dummy/tmp/cache/assets/D61/1F0/sprockets%2F0c7a6176d2fc4db00bb9a74d36380fe1 +0 -0
- data/spec/dummy/tmp/cache/assets/D61/E60/sprockets%2F301aede3913de3c54c91b65cf2bd3381 +0 -0
- data/spec/dummy/tmp/cache/assets/D65/AD0/sprockets%2Fcc53fff930eaf306c15c4568cb265c00 +0 -0
- data/spec/dummy/tmp/cache/assets/D67/270/sprockets%2Fd465b64d071d2bdcdfa5cb9a67941502 +0 -0
- data/spec/dummy/tmp/cache/assets/D67/BC0/sprockets%2F35d2c2b45981ade5a2db2a9c7f37a615 +0 -0
- data/spec/dummy/tmp/cache/assets/D67/C20/sprockets%2F0d30bf27e5f74bbd85f313cb8d3c4623 +0 -0
- data/spec/dummy/tmp/cache/assets/D68/9E0/sprockets%2F98ab9a84a3916f0db147a06dbadb7416 +0 -0
- data/spec/dummy/tmp/cache/assets/D68/E40/sprockets%2Fdf17b1ee801b453787c73dd6be12e04b +0 -0
- data/spec/dummy/tmp/cache/assets/D69/8E0/sprockets%2F843b073aacad148a35d4932bd79d16fe +0 -0
- data/spec/dummy/tmp/cache/assets/D69/F90/sprockets%2F6a0795b7b38bd7e6142cd1b88211dade +0 -0
- data/spec/dummy/tmp/cache/assets/D6A/2D0/sprockets%2F827606b3fb0bf38eda9c52bbb398421c +0 -0
- data/spec/dummy/tmp/cache/assets/D6A/950/sprockets%2F429b1806cb7580ebf29f9a12c33cbea6 +0 -0
- data/spec/dummy/tmp/cache/assets/D6C/9C0/sprockets%2Fd66bdf546164ba223e20f56b5591ddfd +0 -0
- data/spec/dummy/tmp/cache/assets/D6D/DA0/sprockets%2Fac936bf40b42227a2bf9d474ae9ec149 +0 -0
- data/spec/dummy/tmp/cache/assets/D6E/100/sprockets%2F49c09b0dc6ff93d40a75cb21fe290f63 +0 -0
- data/spec/dummy/tmp/cache/assets/D6E/440/sprockets%2Fea163e80716638beecfab4232ea589e2 +0 -0
- data/spec/dummy/tmp/cache/assets/D6F/310/sprockets%2F624b651d37f7ec0c563c446fbf8afb32 +0 -0
- data/spec/dummy/tmp/cache/assets/D6F/5B0/sprockets%2F5dcc801a7a6c340c5baf525839f9b8b6 +0 -0
- data/spec/dummy/tmp/cache/assets/D6F/6A0/sprockets%2F049e1a560dbb9e05ea8c80f819f87ab0 +0 -0
- data/spec/dummy/tmp/cache/assets/D70/B00/sprockets%2F268e2650ac2842bedc9589fa50dea3a7 +0 -0
- data/spec/dummy/tmp/cache/assets/D71/A70/sprockets%2F4f10f5dd56c8a3ff78c460bbe3723a39 +0 -0
- data/spec/dummy/tmp/cache/assets/D71/D90/sprockets%2F6dbe8400ecd795a5d35d88b7761e0b0c +0 -0
- data/spec/dummy/tmp/cache/assets/D72/0A0/sprockets%2Fea31903c67f4ba197e25387b5dadef18 +0 -0
- data/spec/dummy/tmp/cache/assets/D75/450/sprockets%2F255ea2d250f249ac9c01fef695e8ab69 +0 -0
- data/spec/dummy/tmp/cache/assets/D75/7C0/sprockets%2F6e3687d47dcb4d2d533beb13097fe0f7 +0 -0
- data/spec/dummy/tmp/cache/assets/D75/900/sprockets%2F74b847bd8ff90740d31a43ad3787adbf +0 -0
- data/spec/dummy/tmp/cache/assets/D76/570/sprockets%2Feedc30392824106dbedb037f86e56fe9 +0 -0
- data/spec/dummy/tmp/cache/assets/D76/E00/sprockets%2F50fed4db42859966abf7ca704efe3801 +0 -0
- data/spec/dummy/tmp/cache/assets/D77/B30/sprockets%2F946cf2f17c7eb41037f9ee08ad67ec40 +0 -0
- data/spec/dummy/tmp/cache/assets/D78/2F0/sprockets%2F3c61f8915b8f717b1de788e6ecad122c +0 -0
- data/spec/dummy/tmp/cache/assets/D78/A80/sprockets%2Ff318eea7f126a77324697d6c64cefc1b +0 -0
- data/spec/dummy/tmp/cache/assets/D78/F10/sprockets%2Fa2d995664d1a9bf976c1bfbbb90f8710 +0 -0
- data/spec/dummy/tmp/cache/assets/D7A/190/sprockets%2F3db76fe68ad94be075dbc7524068f73a +0 -0
- data/spec/dummy/tmp/cache/assets/D7B/670/sprockets%2F8d4d09ed03575bc962fc960a80daf89b +0 -0
- data/spec/dummy/tmp/cache/assets/D7B/A10/sprockets%2F115c6bdb61feb003b1ec5a22b650dc70 +0 -0
- data/spec/dummy/tmp/cache/assets/D7C/480/sprockets%2F838cc81e53dac547f4677fb51536deea +0 -0
- data/spec/dummy/tmp/cache/assets/D7D/300/sprockets%2F99a2d55cdabf50d15798e04ef48c268d +0 -0
- data/spec/dummy/tmp/cache/assets/D7E/580/sprockets%2Fc05df808e9f42954a2ac6d77f4fa37d6 +0 -0
- data/spec/dummy/tmp/cache/assets/D7E/7B0/sprockets%2Ff3af9cd747e409763dc5f54a287a28bd +0 -0
- data/spec/dummy/tmp/cache/assets/D7E/C10/sprockets%2F747c98c3cc7494a62dd882752adffb2b +0 -0
- data/spec/dummy/tmp/cache/assets/D7E/C30/sprockets%2F769700a5e78898ce10adfeb708dd8d3a +0 -0
- data/spec/dummy/tmp/cache/assets/D83/2E0/sprockets%2Fda0e7087dd71899a9190c915cfec3f7f +0 -0
- data/spec/dummy/tmp/cache/assets/D84/730/sprockets%2Fd1594df6eb925fad655388ed16ca3e97 +0 -0
- data/spec/dummy/tmp/cache/assets/D85/5D0/sprockets%2Fde362e334a475cfca1a30fa5b713b43a +0 -0
- data/spec/dummy/tmp/cache/assets/D8C/520/sprockets%2F221cd58a042baac534d27e4cfedc1188 +0 -0
- data/spec/dummy/tmp/cache/assets/D8D/330/sprockets%2Feebcc6d7139d702bbca0b9503297a40b +0 -0
- data/spec/dummy/tmp/cache/assets/D8E/B60/sprockets%2F4b0c2be5008d0a0cfabff66396d54e24 +0 -0
- data/spec/dummy/tmp/cache/assets/D8F/730/sprockets%2Fa1baa64252215c3ae8ad0f3e53a79c9f +0 -0
- data/spec/dummy/tmp/cache/assets/D92/3D0/sprockets%2Fbcbe263bbf11dc9214435b9fdb64661b +0 -0
- data/spec/dummy/tmp/cache/assets/D93/AE0/sprockets%2F2b6352ed136a4ec37bd8c052bd4cb94e +0 -0
- data/spec/dummy/tmp/cache/assets/D95/2A0/sprockets%2F0400dd7cb35156becbbe56d21d9be776 +0 -0
- data/spec/dummy/tmp/cache/assets/D96/CA0/sprockets%2F9ddd0fc49b5aa172cf27ea22f1007f93 +0 -0
- data/spec/dummy/tmp/cache/assets/D97/520/sprockets%2Fea2442ae4caddb758dfb1964c601b476 +0 -0
- data/spec/dummy/tmp/cache/assets/D97/5B0/sprockets%2F7298f2202fb3b32eb8d082e3ed5add3d +0 -0
- data/spec/dummy/tmp/cache/assets/D9A/1B0/sprockets%2Fcd5e53be61cba95b5b0b81865b54d1f6 +0 -0
- data/spec/dummy/tmp/cache/assets/D9A/610/sprockets%2F84ede7f893018d9bea835f68c8f9ff83 +0 -0
- data/spec/dummy/tmp/cache/assets/D9B/5F0/sprockets%2Fb6ae4b74a9de2d8e0301a3c60099f9fb +0 -0
- data/spec/dummy/tmp/cache/assets/D9B/860/sprockets%2Fbb235cfe35b6451f6e32ffd271657eaa +0 -0
- data/spec/dummy/tmp/cache/assets/D9C/240/sprockets%2F5f68fb3f496c391c16aba45eca35ac16 +0 -0
- data/spec/dummy/tmp/cache/assets/D9E/CB0/sprockets%2Ff0efe0ab6bd753a8bb4481e46243d77f +0 -0
- data/spec/dummy/tmp/cache/assets/D9F/240/sprockets%2Fb49cb72a0d3c5acc716f869b7e1b82e4 +0 -0
- data/spec/dummy/tmp/cache/assets/DA1/2F0/sprockets%2F38aba5d40f6c8f55628383f1bee42cce +0 -0
- data/spec/dummy/tmp/cache/assets/DA1/610/sprockets%2F8e1affe8d3aaf50203f38815fbfe3276 +0 -0
- data/spec/dummy/tmp/cache/assets/DA2/080/sprockets%2Fbd60c499c297fc4decc19c930d6a25d1 +0 -0
- data/spec/dummy/tmp/cache/assets/DA3/780/sprockets%2Fff91edf7359e8b136482202aa7aeb4df +0 -0
- data/spec/dummy/tmp/cache/assets/DA5/0A0/sprockets%2F7a4b5928cec69ab65afff309a04d6b47 +0 -0
- data/spec/dummy/tmp/cache/assets/DA6/440/sprockets%2F5a10f4bab16828e582e57cdeef95c9b3 +0 -0
- data/spec/dummy/tmp/cache/assets/DA8/9D0/sprockets%2F27f6626356c7beb5f88ae2abfd318df2 +0 -0
- data/spec/dummy/tmp/cache/assets/DA9/BF0/sprockets%2Fc59f8f7bf494fe030610bc86bb7cc5e5 +0 -0
- data/spec/dummy/tmp/cache/assets/DAB/400/sprockets%2F52eed96b338eff526fc0198c61dd09eb +0 -0
- data/spec/dummy/tmp/cache/assets/DAE/4E0/sprockets%2F88cc3ab99c608879dd56164dbcc2ccb7 +0 -0
- data/spec/dummy/tmp/cache/assets/DAF/E90/sprockets%2Fc75bc7e2c949f7cfeb89b5e422352ea6 +0 -0
- data/spec/dummy/tmp/cache/assets/DB0/C60/sprockets%2Fdfb9bb691a396957a05ef79dea41d8c4 +0 -0
- data/spec/dummy/tmp/cache/assets/DB2/D70/sprockets%2Fe03d9b5c98dae04fa8eac8fb68697390 +0 -0
- data/spec/dummy/tmp/cache/assets/DB5/040/sprockets%2F9a9da5df88713663b9fbc945facca891 +0 -0
- data/spec/dummy/tmp/cache/assets/DB5/860/sprockets%2Facf25fab3016425a0e03c9d190fd4eac +0 -0
- data/spec/dummy/tmp/cache/assets/DBE/320/sprockets%2Faec8daa017ce18f166a19c1771dbfb03 +0 -0
- data/spec/dummy/tmp/cache/assets/DBF/D20/sprockets%2F3aea2f3e237abe2a9ed20b93f11d428f +0 -0
- data/spec/dummy/tmp/cache/assets/DC0/7B0/sprockets%2F8cb4d6e0c80cbf4dced28b20f07137d0 +0 -0
- data/spec/dummy/tmp/cache/assets/DC3/230/sprockets%2Fdf52e72eb73be91eccc60182191aed0b +0 -0
- data/spec/dummy/tmp/cache/assets/DC3/AC0/sprockets%2Fe29911eb34fdf4b710dd0d2c2cf24bc9 +0 -0
- data/spec/dummy/tmp/cache/assets/DC4/090/sprockets%2F7542f412d4caefe4f471bacf0c5861ca +0 -0
- data/spec/dummy/tmp/cache/assets/DC4/630/sprockets%2F4e84eafec121a136fcec3546b921eb6b +0 -0
- data/spec/dummy/tmp/cache/assets/DC5/EF0/sprockets%2F1c21100cd8e65c7f3fdcab61c5f77b9a +0 -0
- data/spec/dummy/tmp/cache/assets/DC7/A10/sprockets%2F84a8af0fcbf401864e1ae5bf092cba94 +0 -0
- data/spec/dummy/tmp/cache/assets/DC8/110/sprockets%2Faf09fc16a29e34c256dbbfa80a44b97b +0 -0
- data/spec/dummy/tmp/cache/assets/DCA/AD0/sprockets%2Fc5a76d97d72e0f35cb6aa2ea3f52c9c0 +0 -0
- data/spec/dummy/tmp/cache/assets/DCB/630/sprockets%2F0a6fda53cef15b3241be6457ac8b79ee +0 -0
- data/spec/dummy/tmp/cache/assets/DCC/AD0/sprockets%2Fcc866a8b1e1e8bf0d1470dcf7a09d72d +0 -0
- data/spec/dummy/tmp/cache/assets/DCD/EB0/sprockets%2F4f77f509126ecbced7ea2a5ab290c8d4 +0 -0
- data/spec/dummy/tmp/cache/assets/DCE/070/sprockets%2Fb6ddeed67c9ebb1834d6252ef0360d1f +0 -0
- data/spec/dummy/tmp/cache/assets/DCF/180/sprockets%2F9b325ef8af6f3d73b2fae1ddc62e2390 +0 -0
- data/spec/dummy/tmp/cache/assets/DCF/470/sprockets%2F2cfb3b8dd618a3985ac031db4fff871d +0 -0
- data/spec/dummy/tmp/cache/assets/DCF/8E0/sprockets%2F93e5d1b5dbfb40c3ad83692be9bb4e83 +0 -0
- data/spec/dummy/tmp/cache/assets/DCF/EB0/sprockets%2F02b4dd6785efb5ededa709d644a41ef1 +0 -0
- data/spec/dummy/tmp/cache/assets/DD1/4A0/sprockets%2Fde773ef01f38c9badc18b84c8022fb9a +0 -0
- data/spec/dummy/tmp/cache/assets/DD2/380/sprockets%2Fb97cfae90eb6314406519cda89a8dabe +0 -0
- data/spec/dummy/tmp/cache/assets/DD5/800/sprockets%2Ffda6208e29dc706ed387dcf6fbd062c5 +0 -0
- data/spec/dummy/tmp/cache/assets/DD8/410/sprockets%2Fa02603cca05ea0be3bda36fcdd30c841 +0 -0
- data/spec/dummy/tmp/cache/assets/DD8/D30/sprockets%2Feceaf7dce3295f2be5122df84fc59912 +0 -0
- data/spec/dummy/tmp/cache/assets/DDB/310/sprockets%2Facd5ff0e0a2d8c85034e6e0ed98ec988 +0 -0
- data/spec/dummy/tmp/cache/assets/DDB/4D0/sprockets%2F266a8cc69e818d1ddffe2c3b08456fbf +0 -0
- data/spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/DE1/DB0/sprockets%2F36ef78dc8a94f2c9b95babd318aa87c8 +0 -0
- data/spec/dummy/tmp/cache/assets/DE1/F00/sprockets%2Fb9c4dd7fc3ee2ef6c9fa0834636569cc +0 -0
- data/spec/dummy/tmp/cache/assets/DE4/140/sprockets%2F139e4ab85d1aacb22c115fa136afdc8a +0 -0
- data/spec/dummy/tmp/cache/assets/DE8/890/sprockets%2Fb5b832aab2d232dbfbf2175b43dc7e5a +0 -0
- data/spec/dummy/tmp/cache/assets/DEB/110/sprockets%2F2dbdab0ce5babca645cdb5780004f875 +0 -0
- data/spec/dummy/tmp/cache/assets/DEF/D70/sprockets%2Fd2dd8561afb084ce11c38ca7a6d0afe2 +0 -0
- data/spec/dummy/tmp/cache/assets/DF0/250/sprockets%2F13d5b48ac25fae3b5fbf815dbeda0624 +0 -0
- data/spec/dummy/tmp/cache/assets/DF1/1B0/sprockets%2F2b1bc202f9a338942edbccb2cfef0d67 +0 -0
- data/spec/dummy/tmp/cache/assets/DF1/DB0/sprockets%2Fdcf49a5ce11aa5e31de0cfb78c0f1905 +0 -0
- data/spec/dummy/tmp/cache/assets/DF2/2E0/sprockets%2F4770759c4a66e996f4fded83f6ddfddd +0 -0
- data/spec/dummy/tmp/cache/assets/DF4/2F0/sprockets%2F1e83ae0cfdcae29ad98466b1a66d20ac +0 -0
- data/spec/dummy/tmp/cache/assets/DF6/0E0/sprockets%2F85b10db6e1afe643aba6d396abdd77f0 +0 -0
- data/spec/dummy/tmp/cache/assets/DF6/420/sprockets%2Ff1b2c8c5be5f2d33de5d540a3e62ca8f +0 -0
- data/spec/dummy/tmp/cache/assets/DF8/900/sprockets%2Fd924dea4cc364aedeea287029ccda435 +0 -0
- data/spec/dummy/tmp/cache/assets/DF9/E10/sprockets%2Fba2ada9f607edea6b98cc72a4e70d433 +0 -0
- data/spec/dummy/tmp/cache/assets/DFC/C30/sprockets%2Fb50a07cb30b0bd0eec8e98e5de79d65d +0 -0
- data/spec/dummy/tmp/cache/assets/DFF/0D0/sprockets%2Fc3ec68c48db663fa45ab4d6fe33dcf13 +0 -0
- data/spec/dummy/tmp/cache/assets/E00/2B0/sprockets%2Fffeda2454f8128abad731f07d7ea88da +0 -0
- data/spec/dummy/tmp/cache/assets/E01/B70/sprockets%2Fd6defcb54f67eac14ccf6203f36ad954 +0 -0
- data/spec/dummy/tmp/cache/assets/E02/6E0/sprockets%2F63d6a5cdb8cefa64ef76b5c6e0fd3720 +0 -0
- data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/E07/8B0/sprockets%2F426ebeaf61b095557dfab89fd2e5e4eb +0 -0
- data/spec/dummy/tmp/cache/assets/E08/BB0/sprockets%2Fefac99af1af28543aef6fb607faa4973 +0 -0
- data/spec/dummy/tmp/cache/assets/E08/F10/sprockets%2F8cc67880efb9b750c30ac8a7abe58fbf +0 -0
- data/spec/dummy/tmp/cache/assets/E0D/070/sprockets%2F0e7ef9a5978dcc6b1abce678ef836c0a +0 -0
- data/spec/dummy/tmp/cache/assets/E14/8E0/sprockets%2Fb8d902ffcf8758fde63d0fa579ba6d4e +0 -0
- data/spec/dummy/tmp/cache/assets/E17/EF0/sprockets%2Fa291ad64a26afd055dfadabbdf03f154 +0 -0
- data/spec/dummy/tmp/cache/assets/E1C/D80/sprockets%2F4b95bfa6daa08c4eb0aa541a37e4d2fe +0 -0
- data/spec/dummy/tmp/cache/assets/E20/980/sprockets%2Fc90a064de7a16bb06df5b9ad4c1ed8ab +0 -0
- data/spec/dummy/tmp/cache/assets/E38/C40/sprockets%2F98dfe383fba3e8b185bcc47a6e1ebfc5 +0 -0
- data/spec/dummy/tmp/cache/assets/E53/950/sprockets%2Fffd7c2c672c3f8e8f87dff7919aeccd9 +0 -0
- data/spec/dummy/tmp/cache/assets/E56/0F0/sprockets%2Fc8da7a5dae8a9e6b0de61b381fec0b3c +0 -0
- data/spec/dummy/tmp/cache/assets/E58/310/sprockets%2Fecdb86ebf64d9140f01a903fbfad8cda +0 -0
- data/spec/dummy/tmp/cache/assets/E63/9A0/sprockets%2F6d75fdbce8bba3e734dc5fea6f2171ef +0 -0
- data/spec/dummy/tmp/cache/assets/E6E/260/sprockets%2Fd9f8ab8b91ef582cc6c99a3ba0dedfe6 +0 -0
- data/spec/dummy/tmp/cache/assets/E85/310/sprockets%2Ffa0facaebe1ccce1bc6d1e3e713976f7 +0 -0
- data/spec/dummy/tmp/cache/assets/EDE/7E0/sprockets%2F468f97db5bcfefe9bd7fec5fcc7dc77c +0 -0
- data/spec/dummy/tmp/cache/assets/F79/360/sprockets%2F0ce035fefee5ebdabc8efabfbdbd6ee4 +0 -0
- data/spec/dummy/tmp/cache/sass/86d3de43d0e3ec731ffbea073a11ea4a51eb7ee4/stylesheet1.css.scssc +0 -0
- data/spec/dummy/tmp/cache/sass/86d3de43d0e3ec731ffbea073a11ea4a51eb7ee4/stylesheet3.css.sassc +0 -0
- data/spec/javascripts/fixtures/fixture.html.haml +4 -0
- data/spec/javascripts/jasmine_helper.coffee +3 -0
- data/spec/javascripts/mocha_helper.coffee +3 -0
- data/spec/javascripts/spec_helper.coffee +5 -0
- data/spec/javascripts/stylesheets/stylesheet.css.scss +0 -0
- data/spec/javascripts/support/support.js.coffee +0 -0
- data/spec/javascripts/teabag/base/reporters/console_spec.coffee +121 -0
- data/spec/javascripts/teabag/base/reporters/html/failure_view_spec.coffee +1 -0
- data/spec/javascripts/teabag/base/reporters/html/progress_view_spec.coffee +1 -0
- data/spec/javascripts/teabag/base/reporters/html/spec_view_spec.coffee +1 -0
- data/spec/javascripts/teabag/base/reporters/html/suite_view_spec.coffee +1 -0
- data/spec/javascripts/teabag/base/reporters/html_spec.coffee +342 -0
- data/spec/javascripts/teabag/base/reporters_spec.coffee +267 -0
- data/spec/javascripts/teabag/base/runner_spec.coffee +34 -0
- data/spec/javascripts/teabag/base/teabag_spec.coffee +24 -0
- data/spec/javascripts/teabag/jasmine/jasmine_jspec.coffee +44 -0
- data/spec/javascripts/teabag/jasmine/reporters/html_jspec.coffee +17 -0
- data/spec/javascripts/teabag/jasmine/runner_jspec.coffee +66 -0
- data/spec/javascripts/teabag/mocha/mocha_mspec.coffee +47 -0
- data/spec/javascripts/teabag/mocha/reporters/console_mspec.coffee +20 -0
- data/spec/javascripts/teabag/mocha/reporters/html_mspec.coffee +51 -0
- data/spec/javascripts/teabag/mocha/runner_mspec.coffee +23 -0
- data/spec/javascripts/teabag/phantomjs/runner_spec.coffee +161 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/teabag/configuration_spec.rb +95 -0
- data/spec/teabag/console_spec.rb +71 -0
- data/spec/teabag/engine_spec.rb +19 -0
- data/spec/teabag/formatters/progress_formatter_spec.rb +124 -0
- data/spec/teabag/result_spec.rb +85 -0
- data/spec/teabag/runner_spec.rb +74 -0
- data/spec/teabag/server_spec.rb +99 -0
- data/spec/teabag/suite_spec.rb +57 -0
- metadata +1029 -0
data/MIT.LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright 2012 Jeremy Jackson / ModeSet
|
2
|
+
|
3
|
+
https://github.com/modeset/teabag
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,407 @@
|
|
1
|
+
Teabag
|
2
|
+
======
|
3
|
+
|
4
|
+
Teabag is a Javascript test runner built on top of Rails. It can run tests in the browser, or headlessly using PhantomJS.
|
5
|
+
|
6
|
+
Ok, another test runner, right? Really? Yeah, that's a tough one, but we're pretty confident Teabag is the nicest one 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.
|
7
|
+
|
8
|
+
The intention is to be the simplest but most complete Javascript testing solution for Rails, taking full advantage of the asset pipeline. It ships with support for both Jasmine and Mocha, and has custom reporters for both libraries.
|
9
|
+
|
10
|
+
We've just released Teabag, and we expect to be working on it for a while to get a glossy shine to everything, so check it out and let us know what you think. Feedback, ideas and pull requests would be awesome.
|
11
|
+
|
12
|
+
## Screenshots
|
13
|
+
### Running in the console
|
14
|
+
![Console Reporter](https://raw.github.com/modeset/teabag/master/screenshots/console-reporter.png)
|
15
|
+
### Running in the browser
|
16
|
+
![Browser Reporter](https://raw.github.com/modeset/teabag/master/screenshots/html-reporter.png)
|
17
|
+
|
18
|
+
|
19
|
+
## Table of Contents
|
20
|
+
|
21
|
+
1. [Installation](#installation)
|
22
|
+
2. [Quickstart](#quickstart)
|
23
|
+
3. [Usage](#usage)
|
24
|
+
4. [Writing Specs](#writing-specs)
|
25
|
+
5. [Suites](#suites)
|
26
|
+
6. [Configuration](#configuration)
|
27
|
+
7. [Test Frameworks](#test-frameworks)
|
28
|
+
8. [Support Libraries](#support-libraries)
|
29
|
+
9. [CI Support](#ci-support)
|
30
|
+
10. [Roadmap](#roadmap)
|
31
|
+
|
32
|
+
## Installation
|
33
|
+
|
34
|
+
Add it to your Gemfile. In almost all cases you'll want to restrict it to the `:asset`, or `:development, :test` groups.
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
group :assets do
|
38
|
+
gem "teabag"
|
39
|
+
end
|
40
|
+
```
|
41
|
+
|
42
|
+
Optionally run the install generator to get the initializer and a basic spec helper if you want them.
|
43
|
+
|
44
|
+
```
|
45
|
+
rails generate teabag:install
|
46
|
+
```
|
47
|
+
|
48
|
+
## Quick Start
|
49
|
+
|
50
|
+
1. Create a new Rails app
|
51
|
+
2. Install Teabag and bootstrap it with the generator (`rails g teabag:install`)
|
52
|
+
3. Write your first spec (explained in a sec)
|
53
|
+
4. Run the test suite
|
54
|
+
5. red. green. refactor.
|
55
|
+
|
56
|
+
### Writing your first spec
|
57
|
+
|
58
|
+
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)`.
|
59
|
+
|
60
|
+
Let's write a basic class and spec in CoffeeScript using Jasmine (though you could just as easily use vanilla Javascript and/or Mocha). Create `spec/javascripts/calculator_spec.coffee` and put this in it:
|
61
|
+
|
62
|
+
```coffeescript
|
63
|
+
#= require calculator
|
64
|
+
|
65
|
+
describe 'Calculator', ->
|
66
|
+
|
67
|
+
it 'should add two digits', ->
|
68
|
+
calc = new Calculator()
|
69
|
+
expect( calc.add(2,2) ).toBe(4)
|
70
|
+
```
|
71
|
+
|
72
|
+
Create `app/assets/javascripts/calculator.coffee` and put this in it:
|
73
|
+
|
74
|
+
```coffeescript
|
75
|
+
class @Calculator
|
76
|
+
```
|
77
|
+
|
78
|
+
Run `rake teabag` - you should see your first failing spec.
|
79
|
+
|
80
|
+
```
|
81
|
+
Failures:
|
82
|
+
|
83
|
+
1) calculator should add two numbers.
|
84
|
+
Failure/Error: TypeError: 'undefined' is not a function
|
85
|
+
|
86
|
+
Finished in 0.01600 seconds
|
87
|
+
1 example, 1 failure
|
88
|
+
|
89
|
+
Failed examples:
|
90
|
+
|
91
|
+
/teabag/default?grep=calculator%20should%20add%20two%20numbers.
|
92
|
+
```
|
93
|
+
|
94
|
+
Now we just need make the test pass. Let's implement the `add` method on Calculator.
|
95
|
+
|
96
|
+
```coffeescript
|
97
|
+
add: (a, b) ->
|
98
|
+
a + b
|
99
|
+
```
|
100
|
+
|
101
|
+
Run `rake teabag` again - that spec should now be passing!
|
102
|
+
|
103
|
+
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.
|
104
|
+
|
105
|
+
|
106
|
+
## Usage
|
107
|
+
|
108
|
+
Teabag uses the Rails asset pipeline to serve files which means you're free to use things like CoffeeScript. This simplifies the fixtures as well and lets you do some pretty awesome things like use builder, hamlc, rabl, etc. to generate your views.
|
109
|
+
|
110
|
+
If you want a more visual experience you can browse to the specs in the browser, or you can use the rake task to run them headless on the command line with PhantomJS. Works great with CI, too!
|
111
|
+
|
112
|
+
### Browser
|
113
|
+
|
114
|
+
```
|
115
|
+
http://localhost:3000/teabag
|
116
|
+
```
|
117
|
+
|
118
|
+
To run a specific suite use:
|
119
|
+
|
120
|
+
```
|
121
|
+
http://localhost:3000/teabag/my_fantastic_suite
|
122
|
+
```
|
123
|
+
|
124
|
+
### Console
|
125
|
+
|
126
|
+
```
|
127
|
+
rake teabag
|
128
|
+
```
|
129
|
+
|
130
|
+
Specify the suite with the rake task by using:
|
131
|
+
|
132
|
+
```
|
133
|
+
rake teabag suite=my_fantastic_suite
|
134
|
+
```
|
135
|
+
|
136
|
+
When a failure is encountered, a URL will be generated so you can pop open a browser and load a focused run to examine that specific failure.
|
137
|
+
|
138
|
+
You can override a few configurations by using environment variables. `FAILS_FALSE=[true/false]` and `SUPPRESS_LOGS=[false/true]`. You can read more about these configuration directives below.
|
139
|
+
|
140
|
+
**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 an asset compilation optimization, and to keep consistent with what you might see in the browser (since that's likely running in development).
|
141
|
+
|
142
|
+
**Note:** We usually like to include our Javascript specs into the default rake task, like so:
|
143
|
+
|
144
|
+
```ruby
|
145
|
+
task :default => [:spec, :teabag, :cucumber]
|
146
|
+
```
|
147
|
+
|
148
|
+
|
149
|
+
## Writing Specs
|
150
|
+
|
151
|
+
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/) and [Mocha](http://visionmedia.github.com/mocha/).
|
152
|
+
|
153
|
+
Since we have the asset pipeline at our fingertips you can feel free to use the `= require` directive throughout your specs and spec helpers.
|
154
|
+
|
155
|
+
Here's a basic spec written in Javascript using Jasmine:
|
156
|
+
|
157
|
+
```javascript
|
158
|
+
//= require jquery
|
159
|
+
describe("My great feature", function() {
|
160
|
+
|
161
|
+
it("will change the world", function() {
|
162
|
+
expect(true).toBe(true);
|
163
|
+
expect(jQuery).toBeDefined();
|
164
|
+
});
|
165
|
+
|
166
|
+
});
|
167
|
+
```
|
168
|
+
|
169
|
+
Here's that same test written in CoffeeScript using Mocha + [expect.js](https://github.com/LearnBoost/expect.js) (Teabag ships with expect.js and other support libraries like [jasmine-jquery](https://github.com/velesin/jasmine-jquery).):
|
170
|
+
|
171
|
+
```coffeescript
|
172
|
+
#= require jquery
|
173
|
+
describe "My great feature", ->
|
174
|
+
|
175
|
+
it "will change the world", ->
|
176
|
+
expect(true).to.be(true)
|
177
|
+
expect(jQuery).to.not.be(undefined)
|
178
|
+
```
|
179
|
+
|
180
|
+
### Pending Specs
|
181
|
+
|
182
|
+
We've normalized declaring that a spec is pending between the two libraries. 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.
|
183
|
+
|
184
|
+
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.
|
185
|
+
|
186
|
+
```coffeescript
|
187
|
+
describe "My great feature", ->
|
188
|
+
|
189
|
+
it "hasn't been tested yet"
|
190
|
+
|
191
|
+
xit "has a test I can't figure out" ->
|
192
|
+
expect("complexity").to.be("easily testable")
|
193
|
+
|
194
|
+
xdescribe "A whole section that I've not gotten to", ->
|
195
|
+
|
196
|
+
it "hasn't been tested yet", ->
|
197
|
+
expect(true).to.be(false)
|
198
|
+
```
|
199
|
+
|
200
|
+
If you're using one library and you want to take advantage of the things that that library provides you're completely free to do so, and this is provided as a suggestion. The Teabag reporters understand the techniques above and have specs for them.
|
201
|
+
|
202
|
+
### Fixtures
|
203
|
+
|
204
|
+
Teabag fixtures are using jasmine-jquery for now.
|
205
|
+
|
206
|
+
If jasmine-jquery isn't your thing, you can also load your fixtures manually into the "#teabag-fixtures" element.
|
207
|
+
|
208
|
+
The fixture path is configurable, and the views will be rendered by a controller. This allows you to use things like rabl if you're building JSON, or haml if you're building markup.
|
209
|
+
|
210
|
+
To load fixtures in your specs you'll need to include jasmine-jquery -- and then use the `loadFixtures` method.
|
211
|
+
|
212
|
+
```coffeescript
|
213
|
+
#= require jquery
|
214
|
+
#= require jasmine-jquery
|
215
|
+
describe "fixtures", ->
|
216
|
+
|
217
|
+
it "loads fixtures", ->
|
218
|
+
loadFixtures("fixture.html")
|
219
|
+
expect($("#fixture_view")).toExist()
|
220
|
+
```
|
221
|
+
|
222
|
+
### Deferring Execution
|
223
|
+
|
224
|
+
Teabag has the concept of 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.
|
225
|
+
|
226
|
+
You can tell Teabag to defer and then execute the runner later -- after loading asychronously.
|
227
|
+
|
228
|
+
```coffeescript
|
229
|
+
Teabag.defer = true
|
230
|
+
setTimeout(Teabag.execute, 1000) # defers execution for 1 second
|
231
|
+
```
|
232
|
+
|
233
|
+
|
234
|
+
## Suites
|
235
|
+
|
236
|
+
Teabag uses the concept of suites to group your tests at a high level. These suites are run in isolation from one another, and can have different configurations.
|
237
|
+
|
238
|
+
When Teabag is run via the rake task, it will stop at any point that a suite fails, which allows you to create a hierarchy of suites -- crafting tiers of pass expectation. The fail_fast configuration lets you override this behavior -- useful for CI (more on setting these via env in the configuration section).
|
239
|
+
|
240
|
+
You can define suites in the configuration, and for brevity `config` is the argument passed to the `Teabag.setup` block.
|
241
|
+
|
242
|
+
When creating a suite definition you simply pass it a name and a block. The following example defines a suite named "my_suite". You can focus to just this suite by browsing to `/teabag/my_suite` or running the rake task with `suite=my_suite`.
|
243
|
+
|
244
|
+
```ruby
|
245
|
+
config.suite :my_suite do |suite|
|
246
|
+
suite.helper = "my_spec_helper.js"
|
247
|
+
end
|
248
|
+
```
|
249
|
+
|
250
|
+
There's always a "default" suite defined, and you can modify this suite if you don't specify a name, or use `:default`. In this example we're just adjusting the default suite configuration.
|
251
|
+
|
252
|
+
```ruby
|
253
|
+
config.suite do |suite|
|
254
|
+
suite.helper = "other_spec_helper.js"
|
255
|
+
end
|
256
|
+
```
|
257
|
+
|
258
|
+
It's worth noting that suites don't inherit from the default suite values, but instead always fall back to the defaults outlined below.
|
259
|
+
|
260
|
+
### Manifest Style
|
261
|
+
|
262
|
+
Teabag is happy to look for files for you, but you can disable this feature and maintain a manifest yourself. Since each suite can utilize a different spec helper, you can use these to create your own manifest of specs using the `= require` directive.
|
263
|
+
|
264
|
+
Tell the suite that you don't want it to match any files, and then retuire files in your spec helper.
|
265
|
+
|
266
|
+
```ruby
|
267
|
+
config.suite do |suite|
|
268
|
+
suite.matcher = nil
|
269
|
+
suite.helper = "my_spec_manifest"
|
270
|
+
end
|
271
|
+
|
272
|
+
```
|
273
|
+
|
274
|
+
### Suite Configuration Directives
|
275
|
+
|
276
|
+
#### `matcher`
|
277
|
+
|
278
|
+
You can specify a file matcher for your specs, and the matching files will be automatically loaded when the suite is run. It's important that these files are serve-able from sprockets (aka the asset pipeline), and you'll receive an exception if they aren't.
|
279
|
+
|
280
|
+
**default:** `"{spec/javascripts,app/assets}/**/*_spec.{js,js.coffee,coffee}"`
|
281
|
+
|
282
|
+
**Note:** set this to nil if you want to use your spec helper as a manifest.
|
283
|
+
|
284
|
+
#### `helper`
|
285
|
+
|
286
|
+
Each suite can load a different spec helper, which can in turn require additional files since this file is also served via the asset pipeline. This file is loaded before your specs are loaded -- so you can potentially include all of your spec files and use this as a manifest (if you set the matcher to nil).
|
287
|
+
|
288
|
+
**default:** `"spec_helper"`
|
289
|
+
|
290
|
+
#### `javascripts`
|
291
|
+
|
292
|
+
These are the core Teabag javascripts. Spec files should not go here -- but if you want to add additional support for jasmine matchers, switch to mocha, include expectation libraries etc., this is a good place to do that.
|
293
|
+
|
294
|
+
To use mocha switch this to: `"teabag-mocha"`
|
295
|
+
|
296
|
+
To use the coffeescript source files: `"teabag/jasmine"` or `"teabag/mocha"`
|
297
|
+
|
298
|
+
**default:** `["teabag-jasmine"]`
|
299
|
+
|
300
|
+
**Note:** It's strongly encouraged to only include the base files in the `javascripts` directive. You can require any other libraries you need in your spec helper. This makes it easier to maintain because you don't have to restart the server.
|
301
|
+
|
302
|
+
#### `stylesheets`
|
303
|
+
|
304
|
+
If you want to change how Teabag looks, or include your own stylesheets you can do that here. The default is the stylesheet for the HTML reporter.
|
305
|
+
|
306
|
+
**default:** `["teabag"]`
|
307
|
+
|
308
|
+
|
309
|
+
## Configuration
|
310
|
+
|
311
|
+
The best way to read about the configuration options is to generate the initializer, but we've included the info here too.
|
312
|
+
|
313
|
+
**Note:** `Teabag.setup` may not be available in all environments, so keep that in mind. The generator provides a check wrapped around Teabag.setup.
|
314
|
+
|
315
|
+
#### `mount_at`
|
316
|
+
|
317
|
+
This determines where the Teabag spec path will be mounted. Changing this to "/jasmine" would allow you to browse to `http://localhost:3000/jasmine` to run your specs.
|
318
|
+
|
319
|
+
**default:** `"/teabag"`
|
320
|
+
|
321
|
+
#### `root`
|
322
|
+
|
323
|
+
The root path defaults to Rails.root if left nil, but if you're testing an engine using a dummy application it's useful to be able to set this to your engines root.. E.g. `Teabag::Engine.root`
|
324
|
+
|
325
|
+
**default:** `nil`
|
326
|
+
|
327
|
+
#### `asset_paths`
|
328
|
+
|
329
|
+
These paths are appended to the rails assets paths (relative to config.root), and by default is an array that you can replace or add to.
|
330
|
+
|
331
|
+
**default:** `["spec/javascripts", "spec/javascripts/stylesheets"]`
|
332
|
+
|
333
|
+
#### `fixture_path`
|
334
|
+
|
335
|
+
Fixtures are different than the specs, in that Rails is rendering them directly through a controller. This means you can use haml, erb builder, rabl, etc. to render content in the views available in this path.
|
336
|
+
|
337
|
+
**default:** `"spec/javascripts/fixtures"`
|
338
|
+
|
339
|
+
#### `server_timeout`
|
340
|
+
|
341
|
+
Timeout for starting the server in seconds. If your server is slow to start you may have to bump the timeout, or you may want to lower this if you know it shouldn't take long to start.
|
342
|
+
|
343
|
+
**default:** `20`
|
344
|
+
|
345
|
+
#### `fail_fast`
|
346
|
+
When you're running several suites it can be useful to make Teabag fail directly after any suite fails (not continuing on to the next suite), but in environments like CI this isn't as desirable. You can also configure this using the FAIL_FAST environment variable.
|
347
|
+
|
348
|
+
**Note:** override this directive by running `rake teabag FAIL_FAST=false`
|
349
|
+
|
350
|
+
**default:** `true`
|
351
|
+
|
352
|
+
#### `suppress_log`
|
353
|
+
|
354
|
+
When you run Teabag from the console, it will pipe all console.log/debug/etc. calls to the console. This is useful to catch places where you've forgotten to remove console.log calls, but in verbose applications that use logging heavily this may not be desirable.
|
355
|
+
|
356
|
+
**Note:** override this directive by running `rake teabag SUPPRESS_LOG=true`
|
357
|
+
|
358
|
+
**default:** `false`
|
359
|
+
|
360
|
+
|
361
|
+
## Test Frameworks
|
362
|
+
|
363
|
+
[Jasmine](http://pivotal.github.com/jasmine/) is a pretty big aspect of the default setup. We've been using Jasmine for a long time, and have been pretty happy with it. It lacks a few important things that could be in a test framework, so we've done a little bit of work to make that nicer. Like adding pending spec support.
|
364
|
+
|
365
|
+
[Mocha](http://visionmedia.github.com/mocha/) came up while we were working on Teabag -- we read up about it and thought it was a pretty awesome library with some really great approaches to some of the things that some of us browser types should consider more often, so we included it and added support for it. We encourage you to give it a try.
|
366
|
+
|
367
|
+
By default Jasmine will be loaded, and to use Mocha just change your suite to include the Mocha javascript.
|
368
|
+
|
369
|
+
```ruby
|
370
|
+
config.suite do |suite|
|
371
|
+
suite.javascripts = ["teabag-mocha"]
|
372
|
+
end
|
373
|
+
```
|
374
|
+
|
375
|
+
|
376
|
+
## Support Libraries
|
377
|
+
|
378
|
+
Because we know that testing usually requires more than just the test framework we've included some of the great libraries that we use on a regular basis.
|
379
|
+
|
380
|
+
- [jasmine-jquery.js](https://github.com/velesin/jasmine-jquery) jQuery matchers and fixture support (Jasmine).
|
381
|
+
- [Sinon.JS](https://github.com/cjohansen/Sinon.JS) Great for stubbing / spying, and mocking Ajax (Mocha/Jasmine).
|
382
|
+
- [expect.js](https://github.com/LearnBoost/expect.js) Minimalistic BDD assertion toolkit (Mocha).
|
383
|
+
|
384
|
+
|
385
|
+
## CI Support
|
386
|
+
|
387
|
+
There's a few things that we're doing to make Teabag nicer on CI. We're in the process of integrating a jUnit style XML reporter.
|
388
|
+
|
389
|
+
More on this shortly....
|
390
|
+
|
391
|
+
|
392
|
+
## Roadmap
|
393
|
+
|
394
|
+
So, there's lots of directions we can take the Teabag project, but we'll give it some time to see what people are looking for. Here's a short list of things that will probably happen.
|
395
|
+
|
396
|
+
- A Command Line Interface to allow running as `teabag spec/javascripts/calculator_spec.coffee` with proper arguments that will let you override configuration.
|
397
|
+
|
398
|
+
- Add support for running Teabag using selenium.
|
399
|
+
|
400
|
+
- Improve the user interface in the HTML reporter by adding a select for switching suites.
|
401
|
+
|
402
|
+
- Ensure that the HTML reporter is working in IE6+ (give it a shot and let us know -- tested in IE9+).
|
403
|
+
|
404
|
+
|
405
|
+
## License
|
406
|
+
|
407
|
+
Licensed under the [MIT License](http://creativecommons.org/licenses/MIT/)
|
Binary file
|
@@ -0,0 +1,3488 @@
|
|
1
|
+
var isCommonJS = typeof window == "undefined" && typeof exports == "object";
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework.
|
5
|
+
*
|
6
|
+
* @namespace
|
7
|
+
*/
|
8
|
+
var jasmine = {};
|
9
|
+
if (isCommonJS) exports.jasmine = jasmine;
|
10
|
+
/**
|
11
|
+
* @private
|
12
|
+
*/
|
13
|
+
jasmine.unimplementedMethod_ = function() {
|
14
|
+
throw new Error("unimplemented method");
|
15
|
+
};
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Use <code>jasmine.undefined</code> instead of <code>undefined</code>, since <code>undefined</code> is just
|
19
|
+
* a plain old variable and may be redefined by somebody else.
|
20
|
+
*
|
21
|
+
* @private
|
22
|
+
*/
|
23
|
+
jasmine.undefined = jasmine.___undefined___;
|
24
|
+
|
25
|
+
/**
|
26
|
+
* Show diagnostic messages in the console if set to true
|
27
|
+
*
|
28
|
+
*/
|
29
|
+
jasmine.VERBOSE = false;
|
30
|
+
|
31
|
+
/**
|
32
|
+
* Default interval in milliseconds for event loop yields (e.g. to allow network activity or to refresh the screen with the HTML-based runner). Small values here may result in slow test running. Zero means no updates until all tests have completed.
|
33
|
+
*
|
34
|
+
*/
|
35
|
+
jasmine.DEFAULT_UPDATE_INTERVAL = 250;
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Maximum levels of nesting that will be included when an object is pretty-printed
|
39
|
+
*/
|
40
|
+
jasmine.MAX_PRETTY_PRINT_DEPTH = 40;
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Default timeout interval in milliseconds for waitsFor() blocks.
|
44
|
+
*/
|
45
|
+
jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000;
|
46
|
+
|
47
|
+
/**
|
48
|
+
* By default exceptions thrown in the context of a test are caught by jasmine so that it can run the remaining tests in the suite.
|
49
|
+
* Set to false to let the exception bubble up in the browser.
|
50
|
+
*
|
51
|
+
*/
|
52
|
+
jasmine.CATCH_EXCEPTIONS = true;
|
53
|
+
|
54
|
+
jasmine.getGlobal = function() {
|
55
|
+
function getGlobal() {
|
56
|
+
return this;
|
57
|
+
}
|
58
|
+
|
59
|
+
return getGlobal();
|
60
|
+
};
|
61
|
+
|
62
|
+
/**
|
63
|
+
* Allows for bound functions to be compared. Internal use only.
|
64
|
+
*
|
65
|
+
* @ignore
|
66
|
+
* @private
|
67
|
+
* @param base {Object} bound 'this' for the function
|
68
|
+
* @param name {Function} function to find
|
69
|
+
*/
|
70
|
+
jasmine.bindOriginal_ = function(base, name) {
|
71
|
+
var original = base[name];
|
72
|
+
if (original.apply) {
|
73
|
+
return function() {
|
74
|
+
return original.apply(base, arguments);
|
75
|
+
};
|
76
|
+
} else {
|
77
|
+
// IE support
|
78
|
+
return jasmine.getGlobal()[name];
|
79
|
+
}
|
80
|
+
};
|
81
|
+
|
82
|
+
jasmine.setTimeout = jasmine.bindOriginal_(jasmine.getGlobal(), 'setTimeout');
|
83
|
+
jasmine.clearTimeout = jasmine.bindOriginal_(jasmine.getGlobal(), 'clearTimeout');
|
84
|
+
jasmine.setInterval = jasmine.bindOriginal_(jasmine.getGlobal(), 'setInterval');
|
85
|
+
jasmine.clearInterval = jasmine.bindOriginal_(jasmine.getGlobal(), 'clearInterval');
|
86
|
+
|
87
|
+
jasmine.MessageResult = function(values) {
|
88
|
+
this.type = 'log';
|
89
|
+
this.values = values;
|
90
|
+
this.trace = new Error(); // todo: test better
|
91
|
+
};
|
92
|
+
|
93
|
+
jasmine.MessageResult.prototype.toString = function() {
|
94
|
+
var text = "";
|
95
|
+
for (var i = 0; i < this.values.length; i++) {
|
96
|
+
if (i > 0) text += " ";
|
97
|
+
if (jasmine.isString_(this.values[i])) {
|
98
|
+
text += this.values[i];
|
99
|
+
} else {
|
100
|
+
text += jasmine.pp(this.values[i]);
|
101
|
+
}
|
102
|
+
}
|
103
|
+
return text;
|
104
|
+
};
|
105
|
+
|
106
|
+
jasmine.ExpectationResult = function(params) {
|
107
|
+
this.type = 'expect';
|
108
|
+
this.matcherName = params.matcherName;
|
109
|
+
this.passed_ = params.passed;
|
110
|
+
this.expected = params.expected;
|
111
|
+
this.actual = params.actual;
|
112
|
+
this.message = this.passed_ ? 'Passed.' : params.message;
|
113
|
+
|
114
|
+
var trace = (params.trace || new Error(this.message));
|
115
|
+
this.trace = this.passed_ ? '' : trace;
|
116
|
+
};
|
117
|
+
|
118
|
+
jasmine.ExpectationResult.prototype.toString = function () {
|
119
|
+
return this.message;
|
120
|
+
};
|
121
|
+
|
122
|
+
jasmine.ExpectationResult.prototype.passed = function () {
|
123
|
+
return this.passed_;
|
124
|
+
};
|
125
|
+
|
126
|
+
/**
|
127
|
+
* Getter for the Jasmine environment. Ensures one gets created
|
128
|
+
*/
|
129
|
+
jasmine.getEnv = function() {
|
130
|
+
var env = jasmine.currentEnv_ = jasmine.currentEnv_ || new jasmine.Env();
|
131
|
+
return env;
|
132
|
+
};
|
133
|
+
|
134
|
+
/**
|
135
|
+
* @ignore
|
136
|
+
* @private
|
137
|
+
* @param value
|
138
|
+
* @returns {Boolean}
|
139
|
+
*/
|
140
|
+
jasmine.isArray_ = function(value) {
|
141
|
+
return jasmine.isA_("Array", value);
|
142
|
+
};
|
143
|
+
|
144
|
+
/**
|
145
|
+
* @ignore
|
146
|
+
* @private
|
147
|
+
* @param value
|
148
|
+
* @returns {Boolean}
|
149
|
+
*/
|
150
|
+
jasmine.isString_ = function(value) {
|
151
|
+
return jasmine.isA_("String", value);
|
152
|
+
};
|
153
|
+
|
154
|
+
/**
|
155
|
+
* @ignore
|
156
|
+
* @private
|
157
|
+
* @param value
|
158
|
+
* @returns {Boolean}
|
159
|
+
*/
|
160
|
+
jasmine.isNumber_ = function(value) {
|
161
|
+
return jasmine.isA_("Number", value);
|
162
|
+
};
|
163
|
+
|
164
|
+
/**
|
165
|
+
* @ignore
|
166
|
+
* @private
|
167
|
+
* @param {String} typeName
|
168
|
+
* @param value
|
169
|
+
* @returns {Boolean}
|
170
|
+
*/
|
171
|
+
jasmine.isA_ = function(typeName, value) {
|
172
|
+
return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
|
173
|
+
};
|
174
|
+
|
175
|
+
/**
|
176
|
+
* Pretty printer for expecations. Takes any object and turns it into a human-readable string.
|
177
|
+
*
|
178
|
+
* @param value {Object} an object to be outputted
|
179
|
+
* @returns {String}
|
180
|
+
*/
|
181
|
+
jasmine.pp = function(value) {
|
182
|
+
var stringPrettyPrinter = new jasmine.StringPrettyPrinter();
|
183
|
+
stringPrettyPrinter.format(value);
|
184
|
+
return stringPrettyPrinter.string;
|
185
|
+
};
|
186
|
+
|
187
|
+
/**
|
188
|
+
* Returns true if the object is a DOM Node.
|
189
|
+
*
|
190
|
+
* @param {Object} obj object to check
|
191
|
+
* @returns {Boolean}
|
192
|
+
*/
|
193
|
+
jasmine.isDomNode = function(obj) {
|
194
|
+
return obj.nodeType > 0;
|
195
|
+
};
|
196
|
+
|
197
|
+
/**
|
198
|
+
* Returns a matchable 'generic' object of the class type. For use in expecations of type when values don't matter.
|
199
|
+
*
|
200
|
+
* @example
|
201
|
+
* // don't care about which function is passed in, as long as it's a function
|
202
|
+
* expect(mySpy).toHaveBeenCalledWith(jasmine.any(Function));
|
203
|
+
*
|
204
|
+
* @param {Class} clazz
|
205
|
+
* @returns matchable object of the type clazz
|
206
|
+
*/
|
207
|
+
jasmine.any = function(clazz) {
|
208
|
+
return new jasmine.Matchers.Any(clazz);
|
209
|
+
};
|
210
|
+
|
211
|
+
/**
|
212
|
+
* Returns a matchable subset of a JSON object. For use in expectations when you don't care about all of the
|
213
|
+
* attributes on the object.
|
214
|
+
*
|
215
|
+
* @example
|
216
|
+
* // don't care about any other attributes than foo.
|
217
|
+
* expect(mySpy).toHaveBeenCalledWith(jasmine.objectContaining({foo: "bar"});
|
218
|
+
*
|
219
|
+
* @param sample {Object} sample
|
220
|
+
* @returns matchable object for the sample
|
221
|
+
*/
|
222
|
+
jasmine.objectContaining = function (sample) {
|
223
|
+
return new jasmine.Matchers.ObjectContaining(sample);
|
224
|
+
};
|
225
|
+
|
226
|
+
/**
|
227
|
+
* Jasmine Spies are test doubles that can act as stubs, spies, fakes or when used in an expecation, mocks.
|
228
|
+
*
|
229
|
+
* Spies should be created in test setup, before expectations. They can then be checked, using the standard Jasmine
|
230
|
+
* expectation syntax. Spies can be checked if they were called or not and what the calling params were.
|
231
|
+
*
|
232
|
+
* A Spy has the following fields: wasCalled, callCount, mostRecentCall, and argsForCall (see docs).
|
233
|
+
*
|
234
|
+
* Spies are torn down at the end of every spec.
|
235
|
+
*
|
236
|
+
* Note: Do <b>not</b> call new jasmine.Spy() directly - a spy must be created using spyOn, jasmine.createSpy or jasmine.createSpyObj.
|
237
|
+
*
|
238
|
+
* @example
|
239
|
+
* // a stub
|
240
|
+
* var myStub = jasmine.createSpy('myStub'); // can be used anywhere
|
241
|
+
*
|
242
|
+
* // spy example
|
243
|
+
* var foo = {
|
244
|
+
* not: function(bool) { return !bool; }
|
245
|
+
* }
|
246
|
+
*
|
247
|
+
* // actual foo.not will not be called, execution stops
|
248
|
+
* spyOn(foo, 'not');
|
249
|
+
|
250
|
+
// foo.not spied upon, execution will continue to implementation
|
251
|
+
* spyOn(foo, 'not').andCallThrough();
|
252
|
+
*
|
253
|
+
* // fake example
|
254
|
+
* var foo = {
|
255
|
+
* not: function(bool) { return !bool; }
|
256
|
+
* }
|
257
|
+
*
|
258
|
+
* // foo.not(val) will return val
|
259
|
+
* spyOn(foo, 'not').andCallFake(function(value) {return value;});
|
260
|
+
*
|
261
|
+
* // mock example
|
262
|
+
* foo.not(7 == 7);
|
263
|
+
* expect(foo.not).toHaveBeenCalled();
|
264
|
+
* expect(foo.not).toHaveBeenCalledWith(true);
|
265
|
+
*
|
266
|
+
* @constructor
|
267
|
+
* @see spyOn, jasmine.createSpy, jasmine.createSpyObj
|
268
|
+
* @param {String} name
|
269
|
+
*/
|
270
|
+
jasmine.Spy = function(name) {
|
271
|
+
/**
|
272
|
+
* The name of the spy, if provided.
|
273
|
+
*/
|
274
|
+
this.identity = name || 'unknown';
|
275
|
+
/**
|
276
|
+
* Is this Object a spy?
|
277
|
+
*/
|
278
|
+
this.isSpy = true;
|
279
|
+
/**
|
280
|
+
* The actual function this spy stubs.
|
281
|
+
*/
|
282
|
+
this.plan = function() {
|
283
|
+
};
|
284
|
+
/**
|
285
|
+
* Tracking of the most recent call to the spy.
|
286
|
+
* @example
|
287
|
+
* var mySpy = jasmine.createSpy('foo');
|
288
|
+
* mySpy(1, 2);
|
289
|
+
* mySpy.mostRecentCall.args = [1, 2];
|
290
|
+
*/
|
291
|
+
this.mostRecentCall = {};
|
292
|
+
|
293
|
+
/**
|
294
|
+
* Holds arguments for each call to the spy, indexed by call count
|
295
|
+
* @example
|
296
|
+
* var mySpy = jasmine.createSpy('foo');
|
297
|
+
* mySpy(1, 2);
|
298
|
+
* mySpy(7, 8);
|
299
|
+
* mySpy.mostRecentCall.args = [7, 8];
|
300
|
+
* mySpy.argsForCall[0] = [1, 2];
|
301
|
+
* mySpy.argsForCall[1] = [7, 8];
|
302
|
+
*/
|
303
|
+
this.argsForCall = [];
|
304
|
+
this.calls = [];
|
305
|
+
};
|
306
|
+
|
307
|
+
/**
|
308
|
+
* Tells a spy to call through to the actual implemenatation.
|
309
|
+
*
|
310
|
+
* @example
|
311
|
+
* var foo = {
|
312
|
+
* bar: function() { // do some stuff }
|
313
|
+
* }
|
314
|
+
*
|
315
|
+
* // defining a spy on an existing property: foo.bar
|
316
|
+
* spyOn(foo, 'bar').andCallThrough();
|
317
|
+
*/
|
318
|
+
jasmine.Spy.prototype.andCallThrough = function() {
|
319
|
+
this.plan = this.originalValue;
|
320
|
+
return this;
|
321
|
+
};
|
322
|
+
|
323
|
+
/**
|
324
|
+
* For setting the return value of a spy.
|
325
|
+
*
|
326
|
+
* @example
|
327
|
+
* // defining a spy from scratch: foo() returns 'baz'
|
328
|
+
* var foo = jasmine.createSpy('spy on foo').andReturn('baz');
|
329
|
+
*
|
330
|
+
* // defining a spy on an existing property: foo.bar() returns 'baz'
|
331
|
+
* spyOn(foo, 'bar').andReturn('baz');
|
332
|
+
*
|
333
|
+
* @param {Object} value
|
334
|
+
*/
|
335
|
+
jasmine.Spy.prototype.andReturn = function(value) {
|
336
|
+
this.plan = function() {
|
337
|
+
return value;
|
338
|
+
};
|
339
|
+
return this;
|
340
|
+
};
|
341
|
+
|
342
|
+
/**
|
343
|
+
* For throwing an exception when a spy is called.
|
344
|
+
*
|
345
|
+
* @example
|
346
|
+
* // defining a spy from scratch: foo() throws an exception w/ message 'ouch'
|
347
|
+
* var foo = jasmine.createSpy('spy on foo').andThrow('baz');
|
348
|
+
*
|
349
|
+
* // defining a spy on an existing property: foo.bar() throws an exception w/ message 'ouch'
|
350
|
+
* spyOn(foo, 'bar').andThrow('baz');
|
351
|
+
*
|
352
|
+
* @param {String} exceptionMsg
|
353
|
+
*/
|
354
|
+
jasmine.Spy.prototype.andThrow = function(exceptionMsg) {
|
355
|
+
this.plan = function() {
|
356
|
+
throw exceptionMsg;
|
357
|
+
};
|
358
|
+
return this;
|
359
|
+
};
|
360
|
+
|
361
|
+
/**
|
362
|
+
* Calls an alternate implementation when a spy is called.
|
363
|
+
*
|
364
|
+
* @example
|
365
|
+
* var baz = function() {
|
366
|
+
* // do some stuff, return something
|
367
|
+
* }
|
368
|
+
* // defining a spy from scratch: foo() calls the function baz
|
369
|
+
* var foo = jasmine.createSpy('spy on foo').andCall(baz);
|
370
|
+
*
|
371
|
+
* // defining a spy on an existing property: foo.bar() calls an anonymnous function
|
372
|
+
* spyOn(foo, 'bar').andCall(function() { return 'baz';} );
|
373
|
+
*
|
374
|
+
* @param {Function} fakeFunc
|
375
|
+
*/
|
376
|
+
jasmine.Spy.prototype.andCallFake = function(fakeFunc) {
|
377
|
+
this.plan = fakeFunc;
|
378
|
+
return this;
|
379
|
+
};
|
380
|
+
|
381
|
+
/**
|
382
|
+
* Resets all of a spy's the tracking variables so that it can be used again.
|
383
|
+
*
|
384
|
+
* @example
|
385
|
+
* spyOn(foo, 'bar');
|
386
|
+
*
|
387
|
+
* foo.bar();
|
388
|
+
*
|
389
|
+
* expect(foo.bar.callCount).toEqual(1);
|
390
|
+
*
|
391
|
+
* foo.bar.reset();
|
392
|
+
*
|
393
|
+
* expect(foo.bar.callCount).toEqual(0);
|
394
|
+
*/
|
395
|
+
jasmine.Spy.prototype.reset = function() {
|
396
|
+
this.wasCalled = false;
|
397
|
+
this.callCount = 0;
|
398
|
+
this.argsForCall = [];
|
399
|
+
this.calls = [];
|
400
|
+
this.mostRecentCall = {};
|
401
|
+
};
|
402
|
+
|
403
|
+
jasmine.createSpy = function(name) {
|
404
|
+
|
405
|
+
var spyObj = function() {
|
406
|
+
spyObj.wasCalled = true;
|
407
|
+
spyObj.callCount++;
|
408
|
+
var args = jasmine.util.argsToArray(arguments);
|
409
|
+
spyObj.mostRecentCall.object = this;
|
410
|
+
spyObj.mostRecentCall.args = args;
|
411
|
+
spyObj.argsForCall.push(args);
|
412
|
+
spyObj.calls.push({object: this, args: args});
|
413
|
+
return spyObj.plan.apply(this, arguments);
|
414
|
+
};
|
415
|
+
|
416
|
+
var spy = new jasmine.Spy(name);
|
417
|
+
|
418
|
+
for (var prop in spy) {
|
419
|
+
spyObj[prop] = spy[prop];
|
420
|
+
}
|
421
|
+
|
422
|
+
spyObj.reset();
|
423
|
+
|
424
|
+
return spyObj;
|
425
|
+
};
|
426
|
+
|
427
|
+
/**
|
428
|
+
* Determines whether an object is a spy.
|
429
|
+
*
|
430
|
+
* @param {jasmine.Spy|Object} putativeSpy
|
431
|
+
* @returns {Boolean}
|
432
|
+
*/
|
433
|
+
jasmine.isSpy = function(putativeSpy) {
|
434
|
+
return putativeSpy && putativeSpy.isSpy;
|
435
|
+
};
|
436
|
+
|
437
|
+
/**
|
438
|
+
* Creates a more complicated spy: an Object that has every property a function that is a spy. Used for stubbing something
|
439
|
+
* large in one call.
|
440
|
+
*
|
441
|
+
* @param {String} baseName name of spy class
|
442
|
+
* @param {Array} methodNames array of names of methods to make spies
|
443
|
+
*/
|
444
|
+
jasmine.createSpyObj = function(baseName, methodNames) {
|
445
|
+
if (!jasmine.isArray_(methodNames) || methodNames.length === 0) {
|
446
|
+
throw new Error('createSpyObj requires a non-empty array of method names to create spies for');
|
447
|
+
}
|
448
|
+
var obj = {};
|
449
|
+
for (var i = 0; i < methodNames.length; i++) {
|
450
|
+
obj[methodNames[i]] = jasmine.createSpy(baseName + '.' + methodNames[i]);
|
451
|
+
}
|
452
|
+
return obj;
|
453
|
+
};
|
454
|
+
|
455
|
+
/**
|
456
|
+
* All parameters are pretty-printed and concatenated together, then written to the current spec's output.
|
457
|
+
*
|
458
|
+
* Be careful not to leave calls to <code>jasmine.log</code> in production code.
|
459
|
+
*/
|
460
|
+
jasmine.log = function() {
|
461
|
+
var spec = jasmine.getEnv().currentSpec;
|
462
|
+
spec.log.apply(spec, arguments);
|
463
|
+
};
|
464
|
+
|
465
|
+
/**
|
466
|
+
* Function that installs a spy on an existing object's method name. Used within a Spec to create a spy.
|
467
|
+
*
|
468
|
+
* @example
|
469
|
+
* // spy example
|
470
|
+
* var foo = {
|
471
|
+
* not: function(bool) { return !bool; }
|
472
|
+
* }
|
473
|
+
* spyOn(foo, 'not'); // actual foo.not will not be called, execution stops
|
474
|
+
*
|
475
|
+
* @see jasmine.createSpy
|
476
|
+
* @param obj
|
477
|
+
* @param methodName
|
478
|
+
* @return {jasmine.Spy} a Jasmine spy that can be chained with all spy methods
|
479
|
+
*/
|
480
|
+
var spyOn = function(obj, methodName) {
|
481
|
+
return jasmine.getEnv().currentSpec.spyOn(obj, methodName);
|
482
|
+
};
|
483
|
+
if (isCommonJS) exports.spyOn = spyOn;
|
484
|
+
|
485
|
+
/**
|
486
|
+
* Creates a Jasmine spec that will be added to the current suite.
|
487
|
+
*
|
488
|
+
* // TODO: pending tests
|
489
|
+
*
|
490
|
+
* @example
|
491
|
+
* it('should be true', function() {
|
492
|
+
* expect(true).toEqual(true);
|
493
|
+
* });
|
494
|
+
*
|
495
|
+
* @param {String} desc description of this specification
|
496
|
+
* @param {Function} func defines the preconditions and expectations of the spec
|
497
|
+
*/
|
498
|
+
var it = function(desc, func) {
|
499
|
+
return jasmine.getEnv().it(desc, func);
|
500
|
+
};
|
501
|
+
if (isCommonJS) exports.it = it;
|
502
|
+
|
503
|
+
/**
|
504
|
+
* Creates a <em>disabled</em> Jasmine spec.
|
505
|
+
*
|
506
|
+
* A convenience method that allows existing specs to be disabled temporarily during development.
|
507
|
+
*
|
508
|
+
* @param {String} desc description of this specification
|
509
|
+
* @param {Function} func defines the preconditions and expectations of the spec
|
510
|
+
*/
|
511
|
+
var xit = function(desc, func) {
|
512
|
+
return jasmine.getEnv().xit(desc, func);
|
513
|
+
};
|
514
|
+
if (isCommonJS) exports.xit = xit;
|
515
|
+
|
516
|
+
/**
|
517
|
+
* Starts a chain for a Jasmine expectation.
|
518
|
+
*
|
519
|
+
* It is passed an Object that is the actual value and should chain to one of the many
|
520
|
+
* jasmine.Matchers functions.
|
521
|
+
*
|
522
|
+
* @param {Object} actual Actual value to test against and expected value
|
523
|
+
* @return {jasmine.Matchers}
|
524
|
+
*/
|
525
|
+
var expect = function(actual) {
|
526
|
+
return jasmine.getEnv().currentSpec.expect(actual);
|
527
|
+
};
|
528
|
+
if (isCommonJS) exports.expect = expect;
|
529
|
+
|
530
|
+
/**
|
531
|
+
* Defines part of a jasmine spec. Used in cominbination with waits or waitsFor in asynchrnous specs.
|
532
|
+
*
|
533
|
+
* @param {Function} func Function that defines part of a jasmine spec.
|
534
|
+
*/
|
535
|
+
var runs = function(func) {
|
536
|
+
jasmine.getEnv().currentSpec.runs(func);
|
537
|
+
};
|
538
|
+
if (isCommonJS) exports.runs = runs;
|
539
|
+
|
540
|
+
/**
|
541
|
+
* Waits a fixed time period before moving to the next block.
|
542
|
+
*
|
543
|
+
* @deprecated Use waitsFor() instead
|
544
|
+
* @param {Number} timeout milliseconds to wait
|
545
|
+
*/
|
546
|
+
var waits = function(timeout) {
|
547
|
+
jasmine.getEnv().currentSpec.waits(timeout);
|
548
|
+
};
|
549
|
+
if (isCommonJS) exports.waits = waits;
|
550
|
+
|
551
|
+
/**
|
552
|
+
* Waits for the latchFunction to return true before proceeding to the next block.
|
553
|
+
*
|
554
|
+
* @param {Function} latchFunction
|
555
|
+
* @param {String} optional_timeoutMessage
|
556
|
+
* @param {Number} optional_timeout
|
557
|
+
*/
|
558
|
+
var waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) {
|
559
|
+
jasmine.getEnv().currentSpec.waitsFor.apply(jasmine.getEnv().currentSpec, arguments);
|
560
|
+
};
|
561
|
+
if (isCommonJS) exports.waitsFor = waitsFor;
|
562
|
+
|
563
|
+
/**
|
564
|
+
* A function that is called before each spec in a suite.
|
565
|
+
*
|
566
|
+
* Used for spec setup, including validating assumptions.
|
567
|
+
*
|
568
|
+
* @param {Function} beforeEachFunction
|
569
|
+
*/
|
570
|
+
var beforeEach = function(beforeEachFunction) {
|
571
|
+
jasmine.getEnv().beforeEach(beforeEachFunction);
|
572
|
+
};
|
573
|
+
if (isCommonJS) exports.beforeEach = beforeEach;
|
574
|
+
|
575
|
+
/**
|
576
|
+
* A function that is called after each spec in a suite.
|
577
|
+
*
|
578
|
+
* Used for restoring any state that is hijacked during spec execution.
|
579
|
+
*
|
580
|
+
* @param {Function} afterEachFunction
|
581
|
+
*/
|
582
|
+
var afterEach = function(afterEachFunction) {
|
583
|
+
jasmine.getEnv().afterEach(afterEachFunction);
|
584
|
+
};
|
585
|
+
if (isCommonJS) exports.afterEach = afterEach;
|
586
|
+
|
587
|
+
/**
|
588
|
+
* Defines a suite of specifications.
|
589
|
+
*
|
590
|
+
* Stores the description and all defined specs in the Jasmine environment as one suite of specs. Variables declared
|
591
|
+
* are accessible by calls to beforeEach, it, and afterEach. Describe blocks can be nested, allowing for specialization
|
592
|
+
* of setup in some tests.
|
593
|
+
*
|
594
|
+
* @example
|
595
|
+
* // TODO: a simple suite
|
596
|
+
*
|
597
|
+
* // TODO: a simple suite with a nested describe block
|
598
|
+
*
|
599
|
+
* @param {String} description A string, usually the class under test.
|
600
|
+
* @param {Function} specDefinitions function that defines several specs.
|
601
|
+
*/
|
602
|
+
var describe = function(description, specDefinitions) {
|
603
|
+
return jasmine.getEnv().describe(description, specDefinitions);
|
604
|
+
};
|
605
|
+
if (isCommonJS) exports.describe = describe;
|
606
|
+
|
607
|
+
/**
|
608
|
+
* Disables a suite of specifications. Used to disable some suites in a file, or files, temporarily during development.
|
609
|
+
*
|
610
|
+
* @param {String} description A string, usually the class under test.
|
611
|
+
* @param {Function} specDefinitions function that defines several specs.
|
612
|
+
*/
|
613
|
+
var xdescribe = function(description, specDefinitions) {
|
614
|
+
return jasmine.getEnv().xdescribe(description, specDefinitions);
|
615
|
+
};
|
616
|
+
if (isCommonJS) exports.xdescribe = xdescribe;
|
617
|
+
|
618
|
+
|
619
|
+
// Provide the XMLHttpRequest class for IE 5.x-6.x:
|
620
|
+
jasmine.XmlHttpRequest = (typeof XMLHttpRequest == "undefined") ? function() {
|
621
|
+
function tryIt(f) {
|
622
|
+
try {
|
623
|
+
return f();
|
624
|
+
} catch(e) {
|
625
|
+
}
|
626
|
+
return null;
|
627
|
+
}
|
628
|
+
|
629
|
+
var xhr = tryIt(function() {
|
630
|
+
return new ActiveXObject("Msxml2.XMLHTTP.6.0");
|
631
|
+
}) ||
|
632
|
+
tryIt(function() {
|
633
|
+
return new ActiveXObject("Msxml2.XMLHTTP.3.0");
|
634
|
+
}) ||
|
635
|
+
tryIt(function() {
|
636
|
+
return new ActiveXObject("Msxml2.XMLHTTP");
|
637
|
+
}) ||
|
638
|
+
tryIt(function() {
|
639
|
+
return new ActiveXObject("Microsoft.XMLHTTP");
|
640
|
+
});
|
641
|
+
|
642
|
+
if (!xhr) throw new Error("This browser does not support XMLHttpRequest.");
|
643
|
+
|
644
|
+
return xhr;
|
645
|
+
} : XMLHttpRequest;
|
646
|
+
/**
|
647
|
+
* @namespace
|
648
|
+
*/
|
649
|
+
jasmine.util = {};
|
650
|
+
|
651
|
+
/**
|
652
|
+
* Declare that a child class inherit it's prototype from the parent class.
|
653
|
+
*
|
654
|
+
* @private
|
655
|
+
* @param {Function} childClass
|
656
|
+
* @param {Function} parentClass
|
657
|
+
*/
|
658
|
+
jasmine.util.inherit = function(childClass, parentClass) {
|
659
|
+
/**
|
660
|
+
* @private
|
661
|
+
*/
|
662
|
+
var subclass = function() {
|
663
|
+
};
|
664
|
+
subclass.prototype = parentClass.prototype;
|
665
|
+
childClass.prototype = new subclass();
|
666
|
+
};
|
667
|
+
|
668
|
+
jasmine.util.formatException = function(e) {
|
669
|
+
var lineNumber;
|
670
|
+
if (e.line) {
|
671
|
+
lineNumber = e.line;
|
672
|
+
}
|
673
|
+
else if (e.lineNumber) {
|
674
|
+
lineNumber = e.lineNumber;
|
675
|
+
}
|
676
|
+
|
677
|
+
var file;
|
678
|
+
|
679
|
+
if (e.sourceURL) {
|
680
|
+
file = e.sourceURL;
|
681
|
+
}
|
682
|
+
else if (e.fileName) {
|
683
|
+
file = e.fileName;
|
684
|
+
}
|
685
|
+
|
686
|
+
var message = (e.name && e.message) ? (e.name + ': ' + e.message) : e.toString();
|
687
|
+
|
688
|
+
if (file && lineNumber) {
|
689
|
+
message += ' in ' + file + ' (line ' + lineNumber + ')';
|
690
|
+
}
|
691
|
+
|
692
|
+
return message;
|
693
|
+
};
|
694
|
+
|
695
|
+
jasmine.util.htmlEscape = function(str) {
|
696
|
+
if (!str) return str;
|
697
|
+
return str.replace(/&/g, '&')
|
698
|
+
.replace(/</g, '<')
|
699
|
+
.replace(/>/g, '>');
|
700
|
+
};
|
701
|
+
|
702
|
+
jasmine.util.argsToArray = function(args) {
|
703
|
+
var arrayOfArgs = [];
|
704
|
+
for (var i = 0; i < args.length; i++) arrayOfArgs.push(args[i]);
|
705
|
+
return arrayOfArgs;
|
706
|
+
};
|
707
|
+
|
708
|
+
jasmine.util.extend = function(destination, source) {
|
709
|
+
for (var property in source) destination[property] = source[property];
|
710
|
+
return destination;
|
711
|
+
};
|
712
|
+
|
713
|
+
/**
|
714
|
+
* Environment for Jasmine
|
715
|
+
*
|
716
|
+
* @constructor
|
717
|
+
*/
|
718
|
+
jasmine.Env = function() {
|
719
|
+
this.currentSpec = null;
|
720
|
+
this.currentSuite = null;
|
721
|
+
this.currentRunner_ = new jasmine.Runner(this);
|
722
|
+
|
723
|
+
this.reporter = new jasmine.MultiReporter();
|
724
|
+
|
725
|
+
this.updateInterval = jasmine.DEFAULT_UPDATE_INTERVAL;
|
726
|
+
this.defaultTimeoutInterval = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
727
|
+
this.lastUpdate = 0;
|
728
|
+
this.specFilter = function() {
|
729
|
+
return true;
|
730
|
+
};
|
731
|
+
|
732
|
+
this.nextSpecId_ = 0;
|
733
|
+
this.nextSuiteId_ = 0;
|
734
|
+
this.equalityTesters_ = [];
|
735
|
+
|
736
|
+
// wrap matchers
|
737
|
+
this.matchersClass = function() {
|
738
|
+
jasmine.Matchers.apply(this, arguments);
|
739
|
+
};
|
740
|
+
jasmine.util.inherit(this.matchersClass, jasmine.Matchers);
|
741
|
+
|
742
|
+
jasmine.Matchers.wrapInto_(jasmine.Matchers.prototype, this.matchersClass);
|
743
|
+
};
|
744
|
+
|
745
|
+
|
746
|
+
jasmine.Env.prototype.setTimeout = jasmine.setTimeout;
|
747
|
+
jasmine.Env.prototype.clearTimeout = jasmine.clearTimeout;
|
748
|
+
jasmine.Env.prototype.setInterval = jasmine.setInterval;
|
749
|
+
jasmine.Env.prototype.clearInterval = jasmine.clearInterval;
|
750
|
+
|
751
|
+
/**
|
752
|
+
* @returns an object containing jasmine version build info, if set.
|
753
|
+
*/
|
754
|
+
jasmine.Env.prototype.version = function () {
|
755
|
+
if (jasmine.version_) {
|
756
|
+
return jasmine.version_;
|
757
|
+
} else {
|
758
|
+
throw new Error('Version not set');
|
759
|
+
}
|
760
|
+
};
|
761
|
+
|
762
|
+
/**
|
763
|
+
* @returns string containing jasmine version build info, if set.
|
764
|
+
*/
|
765
|
+
jasmine.Env.prototype.versionString = function() {
|
766
|
+
if (!jasmine.version_) {
|
767
|
+
return "version unknown";
|
768
|
+
}
|
769
|
+
|
770
|
+
var version = this.version();
|
771
|
+
var versionString = version.major + "." + version.minor + "." + version.build;
|
772
|
+
if (version.release_candidate) {
|
773
|
+
versionString += ".rc" + version.release_candidate;
|
774
|
+
}
|
775
|
+
versionString += " revision " + version.revision;
|
776
|
+
return versionString;
|
777
|
+
};
|
778
|
+
|
779
|
+
/**
|
780
|
+
* @returns a sequential integer starting at 0
|
781
|
+
*/
|
782
|
+
jasmine.Env.prototype.nextSpecId = function () {
|
783
|
+
return this.nextSpecId_++;
|
784
|
+
};
|
785
|
+
|
786
|
+
/**
|
787
|
+
* @returns a sequential integer starting at 0
|
788
|
+
*/
|
789
|
+
jasmine.Env.prototype.nextSuiteId = function () {
|
790
|
+
return this.nextSuiteId_++;
|
791
|
+
};
|
792
|
+
|
793
|
+
/**
|
794
|
+
* Register a reporter to receive status updates from Jasmine.
|
795
|
+
* @param {jasmine.Reporter} reporter An object which will receive status updates.
|
796
|
+
*/
|
797
|
+
jasmine.Env.prototype.addReporter = function(reporter) {
|
798
|
+
this.reporter.addReporter(reporter);
|
799
|
+
};
|
800
|
+
|
801
|
+
jasmine.Env.prototype.execute = function() {
|
802
|
+
this.currentRunner_.execute();
|
803
|
+
};
|
804
|
+
|
805
|
+
jasmine.Env.prototype.describe = function(description, specDefinitions) {
|
806
|
+
var suite = new jasmine.Suite(this, description, specDefinitions, this.currentSuite);
|
807
|
+
|
808
|
+
var parentSuite = this.currentSuite;
|
809
|
+
if (parentSuite) {
|
810
|
+
parentSuite.add(suite);
|
811
|
+
} else {
|
812
|
+
this.currentRunner_.add(suite);
|
813
|
+
}
|
814
|
+
|
815
|
+
this.currentSuite = suite;
|
816
|
+
|
817
|
+
var declarationError = null;
|
818
|
+
try {
|
819
|
+
specDefinitions.call(suite);
|
820
|
+
} catch(e) {
|
821
|
+
declarationError = e;
|
822
|
+
}
|
823
|
+
|
824
|
+
if (declarationError) {
|
825
|
+
this.it("encountered a declaration exception", function() {
|
826
|
+
throw declarationError;
|
827
|
+
});
|
828
|
+
}
|
829
|
+
|
830
|
+
this.currentSuite = parentSuite;
|
831
|
+
|
832
|
+
return suite;
|
833
|
+
};
|
834
|
+
|
835
|
+
jasmine.Env.prototype.beforeEach = function(beforeEachFunction) {
|
836
|
+
if (this.currentSuite) {
|
837
|
+
this.currentSuite.beforeEach(beforeEachFunction);
|
838
|
+
} else {
|
839
|
+
this.currentRunner_.beforeEach(beforeEachFunction);
|
840
|
+
}
|
841
|
+
};
|
842
|
+
|
843
|
+
jasmine.Env.prototype.currentRunner = function () {
|
844
|
+
return this.currentRunner_;
|
845
|
+
};
|
846
|
+
|
847
|
+
jasmine.Env.prototype.afterEach = function(afterEachFunction) {
|
848
|
+
if (this.currentSuite) {
|
849
|
+
this.currentSuite.afterEach(afterEachFunction);
|
850
|
+
} else {
|
851
|
+
this.currentRunner_.afterEach(afterEachFunction);
|
852
|
+
}
|
853
|
+
|
854
|
+
};
|
855
|
+
|
856
|
+
jasmine.Env.prototype.xdescribe = function(desc, specDefinitions) {
|
857
|
+
return {
|
858
|
+
execute: function() {
|
859
|
+
}
|
860
|
+
};
|
861
|
+
};
|
862
|
+
|
863
|
+
jasmine.Env.prototype.it = function(description, func) {
|
864
|
+
var spec = new jasmine.Spec(this, this.currentSuite, description);
|
865
|
+
this.currentSuite.add(spec);
|
866
|
+
this.currentSpec = spec;
|
867
|
+
|
868
|
+
if (func) {
|
869
|
+
spec.runs(func);
|
870
|
+
} else {
|
871
|
+
spec.pending = true
|
872
|
+
}
|
873
|
+
|
874
|
+
return spec;
|
875
|
+
};
|
876
|
+
|
877
|
+
jasmine.Env.prototype.xit = function(desc, func) {
|
878
|
+
return {
|
879
|
+
id: this.nextSpecId(),
|
880
|
+
runs: function() {
|
881
|
+
}
|
882
|
+
};
|
883
|
+
};
|
884
|
+
|
885
|
+
jasmine.Env.prototype.compareRegExps_ = function(a, b, mismatchKeys, mismatchValues) {
|
886
|
+
if (a.source != b.source)
|
887
|
+
mismatchValues.push("expected pattern /" + b.source + "/ is not equal to the pattern /" + a.source + "/");
|
888
|
+
|
889
|
+
if (a.ignoreCase != b.ignoreCase)
|
890
|
+
mismatchValues.push("expected modifier i was" + (b.ignoreCase ? " " : " not ") + "set and does not equal the origin modifier");
|
891
|
+
|
892
|
+
if (a.global != b.global)
|
893
|
+
mismatchValues.push("expected modifier g was" + (b.global ? " " : " not ") + "set and does not equal the origin modifier");
|
894
|
+
|
895
|
+
if (a.multiline != b.multiline)
|
896
|
+
mismatchValues.push("expected modifier m was" + (b.multiline ? " " : " not ") + "set and does not equal the origin modifier");
|
897
|
+
|
898
|
+
if (a.sticky != b.sticky)
|
899
|
+
mismatchValues.push("expected modifier y was" + (b.sticky ? " " : " not ") + "set and does not equal the origin modifier");
|
900
|
+
|
901
|
+
return (mismatchValues.length === 0);
|
902
|
+
};
|
903
|
+
|
904
|
+
jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchValues) {
|
905
|
+
if (a.__Jasmine_been_here_before__ === b && b.__Jasmine_been_here_before__ === a) {
|
906
|
+
return true;
|
907
|
+
}
|
908
|
+
|
909
|
+
a.__Jasmine_been_here_before__ = b;
|
910
|
+
b.__Jasmine_been_here_before__ = a;
|
911
|
+
|
912
|
+
var hasKey = function(obj, keyName) {
|
913
|
+
return obj !== null && obj[keyName] !== jasmine.undefined;
|
914
|
+
};
|
915
|
+
|
916
|
+
for (var property in b) {
|
917
|
+
if (!hasKey(a, property) && hasKey(b, property)) {
|
918
|
+
mismatchKeys.push("expected has key '" + property + "', but missing from actual.");
|
919
|
+
}
|
920
|
+
}
|
921
|
+
for (property in a) {
|
922
|
+
if (!hasKey(b, property) && hasKey(a, property)) {
|
923
|
+
mismatchKeys.push("expected missing key '" + property + "', but present in actual.");
|
924
|
+
}
|
925
|
+
}
|
926
|
+
for (property in b) {
|
927
|
+
if (property == '__Jasmine_been_here_before__') continue;
|
928
|
+
if (!this.equals_(a[property], b[property], mismatchKeys, mismatchValues)) {
|
929
|
+
mismatchValues.push("'" + property + "' was '" + (b[property] ? jasmine.util.htmlEscape(b[property].toString()) : b[property]) + "' in expected, but was '" + (a[property] ? jasmine.util.htmlEscape(a[property].toString()) : a[property]) + "' in actual.");
|
930
|
+
}
|
931
|
+
}
|
932
|
+
|
933
|
+
if (jasmine.isArray_(a) && jasmine.isArray_(b) && a.length != b.length) {
|
934
|
+
mismatchValues.push("arrays were not the same length");
|
935
|
+
}
|
936
|
+
|
937
|
+
delete a.__Jasmine_been_here_before__;
|
938
|
+
delete b.__Jasmine_been_here_before__;
|
939
|
+
return (mismatchKeys.length === 0 && mismatchValues.length === 0);
|
940
|
+
};
|
941
|
+
|
942
|
+
jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) {
|
943
|
+
mismatchKeys = mismatchKeys || [];
|
944
|
+
mismatchValues = mismatchValues || [];
|
945
|
+
|
946
|
+
for (var i = 0; i < this.equalityTesters_.length; i++) {
|
947
|
+
var equalityTester = this.equalityTesters_[i];
|
948
|
+
var result = equalityTester(a, b, this, mismatchKeys, mismatchValues);
|
949
|
+
if (result !== jasmine.undefined) return result;
|
950
|
+
}
|
951
|
+
|
952
|
+
if (a === b) return true;
|
953
|
+
|
954
|
+
if (a === jasmine.undefined || a === null || b === jasmine.undefined || b === null) {
|
955
|
+
return (a == jasmine.undefined && b == jasmine.undefined);
|
956
|
+
}
|
957
|
+
|
958
|
+
if (jasmine.isDomNode(a) && jasmine.isDomNode(b)) {
|
959
|
+
return a === b;
|
960
|
+
}
|
961
|
+
|
962
|
+
if (a instanceof Date && b instanceof Date) {
|
963
|
+
return a.getTime() == b.getTime();
|
964
|
+
}
|
965
|
+
|
966
|
+
if (a.jasmineMatches) {
|
967
|
+
return a.jasmineMatches(b);
|
968
|
+
}
|
969
|
+
|
970
|
+
if (b.jasmineMatches) {
|
971
|
+
return b.jasmineMatches(a);
|
972
|
+
}
|
973
|
+
|
974
|
+
if (a instanceof jasmine.Matchers.ObjectContaining) {
|
975
|
+
return a.matches(b);
|
976
|
+
}
|
977
|
+
|
978
|
+
if (b instanceof jasmine.Matchers.ObjectContaining) {
|
979
|
+
return b.matches(a);
|
980
|
+
}
|
981
|
+
|
982
|
+
if (jasmine.isString_(a) && jasmine.isString_(b)) {
|
983
|
+
return (a == b);
|
984
|
+
}
|
985
|
+
|
986
|
+
if (jasmine.isNumber_(a) && jasmine.isNumber_(b)) {
|
987
|
+
return (a == b);
|
988
|
+
}
|
989
|
+
|
990
|
+
if (a instanceof RegExp && b instanceof RegExp) {
|
991
|
+
return this.compareRegExps_(a, b, mismatchKeys, mismatchValues);
|
992
|
+
}
|
993
|
+
|
994
|
+
if (typeof a === "object" && typeof b === "object") {
|
995
|
+
return this.compareObjects_(a, b, mismatchKeys, mismatchValues);
|
996
|
+
}
|
997
|
+
|
998
|
+
//Straight check
|
999
|
+
return (a === b);
|
1000
|
+
};
|
1001
|
+
|
1002
|
+
jasmine.Env.prototype.contains_ = function(haystack, needle) {
|
1003
|
+
if (jasmine.isArray_(haystack)) {
|
1004
|
+
for (var i = 0; i < haystack.length; i++) {
|
1005
|
+
if (this.equals_(haystack[i], needle)) return true;
|
1006
|
+
}
|
1007
|
+
return false;
|
1008
|
+
}
|
1009
|
+
return haystack.indexOf(needle) >= 0;
|
1010
|
+
};
|
1011
|
+
|
1012
|
+
jasmine.Env.prototype.addEqualityTester = function(equalityTester) {
|
1013
|
+
this.equalityTesters_.push(equalityTester);
|
1014
|
+
};
|
1015
|
+
/** No-op base class for Jasmine reporters.
|
1016
|
+
*
|
1017
|
+
* @constructor
|
1018
|
+
*/
|
1019
|
+
jasmine.Reporter = function() {
|
1020
|
+
};
|
1021
|
+
|
1022
|
+
//noinspection JSUnusedLocalSymbols
|
1023
|
+
jasmine.Reporter.prototype.reportRunnerStarting = function(runner) {
|
1024
|
+
};
|
1025
|
+
|
1026
|
+
//noinspection JSUnusedLocalSymbols
|
1027
|
+
jasmine.Reporter.prototype.reportRunnerResults = function(runner) {
|
1028
|
+
};
|
1029
|
+
|
1030
|
+
//noinspection JSUnusedLocalSymbols
|
1031
|
+
jasmine.Reporter.prototype.reportSuiteResults = function(suite) {
|
1032
|
+
};
|
1033
|
+
|
1034
|
+
//noinspection JSUnusedLocalSymbols
|
1035
|
+
jasmine.Reporter.prototype.reportSpecStarting = function(spec) {
|
1036
|
+
};
|
1037
|
+
|
1038
|
+
//noinspection JSUnusedLocalSymbols
|
1039
|
+
jasmine.Reporter.prototype.reportSpecResults = function(spec) {
|
1040
|
+
};
|
1041
|
+
|
1042
|
+
//noinspection JSUnusedLocalSymbols
|
1043
|
+
jasmine.Reporter.prototype.log = function(str) {
|
1044
|
+
};
|
1045
|
+
|
1046
|
+
/**
|
1047
|
+
* Blocks are functions with executable code that make up a spec.
|
1048
|
+
*
|
1049
|
+
* @constructor
|
1050
|
+
* @param {jasmine.Env} env
|
1051
|
+
* @param {Function} func
|
1052
|
+
* @param {jasmine.Spec} spec
|
1053
|
+
*/
|
1054
|
+
jasmine.Block = function(env, func, spec) {
|
1055
|
+
this.env = env;
|
1056
|
+
this.func = func;
|
1057
|
+
this.spec = spec;
|
1058
|
+
};
|
1059
|
+
|
1060
|
+
jasmine.Block.prototype.execute = function(onComplete) {
|
1061
|
+
if (!jasmine.CATCH_EXCEPTIONS) {
|
1062
|
+
this.func.apply(this.spec);
|
1063
|
+
}
|
1064
|
+
else {
|
1065
|
+
try {
|
1066
|
+
this.func.apply(this.spec);
|
1067
|
+
} catch (e) {
|
1068
|
+
this.spec.fail(e);
|
1069
|
+
}
|
1070
|
+
}
|
1071
|
+
onComplete();
|
1072
|
+
};
|
1073
|
+
/** JavaScript API reporter.
|
1074
|
+
*
|
1075
|
+
* @constructor
|
1076
|
+
*/
|
1077
|
+
jasmine.JsApiReporter = function() {
|
1078
|
+
this.started = false;
|
1079
|
+
this.finished = false;
|
1080
|
+
this.suites_ = [];
|
1081
|
+
this.results_ = {};
|
1082
|
+
};
|
1083
|
+
|
1084
|
+
jasmine.JsApiReporter.prototype.reportRunnerStarting = function(runner) {
|
1085
|
+
this.started = true;
|
1086
|
+
var suites = runner.topLevelSuites();
|
1087
|
+
for (var i = 0; i < suites.length; i++) {
|
1088
|
+
var suite = suites[i];
|
1089
|
+
this.suites_.push(this.summarize_(suite));
|
1090
|
+
}
|
1091
|
+
};
|
1092
|
+
|
1093
|
+
jasmine.JsApiReporter.prototype.suites = function() {
|
1094
|
+
return this.suites_;
|
1095
|
+
};
|
1096
|
+
|
1097
|
+
jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) {
|
1098
|
+
var isSuite = suiteOrSpec instanceof jasmine.Suite;
|
1099
|
+
var summary = {
|
1100
|
+
id: suiteOrSpec.id,
|
1101
|
+
name: suiteOrSpec.description,
|
1102
|
+
type: isSuite ? 'suite' : 'spec',
|
1103
|
+
children: []
|
1104
|
+
};
|
1105
|
+
|
1106
|
+
if (isSuite) {
|
1107
|
+
var children = suiteOrSpec.children();
|
1108
|
+
for (var i = 0; i < children.length; i++) {
|
1109
|
+
summary.children.push(this.summarize_(children[i]));
|
1110
|
+
}
|
1111
|
+
}
|
1112
|
+
return summary;
|
1113
|
+
};
|
1114
|
+
|
1115
|
+
jasmine.JsApiReporter.prototype.results = function() {
|
1116
|
+
return this.results_;
|
1117
|
+
};
|
1118
|
+
|
1119
|
+
jasmine.JsApiReporter.prototype.resultsForSpec = function(specId) {
|
1120
|
+
return this.results_[specId];
|
1121
|
+
};
|
1122
|
+
|
1123
|
+
//noinspection JSUnusedLocalSymbols
|
1124
|
+
jasmine.JsApiReporter.prototype.reportRunnerResults = function(runner) {
|
1125
|
+
this.finished = true;
|
1126
|
+
};
|
1127
|
+
|
1128
|
+
//noinspection JSUnusedLocalSymbols
|
1129
|
+
jasmine.JsApiReporter.prototype.reportSuiteResults = function(suite) {
|
1130
|
+
};
|
1131
|
+
|
1132
|
+
//noinspection JSUnusedLocalSymbols
|
1133
|
+
jasmine.JsApiReporter.prototype.reportSpecResults = function(spec) {
|
1134
|
+
this.results_[spec.id] = {
|
1135
|
+
messages: spec.results().getItems(),
|
1136
|
+
result: spec.results().failedCount > 0 ? "failed" : "passed"
|
1137
|
+
};
|
1138
|
+
};
|
1139
|
+
|
1140
|
+
//noinspection JSUnusedLocalSymbols
|
1141
|
+
jasmine.JsApiReporter.prototype.log = function(str) {
|
1142
|
+
};
|
1143
|
+
|
1144
|
+
jasmine.JsApiReporter.prototype.resultsForSpecs = function(specIds){
|
1145
|
+
var results = {};
|
1146
|
+
for (var i = 0; i < specIds.length; i++) {
|
1147
|
+
var specId = specIds[i];
|
1148
|
+
results[specId] = this.summarizeResult_(this.results_[specId]);
|
1149
|
+
}
|
1150
|
+
return results;
|
1151
|
+
};
|
1152
|
+
|
1153
|
+
jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){
|
1154
|
+
var summaryMessages = [];
|
1155
|
+
var messagesLength = result.messages.length;
|
1156
|
+
for (var messageIndex = 0; messageIndex < messagesLength; messageIndex++) {
|
1157
|
+
var resultMessage = result.messages[messageIndex];
|
1158
|
+
summaryMessages.push({
|
1159
|
+
text: resultMessage.type == 'log' ? resultMessage.toString() : jasmine.undefined,
|
1160
|
+
passed: resultMessage.passed ? resultMessage.passed() : true,
|
1161
|
+
type: resultMessage.type,
|
1162
|
+
message: resultMessage.message,
|
1163
|
+
trace: {
|
1164
|
+
stack: resultMessage.passed && !resultMessage.passed() ? resultMessage.trace.stack : jasmine.undefined
|
1165
|
+
}
|
1166
|
+
});
|
1167
|
+
}
|
1168
|
+
|
1169
|
+
return {
|
1170
|
+
result : result.result,
|
1171
|
+
messages : summaryMessages
|
1172
|
+
};
|
1173
|
+
};
|
1174
|
+
|
1175
|
+
/**
|
1176
|
+
* @constructor
|
1177
|
+
* @param {jasmine.Env} env
|
1178
|
+
* @param actual
|
1179
|
+
* @param {jasmine.Spec} spec
|
1180
|
+
*/
|
1181
|
+
jasmine.Matchers = function(env, actual, spec, opt_isNot) {
|
1182
|
+
this.env = env;
|
1183
|
+
this.actual = actual;
|
1184
|
+
this.spec = spec;
|
1185
|
+
this.isNot = opt_isNot || false;
|
1186
|
+
this.reportWasCalled_ = false;
|
1187
|
+
};
|
1188
|
+
|
1189
|
+
// todo: @deprecated as of Jasmine 0.11, remove soon [xw]
|
1190
|
+
jasmine.Matchers.pp = function(str) {
|
1191
|
+
throw new Error("jasmine.Matchers.pp() is no longer supported, please use jasmine.pp() instead!");
|
1192
|
+
};
|
1193
|
+
|
1194
|
+
// todo: @deprecated Deprecated as of Jasmine 0.10. Rewrite your custom matchers to return true or false. [xw]
|
1195
|
+
jasmine.Matchers.prototype.report = function(result, failing_message, details) {
|
1196
|
+
throw new Error("As of jasmine 0.11, custom matchers must be implemented differently -- please see jasmine docs");
|
1197
|
+
};
|
1198
|
+
|
1199
|
+
jasmine.Matchers.wrapInto_ = function(prototype, matchersClass) {
|
1200
|
+
for (var methodName in prototype) {
|
1201
|
+
if (methodName == 'report') continue;
|
1202
|
+
var orig = prototype[methodName];
|
1203
|
+
matchersClass.prototype[methodName] = jasmine.Matchers.matcherFn_(methodName, orig);
|
1204
|
+
}
|
1205
|
+
};
|
1206
|
+
|
1207
|
+
jasmine.Matchers.matcherFn_ = function(matcherName, matcherFunction) {
|
1208
|
+
return function() {
|
1209
|
+
var matcherArgs = jasmine.util.argsToArray(arguments);
|
1210
|
+
var result = matcherFunction.apply(this, arguments);
|
1211
|
+
|
1212
|
+
if (this.isNot) {
|
1213
|
+
result = !result;
|
1214
|
+
}
|
1215
|
+
|
1216
|
+
if (this.reportWasCalled_) return result;
|
1217
|
+
|
1218
|
+
var message;
|
1219
|
+
if (!result) {
|
1220
|
+
if (this.message) {
|
1221
|
+
message = this.message.apply(this, arguments);
|
1222
|
+
if (jasmine.isArray_(message)) {
|
1223
|
+
message = message[this.isNot ? 1 : 0];
|
1224
|
+
}
|
1225
|
+
} else {
|
1226
|
+
var englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { return ' ' + s.toLowerCase(); });
|
1227
|
+
message = "Expected " + jasmine.pp(this.actual) + (this.isNot ? " not " : " ") + englishyPredicate;
|
1228
|
+
if (matcherArgs.length > 0) {
|
1229
|
+
for (var i = 0; i < matcherArgs.length; i++) {
|
1230
|
+
if (i > 0) message += ",";
|
1231
|
+
message += " " + jasmine.pp(matcherArgs[i]);
|
1232
|
+
}
|
1233
|
+
}
|
1234
|
+
message += ".";
|
1235
|
+
}
|
1236
|
+
}
|
1237
|
+
var expectationResult = new jasmine.ExpectationResult({
|
1238
|
+
matcherName: matcherName,
|
1239
|
+
passed: result,
|
1240
|
+
expected: matcherArgs.length > 1 ? matcherArgs : matcherArgs[0],
|
1241
|
+
actual: this.actual,
|
1242
|
+
message: message
|
1243
|
+
});
|
1244
|
+
this.spec.addMatcherResult(expectationResult);
|
1245
|
+
return jasmine.undefined;
|
1246
|
+
};
|
1247
|
+
};
|
1248
|
+
|
1249
|
+
|
1250
|
+
|
1251
|
+
|
1252
|
+
/**
|
1253
|
+
* toBe: compares the actual to the expected using ===
|
1254
|
+
* @param expected
|
1255
|
+
*/
|
1256
|
+
jasmine.Matchers.prototype.toBe = function(expected) {
|
1257
|
+
return this.actual === expected;
|
1258
|
+
};
|
1259
|
+
|
1260
|
+
/**
|
1261
|
+
* toNotBe: compares the actual to the expected using !==
|
1262
|
+
* @param expected
|
1263
|
+
* @deprecated as of 1.0. Use not.toBe() instead.
|
1264
|
+
*/
|
1265
|
+
jasmine.Matchers.prototype.toNotBe = function(expected) {
|
1266
|
+
return this.actual !== expected;
|
1267
|
+
};
|
1268
|
+
|
1269
|
+
/**
|
1270
|
+
* toEqual: compares the actual to the expected using common sense equality. Handles Objects, Arrays, etc.
|
1271
|
+
*
|
1272
|
+
* @param expected
|
1273
|
+
*/
|
1274
|
+
jasmine.Matchers.prototype.toEqual = function(expected) {
|
1275
|
+
return this.env.equals_(this.actual, expected);
|
1276
|
+
};
|
1277
|
+
|
1278
|
+
/**
|
1279
|
+
* toNotEqual: compares the actual to the expected using the ! of jasmine.Matchers.toEqual
|
1280
|
+
* @param expected
|
1281
|
+
* @deprecated as of 1.0. Use not.toEqual() instead.
|
1282
|
+
*/
|
1283
|
+
jasmine.Matchers.prototype.toNotEqual = function(expected) {
|
1284
|
+
return !this.env.equals_(this.actual, expected);
|
1285
|
+
};
|
1286
|
+
|
1287
|
+
/**
|
1288
|
+
* Matcher that compares the actual to the expected using a regular expression. Constructs a RegExp, so takes
|
1289
|
+
* a pattern or a String.
|
1290
|
+
*
|
1291
|
+
* @param expected
|
1292
|
+
*/
|
1293
|
+
jasmine.Matchers.prototype.toMatch = function(expected) {
|
1294
|
+
return new RegExp(expected).test(this.actual);
|
1295
|
+
};
|
1296
|
+
|
1297
|
+
/**
|
1298
|
+
* Matcher that compares the actual to the expected using the boolean inverse of jasmine.Matchers.toMatch
|
1299
|
+
* @param expected
|
1300
|
+
* @deprecated as of 1.0. Use not.toMatch() instead.
|
1301
|
+
*/
|
1302
|
+
jasmine.Matchers.prototype.toNotMatch = function(expected) {
|
1303
|
+
return !(new RegExp(expected).test(this.actual));
|
1304
|
+
};
|
1305
|
+
|
1306
|
+
/**
|
1307
|
+
* Matcher that compares the actual to jasmine.undefined.
|
1308
|
+
*/
|
1309
|
+
jasmine.Matchers.prototype.toBeDefined = function() {
|
1310
|
+
return (this.actual !== jasmine.undefined);
|
1311
|
+
};
|
1312
|
+
|
1313
|
+
/**
|
1314
|
+
* Matcher that compares the actual to jasmine.undefined.
|
1315
|
+
*/
|
1316
|
+
jasmine.Matchers.prototype.toBeUndefined = function() {
|
1317
|
+
return (this.actual === jasmine.undefined);
|
1318
|
+
};
|
1319
|
+
|
1320
|
+
/**
|
1321
|
+
* Matcher that compares the actual to null.
|
1322
|
+
*/
|
1323
|
+
jasmine.Matchers.prototype.toBeNull = function() {
|
1324
|
+
return (this.actual === null);
|
1325
|
+
};
|
1326
|
+
|
1327
|
+
/**
|
1328
|
+
* Matcher that compares the actual to NaN.
|
1329
|
+
*/
|
1330
|
+
jasmine.Matchers.prototype.toBeNaN = function() {
|
1331
|
+
this.message = function() {
|
1332
|
+
return [ "Expected " + jasmine.pp(this.actual) + " to be NaN." ];
|
1333
|
+
};
|
1334
|
+
|
1335
|
+
return (this.actual !== this.actual);
|
1336
|
+
};
|
1337
|
+
|
1338
|
+
/**
|
1339
|
+
* Matcher that boolean not-nots the actual.
|
1340
|
+
*/
|
1341
|
+
jasmine.Matchers.prototype.toBeTruthy = function() {
|
1342
|
+
return !!this.actual;
|
1343
|
+
};
|
1344
|
+
|
1345
|
+
|
1346
|
+
/**
|
1347
|
+
* Matcher that boolean nots the actual.
|
1348
|
+
*/
|
1349
|
+
jasmine.Matchers.prototype.toBeFalsy = function() {
|
1350
|
+
return !this.actual;
|
1351
|
+
};
|
1352
|
+
|
1353
|
+
|
1354
|
+
/**
|
1355
|
+
* Matcher that checks to see if the actual, a Jasmine spy, was called.
|
1356
|
+
*/
|
1357
|
+
jasmine.Matchers.prototype.toHaveBeenCalled = function() {
|
1358
|
+
if (arguments.length > 0) {
|
1359
|
+
throw new Error('toHaveBeenCalled does not take arguments, use toHaveBeenCalledWith');
|
1360
|
+
}
|
1361
|
+
|
1362
|
+
if (!jasmine.isSpy(this.actual)) {
|
1363
|
+
throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
|
1364
|
+
}
|
1365
|
+
|
1366
|
+
this.message = function() {
|
1367
|
+
return [
|
1368
|
+
"Expected spy " + this.actual.identity + " to have been called.",
|
1369
|
+
"Expected spy " + this.actual.identity + " not to have been called."
|
1370
|
+
];
|
1371
|
+
};
|
1372
|
+
|
1373
|
+
return this.actual.wasCalled;
|
1374
|
+
};
|
1375
|
+
|
1376
|
+
/** @deprecated Use expect(xxx).toHaveBeenCalled() instead */
|
1377
|
+
jasmine.Matchers.prototype.wasCalled = jasmine.Matchers.prototype.toHaveBeenCalled;
|
1378
|
+
|
1379
|
+
/**
|
1380
|
+
* Matcher that checks to see if the actual, a Jasmine spy, was not called.
|
1381
|
+
*
|
1382
|
+
* @deprecated Use expect(xxx).not.toHaveBeenCalled() instead
|
1383
|
+
*/
|
1384
|
+
jasmine.Matchers.prototype.wasNotCalled = function() {
|
1385
|
+
if (arguments.length > 0) {
|
1386
|
+
throw new Error('wasNotCalled does not take arguments');
|
1387
|
+
}
|
1388
|
+
|
1389
|
+
if (!jasmine.isSpy(this.actual)) {
|
1390
|
+
throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
|
1391
|
+
}
|
1392
|
+
|
1393
|
+
this.message = function() {
|
1394
|
+
return [
|
1395
|
+
"Expected spy " + this.actual.identity + " to not have been called.",
|
1396
|
+
"Expected spy " + this.actual.identity + " to have been called."
|
1397
|
+
];
|
1398
|
+
};
|
1399
|
+
|
1400
|
+
return !this.actual.wasCalled;
|
1401
|
+
};
|
1402
|
+
|
1403
|
+
/**
|
1404
|
+
* Matcher that checks to see if the actual, a Jasmine spy, was called with a set of parameters.
|
1405
|
+
*
|
1406
|
+
* @example
|
1407
|
+
*
|
1408
|
+
*/
|
1409
|
+
jasmine.Matchers.prototype.toHaveBeenCalledWith = function() {
|
1410
|
+
var expectedArgs = jasmine.util.argsToArray(arguments);
|
1411
|
+
if (!jasmine.isSpy(this.actual)) {
|
1412
|
+
throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
|
1413
|
+
}
|
1414
|
+
this.message = function() {
|
1415
|
+
var invertedMessage = "Expected spy " + this.actual.identity + " not to have been called with " + jasmine.pp(expectedArgs) + " but it was.";
|
1416
|
+
var positiveMessage = "";
|
1417
|
+
if (this.actual.callCount === 0) {
|
1418
|
+
positiveMessage = "Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but it was never called.";
|
1419
|
+
} else {
|
1420
|
+
positiveMessage = "Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but actual calls were " + jasmine.pp(this.actual.argsForCall).replace(/^\[ | \]$/g, '')
|
1421
|
+
}
|
1422
|
+
return [positiveMessage, invertedMessage];
|
1423
|
+
};
|
1424
|
+
|
1425
|
+
return this.env.contains_(this.actual.argsForCall, expectedArgs);
|
1426
|
+
};
|
1427
|
+
|
1428
|
+
/** @deprecated Use expect(xxx).toHaveBeenCalledWith() instead */
|
1429
|
+
jasmine.Matchers.prototype.wasCalledWith = jasmine.Matchers.prototype.toHaveBeenCalledWith;
|
1430
|
+
|
1431
|
+
/** @deprecated Use expect(xxx).not.toHaveBeenCalledWith() instead */
|
1432
|
+
jasmine.Matchers.prototype.wasNotCalledWith = function() {
|
1433
|
+
var expectedArgs = jasmine.util.argsToArray(arguments);
|
1434
|
+
if (!jasmine.isSpy(this.actual)) {
|
1435
|
+
throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
|
1436
|
+
}
|
1437
|
+
|
1438
|
+
this.message = function() {
|
1439
|
+
return [
|
1440
|
+
"Expected spy not to have been called with " + jasmine.pp(expectedArgs) + " but it was",
|
1441
|
+
"Expected spy to have been called with " + jasmine.pp(expectedArgs) + " but it was"
|
1442
|
+
];
|
1443
|
+
};
|
1444
|
+
|
1445
|
+
return !this.env.contains_(this.actual.argsForCall, expectedArgs);
|
1446
|
+
};
|
1447
|
+
|
1448
|
+
/**
|
1449
|
+
* Matcher that checks that the expected item is an element in the actual Array.
|
1450
|
+
*
|
1451
|
+
* @param {Object} expected
|
1452
|
+
*/
|
1453
|
+
jasmine.Matchers.prototype.toContain = function(expected) {
|
1454
|
+
return this.env.contains_(this.actual, expected);
|
1455
|
+
};
|
1456
|
+
|
1457
|
+
/**
|
1458
|
+
* Matcher that checks that the expected item is NOT an element in the actual Array.
|
1459
|
+
*
|
1460
|
+
* @param {Object} expected
|
1461
|
+
* @deprecated as of 1.0. Use not.toContain() instead.
|
1462
|
+
*/
|
1463
|
+
jasmine.Matchers.prototype.toNotContain = function(expected) {
|
1464
|
+
return !this.env.contains_(this.actual, expected);
|
1465
|
+
};
|
1466
|
+
|
1467
|
+
jasmine.Matchers.prototype.toBeLessThan = function(expected) {
|
1468
|
+
return this.actual < expected;
|
1469
|
+
};
|
1470
|
+
|
1471
|
+
jasmine.Matchers.prototype.toBeGreaterThan = function(expected) {
|
1472
|
+
return this.actual > expected;
|
1473
|
+
};
|
1474
|
+
|
1475
|
+
/**
|
1476
|
+
* Matcher that checks that the expected item is equal to the actual item
|
1477
|
+
* up to a given level of decimal precision (default 2).
|
1478
|
+
*
|
1479
|
+
* @param {Number} expected
|
1480
|
+
* @param {Number} precision, as number of decimal places
|
1481
|
+
*/
|
1482
|
+
jasmine.Matchers.prototype.toBeCloseTo = function(expected, precision) {
|
1483
|
+
if (!(precision === 0)) {
|
1484
|
+
precision = precision || 2;
|
1485
|
+
}
|
1486
|
+
return Math.abs(expected - this.actual) < (Math.pow(10, -precision) / 2);
|
1487
|
+
};
|
1488
|
+
|
1489
|
+
/**
|
1490
|
+
* Matcher that checks that the expected exception was thrown by the actual.
|
1491
|
+
*
|
1492
|
+
* @param {String} [expected]
|
1493
|
+
*/
|
1494
|
+
jasmine.Matchers.prototype.toThrow = function(expected) {
|
1495
|
+
var result = false;
|
1496
|
+
var exception;
|
1497
|
+
if (typeof this.actual != 'function') {
|
1498
|
+
throw new Error('Actual is not a function');
|
1499
|
+
}
|
1500
|
+
try {
|
1501
|
+
this.actual();
|
1502
|
+
} catch (e) {
|
1503
|
+
exception = e;
|
1504
|
+
}
|
1505
|
+
if (exception) {
|
1506
|
+
result = (expected === jasmine.undefined || this.env.equals_(exception.message || exception, expected.message || expected));
|
1507
|
+
}
|
1508
|
+
|
1509
|
+
var not = this.isNot ? "not " : "";
|
1510
|
+
|
1511
|
+
this.message = function() {
|
1512
|
+
if (exception && (expected === jasmine.undefined || !this.env.equals_(exception.message || exception, expected.message || expected))) {
|
1513
|
+
return ["Expected function " + not + "to throw", expected ? expected.message || expected : "an exception", ", but it threw", exception.message || exception].join(' ');
|
1514
|
+
} else {
|
1515
|
+
return "Expected function to throw an exception.";
|
1516
|
+
}
|
1517
|
+
};
|
1518
|
+
|
1519
|
+
return result;
|
1520
|
+
};
|
1521
|
+
|
1522
|
+
jasmine.Matchers.Any = function(expectedClass) {
|
1523
|
+
this.expectedClass = expectedClass;
|
1524
|
+
};
|
1525
|
+
|
1526
|
+
jasmine.Matchers.Any.prototype.jasmineMatches = function(other) {
|
1527
|
+
if (this.expectedClass == String) {
|
1528
|
+
return typeof other == 'string' || other instanceof String;
|
1529
|
+
}
|
1530
|
+
|
1531
|
+
if (this.expectedClass == Number) {
|
1532
|
+
return typeof other == 'number' || other instanceof Number;
|
1533
|
+
}
|
1534
|
+
|
1535
|
+
if (this.expectedClass == Function) {
|
1536
|
+
return typeof other == 'function' || other instanceof Function;
|
1537
|
+
}
|
1538
|
+
|
1539
|
+
if (this.expectedClass == Object) {
|
1540
|
+
return typeof other == 'object';
|
1541
|
+
}
|
1542
|
+
|
1543
|
+
return other instanceof this.expectedClass;
|
1544
|
+
};
|
1545
|
+
|
1546
|
+
jasmine.Matchers.Any.prototype.jasmineToString = function() {
|
1547
|
+
return '<jasmine.any(' + this.expectedClass + ')>';
|
1548
|
+
};
|
1549
|
+
|
1550
|
+
jasmine.Matchers.ObjectContaining = function (sample) {
|
1551
|
+
this.sample = sample;
|
1552
|
+
};
|
1553
|
+
|
1554
|
+
jasmine.Matchers.ObjectContaining.prototype.jasmineMatches = function(other, mismatchKeys, mismatchValues) {
|
1555
|
+
mismatchKeys = mismatchKeys || [];
|
1556
|
+
mismatchValues = mismatchValues || [];
|
1557
|
+
|
1558
|
+
var env = jasmine.getEnv();
|
1559
|
+
|
1560
|
+
var hasKey = function(obj, keyName) {
|
1561
|
+
return obj != null && obj[keyName] !== jasmine.undefined;
|
1562
|
+
};
|
1563
|
+
|
1564
|
+
for (var property in this.sample) {
|
1565
|
+
if (!hasKey(other, property) && hasKey(this.sample, property)) {
|
1566
|
+
mismatchKeys.push("expected has key '" + property + "', but missing from actual.");
|
1567
|
+
}
|
1568
|
+
else if (!env.equals_(this.sample[property], other[property], mismatchKeys, mismatchValues)) {
|
1569
|
+
mismatchValues.push("'" + property + "' was '" + (other[property] ? jasmine.util.htmlEscape(other[property].toString()) : other[property]) + "' in expected, but was '" + (this.sample[property] ? jasmine.util.htmlEscape(this.sample[property].toString()) : this.sample[property]) + "' in actual.");
|
1570
|
+
}
|
1571
|
+
}
|
1572
|
+
|
1573
|
+
return (mismatchKeys.length === 0 && mismatchValues.length === 0);
|
1574
|
+
};
|
1575
|
+
|
1576
|
+
jasmine.Matchers.ObjectContaining.prototype.jasmineToString = function () {
|
1577
|
+
return "<jasmine.objectContaining(" + jasmine.pp(this.sample) + ")>";
|
1578
|
+
};
|
1579
|
+
// Mock setTimeout, clearTimeout
|
1580
|
+
// Contributed by Pivotal Computer Systems, www.pivotalsf.com
|
1581
|
+
|
1582
|
+
jasmine.FakeTimer = function() {
|
1583
|
+
this.reset();
|
1584
|
+
|
1585
|
+
var self = this;
|
1586
|
+
self.setTimeout = function(funcToCall, millis) {
|
1587
|
+
self.timeoutsMade++;
|
1588
|
+
self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false);
|
1589
|
+
return self.timeoutsMade;
|
1590
|
+
};
|
1591
|
+
|
1592
|
+
self.setInterval = function(funcToCall, millis) {
|
1593
|
+
self.timeoutsMade++;
|
1594
|
+
self.scheduleFunction(self.timeoutsMade, funcToCall, millis, true);
|
1595
|
+
return self.timeoutsMade;
|
1596
|
+
};
|
1597
|
+
|
1598
|
+
self.clearTimeout = function(timeoutKey) {
|
1599
|
+
self.scheduledFunctions[timeoutKey] = jasmine.undefined;
|
1600
|
+
};
|
1601
|
+
|
1602
|
+
self.clearInterval = function(timeoutKey) {
|
1603
|
+
self.scheduledFunctions[timeoutKey] = jasmine.undefined;
|
1604
|
+
};
|
1605
|
+
|
1606
|
+
};
|
1607
|
+
|
1608
|
+
jasmine.FakeTimer.prototype.reset = function() {
|
1609
|
+
this.timeoutsMade = 0;
|
1610
|
+
this.scheduledFunctions = {};
|
1611
|
+
this.nowMillis = 0;
|
1612
|
+
};
|
1613
|
+
|
1614
|
+
jasmine.FakeTimer.prototype.tick = function(millis) {
|
1615
|
+
var oldMillis = this.nowMillis;
|
1616
|
+
var newMillis = oldMillis + millis;
|
1617
|
+
this.runFunctionsWithinRange(oldMillis, newMillis);
|
1618
|
+
this.nowMillis = newMillis;
|
1619
|
+
};
|
1620
|
+
|
1621
|
+
jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) {
|
1622
|
+
var scheduledFunc;
|
1623
|
+
var funcsToRun = [];
|
1624
|
+
for (var timeoutKey in this.scheduledFunctions) {
|
1625
|
+
scheduledFunc = this.scheduledFunctions[timeoutKey];
|
1626
|
+
if (scheduledFunc != jasmine.undefined &&
|
1627
|
+
scheduledFunc.runAtMillis >= oldMillis &&
|
1628
|
+
scheduledFunc.runAtMillis <= nowMillis) {
|
1629
|
+
funcsToRun.push(scheduledFunc);
|
1630
|
+
this.scheduledFunctions[timeoutKey] = jasmine.undefined;
|
1631
|
+
}
|
1632
|
+
}
|
1633
|
+
|
1634
|
+
if (funcsToRun.length > 0) {
|
1635
|
+
funcsToRun.sort(function(a, b) {
|
1636
|
+
return a.runAtMillis - b.runAtMillis;
|
1637
|
+
});
|
1638
|
+
for (var i = 0; i < funcsToRun.length; ++i) {
|
1639
|
+
try {
|
1640
|
+
var funcToRun = funcsToRun[i];
|
1641
|
+
this.nowMillis = funcToRun.runAtMillis;
|
1642
|
+
funcToRun.funcToCall();
|
1643
|
+
if (funcToRun.recurring) {
|
1644
|
+
this.scheduleFunction(funcToRun.timeoutKey,
|
1645
|
+
funcToRun.funcToCall,
|
1646
|
+
funcToRun.millis,
|
1647
|
+
true);
|
1648
|
+
}
|
1649
|
+
} catch(e) {
|
1650
|
+
}
|
1651
|
+
}
|
1652
|
+
this.runFunctionsWithinRange(oldMillis, nowMillis);
|
1653
|
+
}
|
1654
|
+
};
|
1655
|
+
|
1656
|
+
jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, millis, recurring) {
|
1657
|
+
this.scheduledFunctions[timeoutKey] = {
|
1658
|
+
runAtMillis: this.nowMillis + millis,
|
1659
|
+
funcToCall: funcToCall,
|
1660
|
+
recurring: recurring,
|
1661
|
+
timeoutKey: timeoutKey,
|
1662
|
+
millis: millis
|
1663
|
+
};
|
1664
|
+
};
|
1665
|
+
|
1666
|
+
/**
|
1667
|
+
* @namespace
|
1668
|
+
*/
|
1669
|
+
jasmine.Clock = {
|
1670
|
+
defaultFakeTimer: new jasmine.FakeTimer(),
|
1671
|
+
|
1672
|
+
reset: function() {
|
1673
|
+
jasmine.Clock.assertInstalled();
|
1674
|
+
jasmine.Clock.defaultFakeTimer.reset();
|
1675
|
+
},
|
1676
|
+
|
1677
|
+
tick: function(millis) {
|
1678
|
+
jasmine.Clock.assertInstalled();
|
1679
|
+
jasmine.Clock.defaultFakeTimer.tick(millis);
|
1680
|
+
},
|
1681
|
+
|
1682
|
+
runFunctionsWithinRange: function(oldMillis, nowMillis) {
|
1683
|
+
jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis);
|
1684
|
+
},
|
1685
|
+
|
1686
|
+
scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) {
|
1687
|
+
jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring);
|
1688
|
+
},
|
1689
|
+
|
1690
|
+
useMock: function() {
|
1691
|
+
if (!jasmine.Clock.isInstalled()) {
|
1692
|
+
var spec = jasmine.getEnv().currentSpec;
|
1693
|
+
spec.after(jasmine.Clock.uninstallMock);
|
1694
|
+
|
1695
|
+
jasmine.Clock.installMock();
|
1696
|
+
}
|
1697
|
+
},
|
1698
|
+
|
1699
|
+
installMock: function() {
|
1700
|
+
jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer;
|
1701
|
+
},
|
1702
|
+
|
1703
|
+
uninstallMock: function() {
|
1704
|
+
jasmine.Clock.assertInstalled();
|
1705
|
+
jasmine.Clock.installed = jasmine.Clock.real;
|
1706
|
+
},
|
1707
|
+
|
1708
|
+
real: {
|
1709
|
+
setTimeout: jasmine.getGlobal().setTimeout,
|
1710
|
+
clearTimeout: jasmine.getGlobal().clearTimeout,
|
1711
|
+
setInterval: jasmine.getGlobal().setInterval,
|
1712
|
+
clearInterval: jasmine.getGlobal().clearInterval
|
1713
|
+
},
|
1714
|
+
|
1715
|
+
assertInstalled: function() {
|
1716
|
+
if (!jasmine.Clock.isInstalled()) {
|
1717
|
+
throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()");
|
1718
|
+
}
|
1719
|
+
},
|
1720
|
+
|
1721
|
+
isInstalled: function() {
|
1722
|
+
return jasmine.Clock.installed == jasmine.Clock.defaultFakeTimer;
|
1723
|
+
},
|
1724
|
+
|
1725
|
+
installed: null
|
1726
|
+
};
|
1727
|
+
jasmine.Clock.installed = jasmine.Clock.real;
|
1728
|
+
|
1729
|
+
//else for IE support
|
1730
|
+
jasmine.getGlobal().setTimeout = function(funcToCall, millis) {
|
1731
|
+
if (jasmine.Clock.installed.setTimeout.apply) {
|
1732
|
+
return jasmine.Clock.installed.setTimeout.apply(this, arguments);
|
1733
|
+
} else {
|
1734
|
+
return jasmine.Clock.installed.setTimeout(funcToCall, millis);
|
1735
|
+
}
|
1736
|
+
};
|
1737
|
+
|
1738
|
+
jasmine.getGlobal().setInterval = function(funcToCall, millis) {
|
1739
|
+
if (jasmine.Clock.installed.setInterval.apply) {
|
1740
|
+
return jasmine.Clock.installed.setInterval.apply(this, arguments);
|
1741
|
+
} else {
|
1742
|
+
return jasmine.Clock.installed.setInterval(funcToCall, millis);
|
1743
|
+
}
|
1744
|
+
};
|
1745
|
+
|
1746
|
+
jasmine.getGlobal().clearTimeout = function(timeoutKey) {
|
1747
|
+
if (jasmine.Clock.installed.clearTimeout.apply) {
|
1748
|
+
return jasmine.Clock.installed.clearTimeout.apply(this, arguments);
|
1749
|
+
} else {
|
1750
|
+
return jasmine.Clock.installed.clearTimeout(timeoutKey);
|
1751
|
+
}
|
1752
|
+
};
|
1753
|
+
|
1754
|
+
jasmine.getGlobal().clearInterval = function(timeoutKey) {
|
1755
|
+
if (jasmine.Clock.installed.clearTimeout.apply) {
|
1756
|
+
return jasmine.Clock.installed.clearInterval.apply(this, arguments);
|
1757
|
+
} else {
|
1758
|
+
return jasmine.Clock.installed.clearInterval(timeoutKey);
|
1759
|
+
}
|
1760
|
+
};
|
1761
|
+
|
1762
|
+
/**
|
1763
|
+
* @constructor
|
1764
|
+
*/
|
1765
|
+
jasmine.MultiReporter = function() {
|
1766
|
+
this.subReporters_ = [];
|
1767
|
+
};
|
1768
|
+
jasmine.util.inherit(jasmine.MultiReporter, jasmine.Reporter);
|
1769
|
+
|
1770
|
+
jasmine.MultiReporter.prototype.addReporter = function(reporter) {
|
1771
|
+
this.subReporters_.push(reporter);
|
1772
|
+
};
|
1773
|
+
|
1774
|
+
(function() {
|
1775
|
+
var functionNames = [
|
1776
|
+
"reportRunnerStarting",
|
1777
|
+
"reportRunnerResults",
|
1778
|
+
"reportSuiteResults",
|
1779
|
+
"reportSpecStarting",
|
1780
|
+
"reportSpecResults",
|
1781
|
+
"log"
|
1782
|
+
];
|
1783
|
+
for (var i = 0; i < functionNames.length; i++) {
|
1784
|
+
var functionName = functionNames[i];
|
1785
|
+
jasmine.MultiReporter.prototype[functionName] = (function(functionName) {
|
1786
|
+
return function() {
|
1787
|
+
for (var j = 0; j < this.subReporters_.length; j++) {
|
1788
|
+
var subReporter = this.subReporters_[j];
|
1789
|
+
if (subReporter[functionName]) {
|
1790
|
+
subReporter[functionName].apply(subReporter, arguments);
|
1791
|
+
}
|
1792
|
+
}
|
1793
|
+
};
|
1794
|
+
})(functionName);
|
1795
|
+
}
|
1796
|
+
})();
|
1797
|
+
/**
|
1798
|
+
* Holds results for a set of Jasmine spec. Allows for the results array to hold another jasmine.NestedResults
|
1799
|
+
*
|
1800
|
+
* @constructor
|
1801
|
+
*/
|
1802
|
+
jasmine.NestedResults = function() {
|
1803
|
+
/**
|
1804
|
+
* The total count of results
|
1805
|
+
*/
|
1806
|
+
this.totalCount = 0;
|
1807
|
+
/**
|
1808
|
+
* Number of passed results
|
1809
|
+
*/
|
1810
|
+
this.passedCount = 0;
|
1811
|
+
/**
|
1812
|
+
* Number of failed results
|
1813
|
+
*/
|
1814
|
+
this.failedCount = 0;
|
1815
|
+
/**
|
1816
|
+
* Was this suite/spec skipped?
|
1817
|
+
*/
|
1818
|
+
this.skipped = false;
|
1819
|
+
/**
|
1820
|
+
* @ignore
|
1821
|
+
*/
|
1822
|
+
this.items_ = [];
|
1823
|
+
};
|
1824
|
+
|
1825
|
+
/**
|
1826
|
+
* Roll up the result counts.
|
1827
|
+
*
|
1828
|
+
* @param result
|
1829
|
+
*/
|
1830
|
+
jasmine.NestedResults.prototype.rollupCounts = function(result) {
|
1831
|
+
this.totalCount += result.totalCount;
|
1832
|
+
this.passedCount += result.passedCount;
|
1833
|
+
this.failedCount += result.failedCount;
|
1834
|
+
};
|
1835
|
+
|
1836
|
+
/**
|
1837
|
+
* Adds a log message.
|
1838
|
+
* @param values Array of message parts which will be concatenated later.
|
1839
|
+
*/
|
1840
|
+
jasmine.NestedResults.prototype.log = function(values) {
|
1841
|
+
this.items_.push(new jasmine.MessageResult(values));
|
1842
|
+
};
|
1843
|
+
|
1844
|
+
/**
|
1845
|
+
* Getter for the results: message & results.
|
1846
|
+
*/
|
1847
|
+
jasmine.NestedResults.prototype.getItems = function() {
|
1848
|
+
return this.items_;
|
1849
|
+
};
|
1850
|
+
|
1851
|
+
/**
|
1852
|
+
* Adds a result, tracking counts (total, passed, & failed)
|
1853
|
+
* @param {jasmine.ExpectationResult|jasmine.NestedResults} result
|
1854
|
+
*/
|
1855
|
+
jasmine.NestedResults.prototype.addResult = function(result) {
|
1856
|
+
if (result.type != 'log') {
|
1857
|
+
if (result.items_) {
|
1858
|
+
this.rollupCounts(result);
|
1859
|
+
} else {
|
1860
|
+
this.totalCount++;
|
1861
|
+
if (result.passed()) {
|
1862
|
+
this.passedCount++;
|
1863
|
+
} else {
|
1864
|
+
this.failedCount++;
|
1865
|
+
}
|
1866
|
+
}
|
1867
|
+
}
|
1868
|
+
this.items_.push(result);
|
1869
|
+
};
|
1870
|
+
|
1871
|
+
/**
|
1872
|
+
* @returns {Boolean} True if <b>everything</b> below passed
|
1873
|
+
*/
|
1874
|
+
jasmine.NestedResults.prototype.passed = function() {
|
1875
|
+
return this.passedCount === this.totalCount;
|
1876
|
+
};
|
1877
|
+
/**
|
1878
|
+
* Base class for pretty printing for expectation results.
|
1879
|
+
*/
|
1880
|
+
jasmine.PrettyPrinter = function() {
|
1881
|
+
this.ppNestLevel_ = 0;
|
1882
|
+
};
|
1883
|
+
|
1884
|
+
/**
|
1885
|
+
* Formats a value in a nice, human-readable string.
|
1886
|
+
*
|
1887
|
+
* @param value
|
1888
|
+
*/
|
1889
|
+
jasmine.PrettyPrinter.prototype.format = function(value) {
|
1890
|
+
this.ppNestLevel_++;
|
1891
|
+
try {
|
1892
|
+
if (value === jasmine.undefined) {
|
1893
|
+
this.emitScalar('undefined');
|
1894
|
+
} else if (value === null) {
|
1895
|
+
this.emitScalar('null');
|
1896
|
+
} else if (value === jasmine.getGlobal()) {
|
1897
|
+
this.emitScalar('<global>');
|
1898
|
+
} else if (value.jasmineToString) {
|
1899
|
+
this.emitScalar(value.jasmineToString());
|
1900
|
+
} else if (typeof value === 'string') {
|
1901
|
+
this.emitString(value);
|
1902
|
+
} else if (jasmine.isSpy(value)) {
|
1903
|
+
this.emitScalar("spy on " + value.identity);
|
1904
|
+
} else if (value instanceof RegExp) {
|
1905
|
+
this.emitScalar(value.toString());
|
1906
|
+
} else if (typeof value === 'function') {
|
1907
|
+
this.emitScalar('Function');
|
1908
|
+
} else if (typeof value.nodeType === 'number') {
|
1909
|
+
this.emitScalar('HTMLNode');
|
1910
|
+
} else if (value instanceof Date) {
|
1911
|
+
this.emitScalar('Date(' + value + ')');
|
1912
|
+
} else if (value.__Jasmine_been_here_before__) {
|
1913
|
+
this.emitScalar('<circular reference: ' + (jasmine.isArray_(value) ? 'Array' : 'Object') + '>');
|
1914
|
+
} else if (jasmine.isArray_(value) || typeof value == 'object') {
|
1915
|
+
value.__Jasmine_been_here_before__ = true;
|
1916
|
+
if (jasmine.isArray_(value)) {
|
1917
|
+
this.emitArray(value);
|
1918
|
+
} else {
|
1919
|
+
this.emitObject(value);
|
1920
|
+
}
|
1921
|
+
delete value.__Jasmine_been_here_before__;
|
1922
|
+
} else {
|
1923
|
+
this.emitScalar(value.toString());
|
1924
|
+
}
|
1925
|
+
} finally {
|
1926
|
+
this.ppNestLevel_--;
|
1927
|
+
}
|
1928
|
+
};
|
1929
|
+
|
1930
|
+
jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) {
|
1931
|
+
for (var property in obj) {
|
1932
|
+
if (!obj.hasOwnProperty(property)) continue;
|
1933
|
+
if (property == '__Jasmine_been_here_before__') continue;
|
1934
|
+
fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) !== jasmine.undefined &&
|
1935
|
+
obj.__lookupGetter__(property) !== null) : false);
|
1936
|
+
}
|
1937
|
+
};
|
1938
|
+
|
1939
|
+
jasmine.PrettyPrinter.prototype.emitArray = jasmine.unimplementedMethod_;
|
1940
|
+
jasmine.PrettyPrinter.prototype.emitObject = jasmine.unimplementedMethod_;
|
1941
|
+
jasmine.PrettyPrinter.prototype.emitScalar = jasmine.unimplementedMethod_;
|
1942
|
+
jasmine.PrettyPrinter.prototype.emitString = jasmine.unimplementedMethod_;
|
1943
|
+
|
1944
|
+
jasmine.StringPrettyPrinter = function() {
|
1945
|
+
jasmine.PrettyPrinter.call(this);
|
1946
|
+
|
1947
|
+
this.string = '';
|
1948
|
+
};
|
1949
|
+
jasmine.util.inherit(jasmine.StringPrettyPrinter, jasmine.PrettyPrinter);
|
1950
|
+
|
1951
|
+
jasmine.StringPrettyPrinter.prototype.emitScalar = function(value) {
|
1952
|
+
this.append(value);
|
1953
|
+
};
|
1954
|
+
|
1955
|
+
jasmine.StringPrettyPrinter.prototype.emitString = function(value) {
|
1956
|
+
this.append("'" + value + "'");
|
1957
|
+
};
|
1958
|
+
|
1959
|
+
jasmine.StringPrettyPrinter.prototype.emitArray = function(array) {
|
1960
|
+
if (this.ppNestLevel_ > jasmine.MAX_PRETTY_PRINT_DEPTH) {
|
1961
|
+
this.append("Array");
|
1962
|
+
return;
|
1963
|
+
}
|
1964
|
+
|
1965
|
+
this.append('[ ');
|
1966
|
+
for (var i = 0; i < array.length; i++) {
|
1967
|
+
if (i > 0) {
|
1968
|
+
this.append(', ');
|
1969
|
+
}
|
1970
|
+
this.format(array[i]);
|
1971
|
+
}
|
1972
|
+
this.append(' ]');
|
1973
|
+
};
|
1974
|
+
|
1975
|
+
jasmine.StringPrettyPrinter.prototype.emitObject = function(obj) {
|
1976
|
+
if (this.ppNestLevel_ > jasmine.MAX_PRETTY_PRINT_DEPTH) {
|
1977
|
+
this.append("Object");
|
1978
|
+
return;
|
1979
|
+
}
|
1980
|
+
|
1981
|
+
var self = this;
|
1982
|
+
this.append('{ ');
|
1983
|
+
var first = true;
|
1984
|
+
|
1985
|
+
this.iterateObject(obj, function(property, isGetter) {
|
1986
|
+
if (first) {
|
1987
|
+
first = false;
|
1988
|
+
} else {
|
1989
|
+
self.append(', ');
|
1990
|
+
}
|
1991
|
+
|
1992
|
+
self.append(property);
|
1993
|
+
self.append(' : ');
|
1994
|
+
if (isGetter) {
|
1995
|
+
self.append('<getter>');
|
1996
|
+
} else {
|
1997
|
+
self.format(obj[property]);
|
1998
|
+
}
|
1999
|
+
});
|
2000
|
+
|
2001
|
+
this.append(' }');
|
2002
|
+
};
|
2003
|
+
|
2004
|
+
jasmine.StringPrettyPrinter.prototype.append = function(value) {
|
2005
|
+
this.string += value;
|
2006
|
+
};
|
2007
|
+
jasmine.Queue = function(env) {
|
2008
|
+
this.env = env;
|
2009
|
+
|
2010
|
+
// parallel to blocks. each true value in this array means the block will
|
2011
|
+
// get executed even if we abort
|
2012
|
+
this.ensured = [];
|
2013
|
+
this.blocks = [];
|
2014
|
+
this.running = false;
|
2015
|
+
this.index = 0;
|
2016
|
+
this.offset = 0;
|
2017
|
+
this.abort = false;
|
2018
|
+
};
|
2019
|
+
|
2020
|
+
jasmine.Queue.prototype.addBefore = function(block, ensure) {
|
2021
|
+
if (ensure === jasmine.undefined) {
|
2022
|
+
ensure = false;
|
2023
|
+
}
|
2024
|
+
|
2025
|
+
this.blocks.unshift(block);
|
2026
|
+
this.ensured.unshift(ensure);
|
2027
|
+
};
|
2028
|
+
|
2029
|
+
jasmine.Queue.prototype.add = function(block, ensure) {
|
2030
|
+
if (ensure === jasmine.undefined) {
|
2031
|
+
ensure = false;
|
2032
|
+
}
|
2033
|
+
|
2034
|
+
this.blocks.push(block);
|
2035
|
+
this.ensured.push(ensure);
|
2036
|
+
};
|
2037
|
+
|
2038
|
+
jasmine.Queue.prototype.insertNext = function(block, ensure) {
|
2039
|
+
if (ensure === jasmine.undefined) {
|
2040
|
+
ensure = false;
|
2041
|
+
}
|
2042
|
+
|
2043
|
+
this.ensured.splice((this.index + this.offset + 1), 0, ensure);
|
2044
|
+
this.blocks.splice((this.index + this.offset + 1), 0, block);
|
2045
|
+
this.offset++;
|
2046
|
+
};
|
2047
|
+
|
2048
|
+
jasmine.Queue.prototype.start = function(onComplete) {
|
2049
|
+
this.running = true;
|
2050
|
+
this.onComplete = onComplete;
|
2051
|
+
this.next_();
|
2052
|
+
};
|
2053
|
+
|
2054
|
+
jasmine.Queue.prototype.isRunning = function() {
|
2055
|
+
return this.running;
|
2056
|
+
};
|
2057
|
+
|
2058
|
+
jasmine.Queue.LOOP_DONT_RECURSE = true;
|
2059
|
+
|
2060
|
+
jasmine.Queue.prototype.next_ = function() {
|
2061
|
+
var self = this;
|
2062
|
+
var goAgain = true;
|
2063
|
+
|
2064
|
+
while (goAgain) {
|
2065
|
+
goAgain = false;
|
2066
|
+
|
2067
|
+
if (self.index < self.blocks.length && !(this.abort && !this.ensured[self.index])) {
|
2068
|
+
var calledSynchronously = true;
|
2069
|
+
var completedSynchronously = false;
|
2070
|
+
|
2071
|
+
var onComplete = function () {
|
2072
|
+
if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) {
|
2073
|
+
completedSynchronously = true;
|
2074
|
+
return;
|
2075
|
+
}
|
2076
|
+
|
2077
|
+
if (self.blocks[self.index].abort) {
|
2078
|
+
self.abort = true;
|
2079
|
+
}
|
2080
|
+
|
2081
|
+
self.offset = 0;
|
2082
|
+
self.index++;
|
2083
|
+
|
2084
|
+
var now = new Date().getTime();
|
2085
|
+
if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) {
|
2086
|
+
self.env.lastUpdate = now;
|
2087
|
+
self.env.setTimeout(function() {
|
2088
|
+
self.next_();
|
2089
|
+
}, 0);
|
2090
|
+
} else {
|
2091
|
+
if (jasmine.Queue.LOOP_DONT_RECURSE && completedSynchronously) {
|
2092
|
+
goAgain = true;
|
2093
|
+
} else {
|
2094
|
+
self.next_();
|
2095
|
+
}
|
2096
|
+
}
|
2097
|
+
};
|
2098
|
+
self.blocks[self.index].execute(onComplete);
|
2099
|
+
|
2100
|
+
calledSynchronously = false;
|
2101
|
+
if (completedSynchronously) {
|
2102
|
+
onComplete();
|
2103
|
+
}
|
2104
|
+
|
2105
|
+
} else {
|
2106
|
+
self.running = false;
|
2107
|
+
if (self.onComplete) {
|
2108
|
+
self.onComplete();
|
2109
|
+
}
|
2110
|
+
}
|
2111
|
+
}
|
2112
|
+
};
|
2113
|
+
|
2114
|
+
jasmine.Queue.prototype.results = function() {
|
2115
|
+
var results = new jasmine.NestedResults();
|
2116
|
+
for (var i = 0; i < this.blocks.length; i++) {
|
2117
|
+
if (this.blocks[i].results) {
|
2118
|
+
results.addResult(this.blocks[i].results());
|
2119
|
+
}
|
2120
|
+
}
|
2121
|
+
return results;
|
2122
|
+
};
|
2123
|
+
|
2124
|
+
|
2125
|
+
/**
|
2126
|
+
* Runner
|
2127
|
+
*
|
2128
|
+
* @constructor
|
2129
|
+
* @param {jasmine.Env} env
|
2130
|
+
*/
|
2131
|
+
jasmine.Runner = function(env) {
|
2132
|
+
var self = this;
|
2133
|
+
self.env = env;
|
2134
|
+
self.queue = new jasmine.Queue(env);
|
2135
|
+
self.before_ = [];
|
2136
|
+
self.after_ = [];
|
2137
|
+
self.suites_ = [];
|
2138
|
+
};
|
2139
|
+
|
2140
|
+
jasmine.Runner.prototype.execute = function() {
|
2141
|
+
var self = this;
|
2142
|
+
if (self.env.reporter.reportRunnerStarting) {
|
2143
|
+
self.env.reporter.reportRunnerStarting(this);
|
2144
|
+
}
|
2145
|
+
self.queue.start(function () {
|
2146
|
+
self.finishCallback();
|
2147
|
+
});
|
2148
|
+
};
|
2149
|
+
|
2150
|
+
jasmine.Runner.prototype.beforeEach = function(beforeEachFunction) {
|
2151
|
+
beforeEachFunction.typeName = 'beforeEach';
|
2152
|
+
this.before_.splice(0,0,beforeEachFunction);
|
2153
|
+
};
|
2154
|
+
|
2155
|
+
jasmine.Runner.prototype.afterEach = function(afterEachFunction) {
|
2156
|
+
afterEachFunction.typeName = 'afterEach';
|
2157
|
+
this.after_.splice(0,0,afterEachFunction);
|
2158
|
+
};
|
2159
|
+
|
2160
|
+
|
2161
|
+
jasmine.Runner.prototype.finishCallback = function() {
|
2162
|
+
this.env.reporter.reportRunnerResults(this);
|
2163
|
+
};
|
2164
|
+
|
2165
|
+
jasmine.Runner.prototype.addSuite = function(suite) {
|
2166
|
+
this.suites_.push(suite);
|
2167
|
+
};
|
2168
|
+
|
2169
|
+
jasmine.Runner.prototype.add = function(block) {
|
2170
|
+
if (block instanceof jasmine.Suite) {
|
2171
|
+
this.addSuite(block);
|
2172
|
+
}
|
2173
|
+
this.queue.add(block);
|
2174
|
+
};
|
2175
|
+
|
2176
|
+
jasmine.Runner.prototype.specs = function () {
|
2177
|
+
var suites = this.suites();
|
2178
|
+
var specs = [];
|
2179
|
+
for (var i = 0; i < suites.length; i++) {
|
2180
|
+
specs = specs.concat(suites[i].specs());
|
2181
|
+
}
|
2182
|
+
return specs;
|
2183
|
+
};
|
2184
|
+
|
2185
|
+
jasmine.Runner.prototype.suites = function() {
|
2186
|
+
return this.suites_;
|
2187
|
+
};
|
2188
|
+
|
2189
|
+
jasmine.Runner.prototype.topLevelSuites = function() {
|
2190
|
+
var topLevelSuites = [];
|
2191
|
+
for (var i = 0; i < this.suites_.length; i++) {
|
2192
|
+
if (!this.suites_[i].parentSuite) {
|
2193
|
+
topLevelSuites.push(this.suites_[i]);
|
2194
|
+
}
|
2195
|
+
}
|
2196
|
+
return topLevelSuites;
|
2197
|
+
};
|
2198
|
+
|
2199
|
+
jasmine.Runner.prototype.results = function() {
|
2200
|
+
return this.queue.results();
|
2201
|
+
};
|
2202
|
+
/**
|
2203
|
+
* Internal representation of a Jasmine specification, or test.
|
2204
|
+
*
|
2205
|
+
* @constructor
|
2206
|
+
* @param {jasmine.Env} env
|
2207
|
+
* @param {jasmine.Suite} suite
|
2208
|
+
* @param {String} description
|
2209
|
+
*/
|
2210
|
+
jasmine.Spec = function(env, suite, description) {
|
2211
|
+
if (!env) {
|
2212
|
+
throw new Error('jasmine.Env() required');
|
2213
|
+
}
|
2214
|
+
if (!suite) {
|
2215
|
+
throw new Error('jasmine.Suite() required');
|
2216
|
+
}
|
2217
|
+
var spec = this;
|
2218
|
+
spec.id = env.nextSpecId ? env.nextSpecId() : null;
|
2219
|
+
spec.env = env;
|
2220
|
+
spec.suite = suite;
|
2221
|
+
spec.description = description;
|
2222
|
+
spec.queue = new jasmine.Queue(env);
|
2223
|
+
|
2224
|
+
spec.afterCallbacks = [];
|
2225
|
+
spec.spies_ = [];
|
2226
|
+
|
2227
|
+
spec.results_ = new jasmine.NestedResults();
|
2228
|
+
spec.results_.description = description;
|
2229
|
+
spec.matchersClass = null;
|
2230
|
+
};
|
2231
|
+
|
2232
|
+
jasmine.Spec.prototype.getFullName = function() {
|
2233
|
+
return this.suite.getFullName() + ' ' + this.description + '.';
|
2234
|
+
};
|
2235
|
+
|
2236
|
+
|
2237
|
+
jasmine.Spec.prototype.results = function() {
|
2238
|
+
return this.results_;
|
2239
|
+
};
|
2240
|
+
|
2241
|
+
/**
|
2242
|
+
* All parameters are pretty-printed and concatenated together, then written to the spec's output.
|
2243
|
+
*
|
2244
|
+
* Be careful not to leave calls to <code>jasmine.log</code> in production code.
|
2245
|
+
*/
|
2246
|
+
jasmine.Spec.prototype.log = function() {
|
2247
|
+
return this.results_.log(arguments);
|
2248
|
+
};
|
2249
|
+
|
2250
|
+
jasmine.Spec.prototype.runs = function (func) {
|
2251
|
+
var block = new jasmine.Block(this.env, func, this);
|
2252
|
+
this.addToQueue(block);
|
2253
|
+
return this;
|
2254
|
+
};
|
2255
|
+
|
2256
|
+
jasmine.Spec.prototype.addToQueue = function (block) {
|
2257
|
+
if (this.queue.isRunning()) {
|
2258
|
+
this.queue.insertNext(block);
|
2259
|
+
} else {
|
2260
|
+
this.queue.add(block);
|
2261
|
+
}
|
2262
|
+
};
|
2263
|
+
|
2264
|
+
/**
|
2265
|
+
* @param {jasmine.ExpectationResult} result
|
2266
|
+
*/
|
2267
|
+
jasmine.Spec.prototype.addMatcherResult = function(result) {
|
2268
|
+
this.results_.addResult(result);
|
2269
|
+
};
|
2270
|
+
|
2271
|
+
jasmine.Spec.prototype.expect = function(actual) {
|
2272
|
+
var positive = new (this.getMatchersClass_())(this.env, actual, this);
|
2273
|
+
positive.not = new (this.getMatchersClass_())(this.env, actual, this, true);
|
2274
|
+
return positive;
|
2275
|
+
};
|
2276
|
+
|
2277
|
+
/**
|
2278
|
+
* Waits a fixed time period before moving to the next block.
|
2279
|
+
*
|
2280
|
+
* @deprecated Use waitsFor() instead
|
2281
|
+
* @param {Number} timeout milliseconds to wait
|
2282
|
+
*/
|
2283
|
+
jasmine.Spec.prototype.waits = function(timeout) {
|
2284
|
+
var waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this);
|
2285
|
+
this.addToQueue(waitsFunc);
|
2286
|
+
return this;
|
2287
|
+
};
|
2288
|
+
|
2289
|
+
/**
|
2290
|
+
* Waits for the latchFunction to return true before proceeding to the next block.
|
2291
|
+
*
|
2292
|
+
* @param {Function} latchFunction
|
2293
|
+
* @param {String} optional_timeoutMessage
|
2294
|
+
* @param {Number} optional_timeout
|
2295
|
+
*/
|
2296
|
+
jasmine.Spec.prototype.waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) {
|
2297
|
+
var latchFunction_ = null;
|
2298
|
+
var optional_timeoutMessage_ = null;
|
2299
|
+
var optional_timeout_ = null;
|
2300
|
+
|
2301
|
+
for (var i = 0; i < arguments.length; i++) {
|
2302
|
+
var arg = arguments[i];
|
2303
|
+
switch (typeof arg) {
|
2304
|
+
case 'function':
|
2305
|
+
latchFunction_ = arg;
|
2306
|
+
break;
|
2307
|
+
case 'string':
|
2308
|
+
optional_timeoutMessage_ = arg;
|
2309
|
+
break;
|
2310
|
+
case 'number':
|
2311
|
+
optional_timeout_ = arg;
|
2312
|
+
break;
|
2313
|
+
}
|
2314
|
+
}
|
2315
|
+
|
2316
|
+
var waitsForFunc = new jasmine.WaitsForBlock(this.env, optional_timeout_, latchFunction_, optional_timeoutMessage_, this);
|
2317
|
+
this.addToQueue(waitsForFunc);
|
2318
|
+
return this;
|
2319
|
+
};
|
2320
|
+
|
2321
|
+
jasmine.Spec.prototype.fail = function (e) {
|
2322
|
+
var expectationResult = new jasmine.ExpectationResult({
|
2323
|
+
passed: false,
|
2324
|
+
message: e ? jasmine.util.formatException(e) : 'Exception',
|
2325
|
+
trace: { stack: e.stack }
|
2326
|
+
});
|
2327
|
+
this.results_.addResult(expectationResult);
|
2328
|
+
};
|
2329
|
+
|
2330
|
+
jasmine.Spec.prototype.getMatchersClass_ = function() {
|
2331
|
+
return this.matchersClass || this.env.matchersClass;
|
2332
|
+
};
|
2333
|
+
|
2334
|
+
jasmine.Spec.prototype.addMatchers = function(matchersPrototype) {
|
2335
|
+
var parent = this.getMatchersClass_();
|
2336
|
+
var newMatchersClass = function() {
|
2337
|
+
parent.apply(this, arguments);
|
2338
|
+
};
|
2339
|
+
jasmine.util.inherit(newMatchersClass, parent);
|
2340
|
+
jasmine.Matchers.wrapInto_(matchersPrototype, newMatchersClass);
|
2341
|
+
this.matchersClass = newMatchersClass;
|
2342
|
+
};
|
2343
|
+
|
2344
|
+
jasmine.Spec.prototype.finishCallback = function() {
|
2345
|
+
this.env.reporter.reportSpecResults(this);
|
2346
|
+
};
|
2347
|
+
|
2348
|
+
jasmine.Spec.prototype.finish = function(onComplete) {
|
2349
|
+
this.removeAllSpies();
|
2350
|
+
this.finishCallback();
|
2351
|
+
if (onComplete) {
|
2352
|
+
onComplete();
|
2353
|
+
}
|
2354
|
+
};
|
2355
|
+
|
2356
|
+
jasmine.Spec.prototype.after = function(doAfter) {
|
2357
|
+
if (this.queue.isRunning()) {
|
2358
|
+
this.queue.add(new jasmine.Block(this.env, doAfter, this), true);
|
2359
|
+
} else {
|
2360
|
+
this.afterCallbacks.unshift(doAfter);
|
2361
|
+
}
|
2362
|
+
};
|
2363
|
+
|
2364
|
+
jasmine.Spec.prototype.execute = function(onComplete) {
|
2365
|
+
var spec = this;
|
2366
|
+
if (!spec.env.specFilter(spec)) {
|
2367
|
+
spec.results_.skipped = true;
|
2368
|
+
spec.finish(onComplete);
|
2369
|
+
return;
|
2370
|
+
}
|
2371
|
+
|
2372
|
+
this.env.reporter.reportSpecStarting(this);
|
2373
|
+
|
2374
|
+
spec.env.currentSpec = spec;
|
2375
|
+
|
2376
|
+
spec.addBeforesAndAftersToQueue();
|
2377
|
+
|
2378
|
+
spec.queue.start(function () {
|
2379
|
+
spec.finish(onComplete);
|
2380
|
+
});
|
2381
|
+
};
|
2382
|
+
|
2383
|
+
jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() {
|
2384
|
+
var runner = this.env.currentRunner();
|
2385
|
+
var i;
|
2386
|
+
|
2387
|
+
for (var suite = this.suite; suite; suite = suite.parentSuite) {
|
2388
|
+
for (i = 0; i < suite.before_.length; i++) {
|
2389
|
+
this.queue.addBefore(new jasmine.Block(this.env, suite.before_[i], this));
|
2390
|
+
}
|
2391
|
+
}
|
2392
|
+
for (i = 0; i < runner.before_.length; i++) {
|
2393
|
+
this.queue.addBefore(new jasmine.Block(this.env, runner.before_[i], this));
|
2394
|
+
}
|
2395
|
+
for (i = 0; i < this.afterCallbacks.length; i++) {
|
2396
|
+
this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this), true);
|
2397
|
+
}
|
2398
|
+
for (suite = this.suite; suite; suite = suite.parentSuite) {
|
2399
|
+
for (i = 0; i < suite.after_.length; i++) {
|
2400
|
+
this.queue.add(new jasmine.Block(this.env, suite.after_[i], this), true);
|
2401
|
+
}
|
2402
|
+
}
|
2403
|
+
for (i = 0; i < runner.after_.length; i++) {
|
2404
|
+
this.queue.add(new jasmine.Block(this.env, runner.after_[i], this), true);
|
2405
|
+
}
|
2406
|
+
};
|
2407
|
+
|
2408
|
+
jasmine.Spec.prototype.explodes = function() {
|
2409
|
+
throw 'explodes function should not have been called';
|
2410
|
+
};
|
2411
|
+
|
2412
|
+
jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist) {
|
2413
|
+
if (obj == jasmine.undefined) {
|
2414
|
+
throw "spyOn could not find an object to spy upon for " + methodName + "()";
|
2415
|
+
}
|
2416
|
+
|
2417
|
+
if (!ignoreMethodDoesntExist && obj[methodName] === jasmine.undefined) {
|
2418
|
+
throw methodName + '() method does not exist';
|
2419
|
+
}
|
2420
|
+
|
2421
|
+
if (!ignoreMethodDoesntExist && obj[methodName] && obj[methodName].isSpy) {
|
2422
|
+
throw new Error(methodName + ' has already been spied upon');
|
2423
|
+
}
|
2424
|
+
|
2425
|
+
var spyObj = jasmine.createSpy(methodName);
|
2426
|
+
|
2427
|
+
this.spies_.push(spyObj);
|
2428
|
+
spyObj.baseObj = obj;
|
2429
|
+
spyObj.methodName = methodName;
|
2430
|
+
spyObj.originalValue = obj[methodName];
|
2431
|
+
|
2432
|
+
obj[methodName] = spyObj;
|
2433
|
+
|
2434
|
+
return spyObj;
|
2435
|
+
};
|
2436
|
+
|
2437
|
+
jasmine.Spec.prototype.removeAllSpies = function() {
|
2438
|
+
for (var i = 0; i < this.spies_.length; i++) {
|
2439
|
+
var spy = this.spies_[i];
|
2440
|
+
spy.baseObj[spy.methodName] = spy.originalValue;
|
2441
|
+
}
|
2442
|
+
this.spies_ = [];
|
2443
|
+
};
|
2444
|
+
|
2445
|
+
/**
|
2446
|
+
* Internal representation of a Jasmine suite.
|
2447
|
+
*
|
2448
|
+
* @constructor
|
2449
|
+
* @param {jasmine.Env} env
|
2450
|
+
* @param {String} description
|
2451
|
+
* @param {Function} specDefinitions
|
2452
|
+
* @param {jasmine.Suite} parentSuite
|
2453
|
+
*/
|
2454
|
+
jasmine.Suite = function(env, description, specDefinitions, parentSuite) {
|
2455
|
+
var self = this;
|
2456
|
+
self.id = env.nextSuiteId ? env.nextSuiteId() : null;
|
2457
|
+
self.description = description;
|
2458
|
+
self.queue = new jasmine.Queue(env);
|
2459
|
+
self.parentSuite = parentSuite;
|
2460
|
+
self.env = env;
|
2461
|
+
self.before_ = [];
|
2462
|
+
self.after_ = [];
|
2463
|
+
self.children_ = [];
|
2464
|
+
self.suites_ = [];
|
2465
|
+
self.specs_ = [];
|
2466
|
+
};
|
2467
|
+
|
2468
|
+
jasmine.Suite.prototype.getFullName = function() {
|
2469
|
+
var fullName = this.description;
|
2470
|
+
for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) {
|
2471
|
+
fullName = parentSuite.description + ' ' + fullName;
|
2472
|
+
}
|
2473
|
+
return fullName;
|
2474
|
+
};
|
2475
|
+
|
2476
|
+
jasmine.Suite.prototype.finish = function(onComplete) {
|
2477
|
+
this.env.reporter.reportSuiteResults(this);
|
2478
|
+
this.finished = true;
|
2479
|
+
if (typeof(onComplete) == 'function') {
|
2480
|
+
onComplete();
|
2481
|
+
}
|
2482
|
+
};
|
2483
|
+
|
2484
|
+
jasmine.Suite.prototype.beforeEach = function(beforeEachFunction) {
|
2485
|
+
beforeEachFunction.typeName = 'beforeEach';
|
2486
|
+
this.before_.unshift(beforeEachFunction);
|
2487
|
+
};
|
2488
|
+
|
2489
|
+
jasmine.Suite.prototype.afterEach = function(afterEachFunction) {
|
2490
|
+
afterEachFunction.typeName = 'afterEach';
|
2491
|
+
this.after_.unshift(afterEachFunction);
|
2492
|
+
};
|
2493
|
+
|
2494
|
+
jasmine.Suite.prototype.results = function() {
|
2495
|
+
return this.queue.results();
|
2496
|
+
};
|
2497
|
+
|
2498
|
+
jasmine.Suite.prototype.add = function(suiteOrSpec) {
|
2499
|
+
this.children_.push(suiteOrSpec);
|
2500
|
+
if (suiteOrSpec instanceof jasmine.Suite) {
|
2501
|
+
this.suites_.push(suiteOrSpec);
|
2502
|
+
this.env.currentRunner().addSuite(suiteOrSpec);
|
2503
|
+
} else {
|
2504
|
+
this.specs_.push(suiteOrSpec);
|
2505
|
+
}
|
2506
|
+
this.queue.add(suiteOrSpec);
|
2507
|
+
};
|
2508
|
+
|
2509
|
+
jasmine.Suite.prototype.specs = function() {
|
2510
|
+
return this.specs_;
|
2511
|
+
};
|
2512
|
+
|
2513
|
+
jasmine.Suite.prototype.suites = function() {
|
2514
|
+
return this.suites_;
|
2515
|
+
};
|
2516
|
+
|
2517
|
+
jasmine.Suite.prototype.children = function() {
|
2518
|
+
return this.children_;
|
2519
|
+
};
|
2520
|
+
|
2521
|
+
jasmine.Suite.prototype.execute = function(onComplete) {
|
2522
|
+
var self = this;
|
2523
|
+
this.queue.start(function () {
|
2524
|
+
self.finish(onComplete);
|
2525
|
+
});
|
2526
|
+
};
|
2527
|
+
jasmine.WaitsBlock = function(env, timeout, spec) {
|
2528
|
+
this.timeout = timeout;
|
2529
|
+
jasmine.Block.call(this, env, null, spec);
|
2530
|
+
};
|
2531
|
+
|
2532
|
+
jasmine.util.inherit(jasmine.WaitsBlock, jasmine.Block);
|
2533
|
+
|
2534
|
+
jasmine.WaitsBlock.prototype.execute = function (onComplete) {
|
2535
|
+
if (jasmine.VERBOSE) {
|
2536
|
+
this.env.reporter.log('>> Jasmine waiting for ' + this.timeout + ' ms...');
|
2537
|
+
}
|
2538
|
+
this.env.setTimeout(function () {
|
2539
|
+
onComplete();
|
2540
|
+
}, this.timeout);
|
2541
|
+
};
|
2542
|
+
/**
|
2543
|
+
* A block which waits for some condition to become true, with timeout.
|
2544
|
+
*
|
2545
|
+
* @constructor
|
2546
|
+
* @extends jasmine.Block
|
2547
|
+
* @param {jasmine.Env} env The Jasmine environment.
|
2548
|
+
* @param {Number} timeout The maximum time in milliseconds to wait for the condition to become true.
|
2549
|
+
* @param {Function} latchFunction A function which returns true when the desired condition has been met.
|
2550
|
+
* @param {String} message The message to display if the desired condition hasn't been met within the given time period.
|
2551
|
+
* @param {jasmine.Spec} spec The Jasmine spec.
|
2552
|
+
*/
|
2553
|
+
jasmine.WaitsForBlock = function(env, timeout, latchFunction, message, spec) {
|
2554
|
+
this.timeout = timeout || env.defaultTimeoutInterval;
|
2555
|
+
this.latchFunction = latchFunction;
|
2556
|
+
this.message = message;
|
2557
|
+
this.totalTimeSpentWaitingForLatch = 0;
|
2558
|
+
jasmine.Block.call(this, env, null, spec);
|
2559
|
+
};
|
2560
|
+
jasmine.util.inherit(jasmine.WaitsForBlock, jasmine.Block);
|
2561
|
+
|
2562
|
+
jasmine.WaitsForBlock.TIMEOUT_INCREMENT = 10;
|
2563
|
+
|
2564
|
+
jasmine.WaitsForBlock.prototype.execute = function(onComplete) {
|
2565
|
+
if (jasmine.VERBOSE) {
|
2566
|
+
this.env.reporter.log('>> Jasmine waiting for ' + (this.message || 'something to happen'));
|
2567
|
+
}
|
2568
|
+
var latchFunctionResult;
|
2569
|
+
try {
|
2570
|
+
latchFunctionResult = this.latchFunction.apply(this.spec);
|
2571
|
+
} catch (e) {
|
2572
|
+
this.spec.fail(e);
|
2573
|
+
onComplete();
|
2574
|
+
return;
|
2575
|
+
}
|
2576
|
+
|
2577
|
+
if (latchFunctionResult) {
|
2578
|
+
onComplete();
|
2579
|
+
} else if (this.totalTimeSpentWaitingForLatch >= this.timeout) {
|
2580
|
+
var message = 'timed out after ' + this.timeout + ' msec waiting for ' + (this.message || 'something to happen');
|
2581
|
+
this.spec.fail({
|
2582
|
+
name: 'timeout',
|
2583
|
+
message: message
|
2584
|
+
});
|
2585
|
+
|
2586
|
+
this.abort = true;
|
2587
|
+
onComplete();
|
2588
|
+
} else {
|
2589
|
+
this.totalTimeSpentWaitingForLatch += jasmine.WaitsForBlock.TIMEOUT_INCREMENT;
|
2590
|
+
var self = this;
|
2591
|
+
this.env.setTimeout(function() {
|
2592
|
+
self.execute(onComplete);
|
2593
|
+
}, jasmine.WaitsForBlock.TIMEOUT_INCREMENT);
|
2594
|
+
}
|
2595
|
+
};
|
2596
|
+
|
2597
|
+
jasmine.version_= {
|
2598
|
+
"major": 1,
|
2599
|
+
"minor": 3,
|
2600
|
+
"build": 0,
|
2601
|
+
"revision": 1354052693
|
2602
|
+
};
|
2603
|
+
(function() {
|
2604
|
+
|
2605
|
+
this.Teabag = (function() {
|
2606
|
+
|
2607
|
+
function Teabag() {}
|
2608
|
+
|
2609
|
+
Teabag.defer = false;
|
2610
|
+
|
2611
|
+
Teabag.slow = 75;
|
2612
|
+
|
2613
|
+
Teabag.fixturePath = null;
|
2614
|
+
|
2615
|
+
Teabag.finished = false;
|
2616
|
+
|
2617
|
+
Teabag.Reporters = {};
|
2618
|
+
|
2619
|
+
Teabag.Date = Date;
|
2620
|
+
|
2621
|
+
Teabag.location = window.location;
|
2622
|
+
|
2623
|
+
Teabag.execute = function() {
|
2624
|
+
if (this.defer) {
|
2625
|
+
this.defer = false;
|
2626
|
+
return;
|
2627
|
+
}
|
2628
|
+
return new Teabag.Runner();
|
2629
|
+
};
|
2630
|
+
|
2631
|
+
return Teabag;
|
2632
|
+
|
2633
|
+
})();
|
2634
|
+
|
2635
|
+
}).call(this);
|
2636
|
+
(function() {
|
2637
|
+
|
2638
|
+
Teabag.Runner = (function() {
|
2639
|
+
|
2640
|
+
Runner.run = false;
|
2641
|
+
|
2642
|
+
function Runner() {
|
2643
|
+
if (this.constructor.run) {
|
2644
|
+
return;
|
2645
|
+
}
|
2646
|
+
this.constructor.run = true;
|
2647
|
+
this.fixturePath = Teabag.fixturePath;
|
2648
|
+
this.params = this.getParams();
|
2649
|
+
this.setup();
|
2650
|
+
}
|
2651
|
+
|
2652
|
+
Runner.prototype.getParams = function() {
|
2653
|
+
var name, param, params, value, _i, _len, _ref, _ref1;
|
2654
|
+
params = {};
|
2655
|
+
_ref = Teabag.location.search.substring(1).split("&");
|
2656
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
2657
|
+
param = _ref[_i];
|
2658
|
+
_ref1 = param.split("="), name = _ref1[0], value = _ref1[1];
|
2659
|
+
params[decodeURIComponent(name)] = decodeURIComponent(value);
|
2660
|
+
}
|
2661
|
+
return params;
|
2662
|
+
};
|
2663
|
+
|
2664
|
+
Runner.prototype.setup = function() {};
|
2665
|
+
|
2666
|
+
return Runner;
|
2667
|
+
|
2668
|
+
})();
|
2669
|
+
|
2670
|
+
}).call(this);
|
2671
|
+
(function() {
|
2672
|
+
|
2673
|
+
Teabag.Reporters.NormalizedSpec = (function() {
|
2674
|
+
|
2675
|
+
function NormalizedSpec(spec) {
|
2676
|
+
var _base, _base1;
|
2677
|
+
this.spec = spec;
|
2678
|
+
this.fullDescription = (typeof (_base = this.spec).getFullName === "function" ? _base.getFullName() : void 0) || this.spec.fullTitle();
|
2679
|
+
this.description || (this.description = this.spec.description || this.spec.title);
|
2680
|
+
this.link = "?grep=" + (encodeURIComponent(this.fullDescription));
|
2681
|
+
this.parent = this.spec.suite || this.spec.parent;
|
2682
|
+
this.suiteName = (typeof (_base1 = this.parent).getFullName === "function" ? _base1.getFullName() : void 0) || this.parent.fullTitle();
|
2683
|
+
this.viewId = this.spec.viewId;
|
2684
|
+
this.pending = this.spec.pending;
|
2685
|
+
}
|
2686
|
+
|
2687
|
+
NormalizedSpec.prototype.errors = function() {
|
2688
|
+
var item, _i, _len, _ref, _results;
|
2689
|
+
if (this.spec.err) {
|
2690
|
+
return [this.spec.err];
|
2691
|
+
}
|
2692
|
+
if (!this.spec.results) {
|
2693
|
+
return [];
|
2694
|
+
}
|
2695
|
+
_ref = this.spec.results().getItems();
|
2696
|
+
_results = [];
|
2697
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
2698
|
+
item = _ref[_i];
|
2699
|
+
if (item.passed()) {
|
2700
|
+
continue;
|
2701
|
+
}
|
2702
|
+
_results.push({
|
2703
|
+
message: item.message,
|
2704
|
+
stack: item.trace.stack
|
2705
|
+
});
|
2706
|
+
}
|
2707
|
+
return _results;
|
2708
|
+
};
|
2709
|
+
|
2710
|
+
NormalizedSpec.prototype.result = function() {
|
2711
|
+
var results, skipped, status;
|
2712
|
+
status = "failed";
|
2713
|
+
if (this.spec.results) {
|
2714
|
+
results = this.spec.results();
|
2715
|
+
if (results.passed()) {
|
2716
|
+
status = "passed";
|
2717
|
+
}
|
2718
|
+
skipped = results.skipped;
|
2719
|
+
} else {
|
2720
|
+
if (this.spec.state === "passed" || this.spec.state === "skipped") {
|
2721
|
+
status = "passed";
|
2722
|
+
}
|
2723
|
+
skipped = this.spec.state === "skipped";
|
2724
|
+
}
|
2725
|
+
if (this.spec.pending) {
|
2726
|
+
status = "pending";
|
2727
|
+
}
|
2728
|
+
return {
|
2729
|
+
status: status,
|
2730
|
+
skipped: skipped
|
2731
|
+
};
|
2732
|
+
};
|
2733
|
+
|
2734
|
+
return NormalizedSpec;
|
2735
|
+
|
2736
|
+
})();
|
2737
|
+
|
2738
|
+
Teabag.Reporters.NormalizedSuite = (function() {
|
2739
|
+
|
2740
|
+
function NormalizedSuite(suite) {
|
2741
|
+
var _base;
|
2742
|
+
this.suite = suite;
|
2743
|
+
this.fullDescription = (typeof (_base = this.suite).getFullName === "function" ? _base.getFullName() : void 0) || this.suite.fullTitle();
|
2744
|
+
this.description = this.suite.description || this.suite.title;
|
2745
|
+
this.link = "?grep=" + (encodeURIComponent(this.fullDescription));
|
2746
|
+
this.parent = this.getParent();
|
2747
|
+
this.viewId = this.suite.viewId;
|
2748
|
+
}
|
2749
|
+
|
2750
|
+
NormalizedSuite.prototype.getParent = function() {
|
2751
|
+
if (this.suite.parent) {
|
2752
|
+
if (this.suite.parent.root) {
|
2753
|
+
return null;
|
2754
|
+
} else {
|
2755
|
+
return this.suite.parent;
|
2756
|
+
}
|
2757
|
+
} else {
|
2758
|
+
return this.suite.parentSuite;
|
2759
|
+
}
|
2760
|
+
};
|
2761
|
+
|
2762
|
+
return NormalizedSuite;
|
2763
|
+
|
2764
|
+
})();
|
2765
|
+
|
2766
|
+
Teabag.Reporters.BaseView = (function() {
|
2767
|
+
|
2768
|
+
function BaseView() {
|
2769
|
+
this.elements = {};
|
2770
|
+
this.build();
|
2771
|
+
}
|
2772
|
+
|
2773
|
+
BaseView.prototype.build = function(className) {
|
2774
|
+
return this.el = this.createEl("li", className);
|
2775
|
+
};
|
2776
|
+
|
2777
|
+
BaseView.prototype.appendTo = function(el) {
|
2778
|
+
return el.appendChild(this.el);
|
2779
|
+
};
|
2780
|
+
|
2781
|
+
BaseView.prototype.append = function(el) {
|
2782
|
+
return this.el.appendChild(el);
|
2783
|
+
};
|
2784
|
+
|
2785
|
+
BaseView.prototype.createEl = function(type, className) {
|
2786
|
+
var el;
|
2787
|
+
if (className == null) {
|
2788
|
+
className = "";
|
2789
|
+
}
|
2790
|
+
el = document.createElement(type);
|
2791
|
+
el.className = className;
|
2792
|
+
return el;
|
2793
|
+
};
|
2794
|
+
|
2795
|
+
BaseView.prototype.findEl = function(id) {
|
2796
|
+
var _base;
|
2797
|
+
this.elements || (this.elements = {});
|
2798
|
+
return (_base = this.elements)[id] || (_base[id] = document.getElementById("teabag-" + id));
|
2799
|
+
};
|
2800
|
+
|
2801
|
+
BaseView.prototype.setText = function(id, value) {
|
2802
|
+
var el;
|
2803
|
+
el = this.findEl(id);
|
2804
|
+
return el.innerText = value;
|
2805
|
+
};
|
2806
|
+
|
2807
|
+
BaseView.prototype.setHtml = function(id, value, add) {
|
2808
|
+
var el;
|
2809
|
+
if (add == null) {
|
2810
|
+
add = false;
|
2811
|
+
}
|
2812
|
+
el = this.findEl(id);
|
2813
|
+
if (add) {
|
2814
|
+
return el.innerHTML += value;
|
2815
|
+
} else {
|
2816
|
+
return el.innerHTML = value;
|
2817
|
+
}
|
2818
|
+
};
|
2819
|
+
|
2820
|
+
BaseView.prototype.setClass = function(id, value) {
|
2821
|
+
var el;
|
2822
|
+
el = this.findEl(id);
|
2823
|
+
return el.className = value;
|
2824
|
+
};
|
2825
|
+
|
2826
|
+
BaseView.prototype.htmlSafe = function(str) {
|
2827
|
+
var el;
|
2828
|
+
el = document.createElement("div");
|
2829
|
+
el.appendChild(document.createTextNode(str));
|
2830
|
+
return el.innerHTML;
|
2831
|
+
};
|
2832
|
+
|
2833
|
+
return BaseView;
|
2834
|
+
|
2835
|
+
})();
|
2836
|
+
|
2837
|
+
}).call(this);
|
2838
|
+
(function() {
|
2839
|
+
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
2840
|
+
|
2841
|
+
Teabag.Reporters.Console = (function() {
|
2842
|
+
|
2843
|
+
function Console() {
|
2844
|
+
this.reportRunnerResults = __bind(this.reportRunnerResults, this);
|
2845
|
+
this.start = new Teabag.Date().getTime();
|
2846
|
+
}
|
2847
|
+
|
2848
|
+
Console.prototype.reportSpecResults = function(spec) {
|
2849
|
+
var result;
|
2850
|
+
this.spec = new Teabag.Reporters.NormalizedSpec(spec);
|
2851
|
+
result = this.spec.result();
|
2852
|
+
switch (result.status) {
|
2853
|
+
case "pending":
|
2854
|
+
return this.trackPending();
|
2855
|
+
case "failed":
|
2856
|
+
return this.trackFailure();
|
2857
|
+
default:
|
2858
|
+
return this.log({
|
2859
|
+
type: "spec",
|
2860
|
+
suite: this.spec.suiteName,
|
2861
|
+
spec: this.spec.description,
|
2862
|
+
status: result.status,
|
2863
|
+
skipped: result.skipped,
|
2864
|
+
full_description: this.spec.fullDescription
|
2865
|
+
});
|
2866
|
+
}
|
2867
|
+
};
|
2868
|
+
|
2869
|
+
Console.prototype.trackPending = function() {
|
2870
|
+
var result;
|
2871
|
+
result = this.spec.result();
|
2872
|
+
return this.log({
|
2873
|
+
type: "spec",
|
2874
|
+
suite: this.spec.suiteName,
|
2875
|
+
spec: this.spec.description,
|
2876
|
+
status: result.status,
|
2877
|
+
skipped: result.skipped,
|
2878
|
+
full_description: this.spec.fullDescription
|
2879
|
+
});
|
2880
|
+
};
|
2881
|
+
|
2882
|
+
Console.prototype.trackFailure = function() {
|
2883
|
+
var error, result, _i, _len, _ref, _results;
|
2884
|
+
result = this.spec.result();
|
2885
|
+
_ref = this.spec.errors();
|
2886
|
+
_results = [];
|
2887
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
2888
|
+
error = _ref[_i];
|
2889
|
+
_results.push(this.log({
|
2890
|
+
type: "spec",
|
2891
|
+
suite: this.spec.suiteName,
|
2892
|
+
spec: this.spec.description,
|
2893
|
+
status: result.status,
|
2894
|
+
skipped: result.skipped,
|
2895
|
+
full_description: this.spec.fullDescription,
|
2896
|
+
link: this.spec.link,
|
2897
|
+
message: error.message,
|
2898
|
+
trace: error.stack || error.message || "Stack Trace Unavailable"
|
2899
|
+
}));
|
2900
|
+
}
|
2901
|
+
return _results;
|
2902
|
+
};
|
2903
|
+
|
2904
|
+
Console.prototype.reportRunnerResults = function() {
|
2905
|
+
this.log({
|
2906
|
+
type: "results",
|
2907
|
+
elapsed: ((new Teabag.Date().getTime() - this.start) / 1000).toFixed(5)
|
2908
|
+
});
|
2909
|
+
return Teabag.finished = true;
|
2910
|
+
};
|
2911
|
+
|
2912
|
+
Console.prototype.log = function(obj) {
|
2913
|
+
if (obj == null) {
|
2914
|
+
obj = {};
|
2915
|
+
}
|
2916
|
+
obj["_teabag"] = true;
|
2917
|
+
return console.log(JSON.stringify(obj));
|
2918
|
+
};
|
2919
|
+
|
2920
|
+
return Console;
|
2921
|
+
|
2922
|
+
})();
|
2923
|
+
|
2924
|
+
}).call(this);
|
2925
|
+
(function() {
|
2926
|
+
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
2927
|
+
__hasProp = {}.hasOwnProperty,
|
2928
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
2929
|
+
|
2930
|
+
Teabag.Reporters.HTML = (function(_super) {
|
2931
|
+
|
2932
|
+
__extends(HTML, _super);
|
2933
|
+
|
2934
|
+
function HTML() {
|
2935
|
+
this.toggleConfig = __bind(this.toggleConfig, this);
|
2936
|
+
|
2937
|
+
this.reportRunnerResults = __bind(this.reportRunnerResults, this);
|
2938
|
+
this.start = new Teabag.Date().getTime();
|
2939
|
+
this.config = {
|
2940
|
+
"use-catch": true,
|
2941
|
+
"build-full-report": false,
|
2942
|
+
"display-progress": true
|
2943
|
+
};
|
2944
|
+
this.total = {
|
2945
|
+
exist: 0,
|
2946
|
+
run: 0,
|
2947
|
+
passes: 0,
|
2948
|
+
failures: 0,
|
2949
|
+
skipped: 0
|
2950
|
+
};
|
2951
|
+
this.views = {
|
2952
|
+
specs: {},
|
2953
|
+
suites: {}
|
2954
|
+
};
|
2955
|
+
this.filter = false;
|
2956
|
+
this.readConfig();
|
2957
|
+
HTML.__super__.constructor.apply(this, arguments);
|
2958
|
+
}
|
2959
|
+
|
2960
|
+
HTML.prototype.build = function() {
|
2961
|
+
this.buildLayout();
|
2962
|
+
this.el = this.findEl("report-all");
|
2963
|
+
this.setText("env-info", this.envInfo());
|
2964
|
+
this.setText("version", Teabag.version);
|
2965
|
+
this.findEl("toggles").onclick = this.toggleConfig;
|
2966
|
+
this.showConfiguration();
|
2967
|
+
return this.buildProgress();
|
2968
|
+
};
|
2969
|
+
|
2970
|
+
HTML.prototype.buildLayout = function() {
|
2971
|
+
var el;
|
2972
|
+
el = this.createEl("div");
|
2973
|
+
document.body.appendChild(el);
|
2974
|
+
return el.innerHTML = "<div class=\"teabag-clearfix\">\n <div id=\"teabag-title\">\n <h1>Teabag</h1>\n <ul>\n <li>version: <b id=\"teabag-version\"></b></li>\n <li id=\"teabag-env-info\"></li>\n </ul>\n </div>\n <div id=\"teabag-progress\"></div>\n <ul id=\"teabag-stats\">\n <li>passes: <b id=\"teabag-stats-passes\">0</b></li>\n <li>failures: <b id=\"teabag-stats-failures\">0</b></li>\n <li>skipped: <b id=\"teabag-stats-skipped\">0</b></li>\n <li>duration: <b id=\"teabag-stats-duration\">∞</b></li>\n </ul>\n</div>\n\n<div id=\"teabag-controls\" class=\"teabag-clearfix\">\n <div id=\"teabag-toggles\">\n <button id=\"teabag-use-catch\">Use Try/Catch</button>\n <button id=\"teabag-build-full-report\">Build Full Report</button>\n <button id=\"teabag-display-progress\">Display Progress</button>\n </div>\n <div id=\"teabag-filtered\">\n <button onclick=\"window.location.href = window.location.pathname\">Run All Specs</button>\n </div>\n</div>\n\n<hr/>\n\n<div id=\"teabag-report\">\n <ol id=\"teabag-report-failures\"></ol>\n <ol id=\"teabag-report-all\"></ol>\n</div>";
|
2975
|
+
};
|
2976
|
+
|
2977
|
+
HTML.prototype.buildProgress = function() {
|
2978
|
+
this.progress = Teabag.Reporters.HTML.ProgressView.create(this.config["display-progress"]);
|
2979
|
+
return this.progress.appendTo(this.findEl("progress"));
|
2980
|
+
};
|
2981
|
+
|
2982
|
+
HTML.prototype.reportRunnerStarting = function(runner) {
|
2983
|
+
this.total.exist = runner.total || runner.specs().length;
|
2984
|
+
if (this.total.exist) {
|
2985
|
+
return this.setText("stats-duration", "...");
|
2986
|
+
}
|
2987
|
+
};
|
2988
|
+
|
2989
|
+
HTML.prototype.reportSpecStarting = function(spec) {
|
2990
|
+
spec = new Teabag.Reporters.NormalizedSpec(spec);
|
2991
|
+
if (this.config["build-full-report"]) {
|
2992
|
+
this.reportView = new Teabag.Reporters.HTML.SpecView(spec, this);
|
2993
|
+
}
|
2994
|
+
return this.specStart = new Teabag.Date().getTime();
|
2995
|
+
};
|
2996
|
+
|
2997
|
+
HTML.prototype.reportSpecResults = function(spec) {
|
2998
|
+
this.total.run += 1;
|
2999
|
+
this.updateProgress();
|
3000
|
+
return this.updateStatus(spec);
|
3001
|
+
};
|
3002
|
+
|
3003
|
+
HTML.prototype.reportRunnerResults = function() {
|
3004
|
+
if (!this.total.run) {
|
3005
|
+
return;
|
3006
|
+
}
|
3007
|
+
this.setText("stats-duration", this.elapsedTime());
|
3008
|
+
if (!this.total.failures) {
|
3009
|
+
this.setStatus("passed");
|
3010
|
+
}
|
3011
|
+
this.setText("stats-passes", this.total.passes);
|
3012
|
+
this.setText("stats-failures", this.total.failures);
|
3013
|
+
if (this.total.run < this.total.exist) {
|
3014
|
+
this.total.skipped = this.total.exist - this.total.run;
|
3015
|
+
this.total.run = this.total.exist;
|
3016
|
+
}
|
3017
|
+
this.setText("stats-skipped", this.total.skipped);
|
3018
|
+
return this.updateProgress();
|
3019
|
+
};
|
3020
|
+
|
3021
|
+
HTML.prototype.elapsedTime = function() {
|
3022
|
+
return "" + (((new Teabag.Date().getTime() - this.start) / 1000).toFixed(3)) + "s";
|
3023
|
+
};
|
3024
|
+
|
3025
|
+
HTML.prototype.updateStat = function(name, value) {
|
3026
|
+
if (!this.config["display-progress"]) {
|
3027
|
+
return;
|
3028
|
+
}
|
3029
|
+
return this.setText("stats-" + name, value);
|
3030
|
+
};
|
3031
|
+
|
3032
|
+
HTML.prototype.updateStatus = function(spec) {
|
3033
|
+
var elapsed, result, _ref, _ref1;
|
3034
|
+
spec = new Teabag.Reporters.NormalizedSpec(spec);
|
3035
|
+
result = spec.result();
|
3036
|
+
if (result.skipped || result.status === "pending") {
|
3037
|
+
this.updateStat("skipped", this.total.skipped += 1);
|
3038
|
+
return;
|
3039
|
+
}
|
3040
|
+
elapsed = new Teabag.Date().getTime() - this.specStart;
|
3041
|
+
if (result.status === "passed") {
|
3042
|
+
this.updateStat("passes", this.total.passes += 1);
|
3043
|
+
return (_ref = this.reportView) != null ? _ref.updateState("passed", elapsed) : void 0;
|
3044
|
+
} else {
|
3045
|
+
this.updateStat("failures", this.total.failures += 1);
|
3046
|
+
if ((_ref1 = this.reportView) != null) {
|
3047
|
+
_ref1.updateState("failed", elapsed);
|
3048
|
+
}
|
3049
|
+
if (!this.config["build-full-report"]) {
|
3050
|
+
new Teabag.Reporters.HTML.FailureView(spec).appendTo(this.findEl("report-failures"));
|
3051
|
+
}
|
3052
|
+
return this.setStatus("failed");
|
3053
|
+
}
|
3054
|
+
};
|
3055
|
+
|
3056
|
+
HTML.prototype.updateProgress = function() {
|
3057
|
+
return this.progress.update(this.total.exist, this.total.run);
|
3058
|
+
};
|
3059
|
+
|
3060
|
+
HTML.prototype.showConfiguration = function() {
|
3061
|
+
var key, value, _ref, _results;
|
3062
|
+
_ref = this.config;
|
3063
|
+
_results = [];
|
3064
|
+
for (key in _ref) {
|
3065
|
+
value = _ref[key];
|
3066
|
+
_results.push(this.setClass(key, value ? "active" : ""));
|
3067
|
+
}
|
3068
|
+
return _results;
|
3069
|
+
};
|
3070
|
+
|
3071
|
+
HTML.prototype.setStatus = function(status) {
|
3072
|
+
return document.body.className = "teabag-" + status;
|
3073
|
+
};
|
3074
|
+
|
3075
|
+
HTML.prototype.setFilter = function(filter) {
|
3076
|
+
if (!filter) {
|
3077
|
+
return;
|
3078
|
+
}
|
3079
|
+
this.setClass("filtered", "teabag-filtered");
|
3080
|
+
return this.setHtml("filtered", "" + filter, true);
|
3081
|
+
};
|
3082
|
+
|
3083
|
+
HTML.prototype.readConfig = function() {
|
3084
|
+
var config;
|
3085
|
+
if (config = this.cookie("teabag")) {
|
3086
|
+
return this.config = config;
|
3087
|
+
}
|
3088
|
+
};
|
3089
|
+
|
3090
|
+
HTML.prototype.toggleConfig = function(e) {
|
3091
|
+
var button, name;
|
3092
|
+
button = e.target;
|
3093
|
+
if (button.tagName.toLowerCase() !== "button") {
|
3094
|
+
return;
|
3095
|
+
}
|
3096
|
+
name = button.getAttribute("id").replace(/^teabag-/, "");
|
3097
|
+
this.config[name] = !this.config[name];
|
3098
|
+
this.cookie("teabag", this.config);
|
3099
|
+
return this.refresh();
|
3100
|
+
};
|
3101
|
+
|
3102
|
+
HTML.prototype.refresh = function() {
|
3103
|
+
return window.location.href = window.location.href;
|
3104
|
+
};
|
3105
|
+
|
3106
|
+
HTML.prototype.cookie = function(name, value) {
|
3107
|
+
var date, match;
|
3108
|
+
if (value == null) {
|
3109
|
+
value = void 0;
|
3110
|
+
}
|
3111
|
+
if (value === void 0) {
|
3112
|
+
name = name.replace(/([.*+?^=!:${}()|[\]\/\\])/g, "\\$1");
|
3113
|
+
match = document.cookie.match(new RegExp("(?:^|;)\\s?" + name + "=(.*?)(?:;|$)", "i"));
|
3114
|
+
return match && JSON.parse(unescape(match[1]).split(" ")[0]);
|
3115
|
+
} else {
|
3116
|
+
date = new Teabag.Date();
|
3117
|
+
date.setDate(date.getDate() + 365);
|
3118
|
+
return document.cookie = "" + name + "=" + (escape(JSON.stringify(value))) + "; path=/; expires=" + (date.toUTCString()) + ";";
|
3119
|
+
}
|
3120
|
+
};
|
3121
|
+
|
3122
|
+
return HTML;
|
3123
|
+
|
3124
|
+
})(Teabag.Reporters.BaseView);
|
3125
|
+
|
3126
|
+
}).call(this);
|
3127
|
+
(function() {
|
3128
|
+
var __hasProp = {}.hasOwnProperty,
|
3129
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
3130
|
+
|
3131
|
+
Teabag.Reporters.HTML.ProgressView = (function(_super) {
|
3132
|
+
|
3133
|
+
__extends(ProgressView, _super);
|
3134
|
+
|
3135
|
+
function ProgressView() {
|
3136
|
+
return ProgressView.__super__.constructor.apply(this, arguments);
|
3137
|
+
}
|
3138
|
+
|
3139
|
+
ProgressView.create = function(displayProgress) {
|
3140
|
+
if (displayProgress == null) {
|
3141
|
+
displayProgress = true;
|
3142
|
+
}
|
3143
|
+
if (!displayProgress) {
|
3144
|
+
return new Teabag.Reporters.HTML.ProgressView();
|
3145
|
+
}
|
3146
|
+
if (Teabag.Reporters.HTML.RadialProgressView.supported) {
|
3147
|
+
return new Teabag.Reporters.HTML.RadialProgressView();
|
3148
|
+
} else {
|
3149
|
+
return Teabag.Reporters.HTML.SimpleProgressView();
|
3150
|
+
}
|
3151
|
+
};
|
3152
|
+
|
3153
|
+
ProgressView.prototype.build = function() {
|
3154
|
+
return this.el = this.createEl("div", "teabag-indicator modeset-logo");
|
3155
|
+
};
|
3156
|
+
|
3157
|
+
ProgressView.prototype.update = function() {};
|
3158
|
+
|
3159
|
+
return ProgressView;
|
3160
|
+
|
3161
|
+
})(Teabag.Reporters.BaseView);
|
3162
|
+
|
3163
|
+
Teabag.Reporters.HTML.SimpleProgressView = (function(_super) {
|
3164
|
+
|
3165
|
+
__extends(SimpleProgressView, _super);
|
3166
|
+
|
3167
|
+
function SimpleProgressView() {
|
3168
|
+
return SimpleProgressView.__super__.constructor.apply(this, arguments);
|
3169
|
+
}
|
3170
|
+
|
3171
|
+
SimpleProgressView.prototype.build = function() {
|
3172
|
+
this.el = this.createEl("div", "simple-progress");
|
3173
|
+
return this.el.innerHTML = "<em id=\"teabag-progress-percent\">0%</em>\n<span id=\"teabag-progress-span\" class=\"teabag-indicator\"></span>";
|
3174
|
+
};
|
3175
|
+
|
3176
|
+
SimpleProgressView.prototype.update = function(total, run) {
|
3177
|
+
var percent;
|
3178
|
+
percent = total ? Math.ceil((run * 100) / total) : 0;
|
3179
|
+
return this.setHtml("progress-percent", "" + percent + "%");
|
3180
|
+
};
|
3181
|
+
|
3182
|
+
return SimpleProgressView;
|
3183
|
+
|
3184
|
+
})(Teabag.Reporters.HTML.ProgressView);
|
3185
|
+
|
3186
|
+
Teabag.Reporters.HTML.RadialProgressView = (function(_super) {
|
3187
|
+
|
3188
|
+
__extends(RadialProgressView, _super);
|
3189
|
+
|
3190
|
+
function RadialProgressView() {
|
3191
|
+
return RadialProgressView.__super__.constructor.apply(this, arguments);
|
3192
|
+
}
|
3193
|
+
|
3194
|
+
RadialProgressView.supported = !!document.createElement("canvas").getContext;
|
3195
|
+
|
3196
|
+
RadialProgressView.prototype.build = function() {
|
3197
|
+
this.el = this.createEl("div", "teabag-indicator radial-progress");
|
3198
|
+
return this.el.innerHTML = "<canvas id=\"teabag-progress-canvas\"></canvas>\n<em id=\"teabag-progress-percent\">0%</em>";
|
3199
|
+
};
|
3200
|
+
|
3201
|
+
RadialProgressView.prototype.appendTo = function() {
|
3202
|
+
var canvas;
|
3203
|
+
RadialProgressView.__super__.appendTo.apply(this, arguments);
|
3204
|
+
this.size = 80;
|
3205
|
+
try {
|
3206
|
+
canvas = this.findEl("progress-canvas");
|
3207
|
+
canvas.width = canvas.height = canvas.style.width = canvas.style.height = this.size;
|
3208
|
+
this.ctx = canvas.getContext("2d");
|
3209
|
+
this.ctx.strokeStyle = "#fff";
|
3210
|
+
return this.ctx.lineWidth = 1.5;
|
3211
|
+
} catch (e) {
|
3212
|
+
|
3213
|
+
}
|
3214
|
+
};
|
3215
|
+
|
3216
|
+
RadialProgressView.prototype.update = function(total, run) {
|
3217
|
+
var half, percent;
|
3218
|
+
percent = total ? Math.ceil((run * 100) / total) : 0;
|
3219
|
+
this.setHtml("progress-percent", "" + percent + "%");
|
3220
|
+
if (!this.ctx) {
|
3221
|
+
return;
|
3222
|
+
}
|
3223
|
+
half = this.size / 2;
|
3224
|
+
this.ctx.clearRect(0, 0, this.size, this.size);
|
3225
|
+
this.ctx.beginPath();
|
3226
|
+
this.ctx.arc(half, half, half - 1, 0, Math.PI * 2 * (percent / 100), false);
|
3227
|
+
return this.ctx.stroke();
|
3228
|
+
};
|
3229
|
+
|
3230
|
+
return RadialProgressView;
|
3231
|
+
|
3232
|
+
})(Teabag.Reporters.HTML.ProgressView);
|
3233
|
+
|
3234
|
+
}).call(this);
|
3235
|
+
(function() {
|
3236
|
+
var __hasProp = {}.hasOwnProperty,
|
3237
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
3238
|
+
|
3239
|
+
Teabag.Reporters.HTML.SpecView = (function(_super) {
|
3240
|
+
var viewId;
|
3241
|
+
|
3242
|
+
__extends(SpecView, _super);
|
3243
|
+
|
3244
|
+
viewId = 0;
|
3245
|
+
|
3246
|
+
function SpecView(spec, reporter) {
|
3247
|
+
this.spec = spec;
|
3248
|
+
this.reporter = reporter;
|
3249
|
+
this.views = this.reporter.views;
|
3250
|
+
this.spec.viewId = viewId += 1;
|
3251
|
+
this.views.specs[this.spec.viewId] = this;
|
3252
|
+
SpecView.__super__.constructor.apply(this, arguments);
|
3253
|
+
}
|
3254
|
+
|
3255
|
+
SpecView.prototype.build = function() {
|
3256
|
+
var classes;
|
3257
|
+
classes = ["spec"];
|
3258
|
+
if (this.spec.pending) {
|
3259
|
+
classes.push("state-pending");
|
3260
|
+
}
|
3261
|
+
SpecView.__super__.build.call(this, classes.join(" "));
|
3262
|
+
this.el.innerHTML = "<a href=\"" + this.spec.link + "\">" + this.spec.description + "</a>";
|
3263
|
+
this.parentView = this.buildParent();
|
3264
|
+
return this.parentView.append(this.el);
|
3265
|
+
};
|
3266
|
+
|
3267
|
+
SpecView.prototype.buildParent = function() {
|
3268
|
+
var parent, view;
|
3269
|
+
parent = this.spec.parent;
|
3270
|
+
if (parent.viewId) {
|
3271
|
+
return this.views.suites[parent.viewId];
|
3272
|
+
} else {
|
3273
|
+
view = new Teabag.Reporters.HTML.SuiteView(parent, this.reporter);
|
3274
|
+
return this.views.suites[view.suite.viewId] = view;
|
3275
|
+
}
|
3276
|
+
};
|
3277
|
+
|
3278
|
+
SpecView.prototype.buildErrors = function() {
|
3279
|
+
var div, error, html, _i, _len, _ref;
|
3280
|
+
div = this.createEl("div");
|
3281
|
+
html = "";
|
3282
|
+
_ref = this.spec.errors();
|
3283
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
3284
|
+
error = _ref[_i];
|
3285
|
+
html += "" + (this.htmlSafe(error.stack || error.message || "Stack trace unavailable"));
|
3286
|
+
}
|
3287
|
+
div.innerHTML = html;
|
3288
|
+
return this.append(div);
|
3289
|
+
};
|
3290
|
+
|
3291
|
+
SpecView.prototype.updateState = function(state, elapsed) {
|
3292
|
+
var classes, result, _base;
|
3293
|
+
result = this.spec.result();
|
3294
|
+
classes = ["state-" + state];
|
3295
|
+
if (elapsed > Teabag.slow) {
|
3296
|
+
classes.push("slow");
|
3297
|
+
}
|
3298
|
+
if (state !== "failed") {
|
3299
|
+
this.el.innerHTML += "<span>" + elapsed + "ms</span>";
|
3300
|
+
}
|
3301
|
+
this.el.className = classes.join(" ");
|
3302
|
+
if (result.status !== "passed") {
|
3303
|
+
this.buildErrors();
|
3304
|
+
}
|
3305
|
+
return typeof (_base = this.parentView).updateState === "function" ? _base.updateState(state) : void 0;
|
3306
|
+
};
|
3307
|
+
|
3308
|
+
return SpecView;
|
3309
|
+
|
3310
|
+
})(Teabag.Reporters.BaseView);
|
3311
|
+
|
3312
|
+
}).call(this);
|
3313
|
+
(function() {
|
3314
|
+
var __hasProp = {}.hasOwnProperty,
|
3315
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
3316
|
+
|
3317
|
+
Teabag.Reporters.HTML.FailureView = (function(_super) {
|
3318
|
+
|
3319
|
+
__extends(FailureView, _super);
|
3320
|
+
|
3321
|
+
function FailureView(spec) {
|
3322
|
+
this.spec = spec;
|
3323
|
+
FailureView.__super__.constructor.apply(this, arguments);
|
3324
|
+
}
|
3325
|
+
|
3326
|
+
FailureView.prototype.build = function() {
|
3327
|
+
var error, html, _i, _len, _ref;
|
3328
|
+
FailureView.__super__.build.call(this, "spec");
|
3329
|
+
html = "<h1 class=\"teabag-clearfix\"><a href=\"" + this.spec.link + "\">" + this.spec.fullDescription + "</a></h1>";
|
3330
|
+
_ref = this.spec.errors();
|
3331
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
3332
|
+
error = _ref[_i];
|
3333
|
+
html += "<div>" + (this.htmlSafe(error.stack || error.message || "Stack trace unavailable")) + "</div>";
|
3334
|
+
}
|
3335
|
+
return this.el.innerHTML = html;
|
3336
|
+
};
|
3337
|
+
|
3338
|
+
return FailureView;
|
3339
|
+
|
3340
|
+
})(Teabag.Reporters.BaseView);
|
3341
|
+
|
3342
|
+
}).call(this);
|
3343
|
+
(function() {
|
3344
|
+
var __hasProp = {}.hasOwnProperty,
|
3345
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
3346
|
+
|
3347
|
+
Teabag.Reporters.HTML.SuiteView = (function(_super) {
|
3348
|
+
var viewId;
|
3349
|
+
|
3350
|
+
__extends(SuiteView, _super);
|
3351
|
+
|
3352
|
+
viewId = 0;
|
3353
|
+
|
3354
|
+
function SuiteView(suite, reporter) {
|
3355
|
+
this.suite = suite;
|
3356
|
+
this.reporter = reporter;
|
3357
|
+
this.views = this.reporter.views;
|
3358
|
+
this.suite.viewId = viewId += 1;
|
3359
|
+
this.views.suites[this.suite.viewId] = this;
|
3360
|
+
this.suite = new Teabag.Reporters.NormalizedSuite(suite);
|
3361
|
+
SuiteView.__super__.constructor.apply(this, arguments);
|
3362
|
+
}
|
3363
|
+
|
3364
|
+
SuiteView.prototype.build = function() {
|
3365
|
+
SuiteView.__super__.build.call(this, "suite");
|
3366
|
+
this.el.innerHTML = "<h1><a href=\"" + this.suite.link + "\">" + this.suite.description + "</a></h1>";
|
3367
|
+
this.parentView = this.buildParent();
|
3368
|
+
return this.parentView.append(this.el);
|
3369
|
+
};
|
3370
|
+
|
3371
|
+
SuiteView.prototype.buildParent = function() {
|
3372
|
+
var parent, view;
|
3373
|
+
parent = this.suite.parent;
|
3374
|
+
if (!parent) {
|
3375
|
+
return this.reporter;
|
3376
|
+
}
|
3377
|
+
if (parent.viewId) {
|
3378
|
+
return this.views.suites[parent.viewId];
|
3379
|
+
} else {
|
3380
|
+
view = new Teabag.Reporters.HTML.SuiteView(parent, this.reporter);
|
3381
|
+
return this.views.suites[view.suite.viewId] = view;
|
3382
|
+
}
|
3383
|
+
};
|
3384
|
+
|
3385
|
+
SuiteView.prototype.append = function(el) {
|
3386
|
+
if (!this.ol) {
|
3387
|
+
SuiteView.__super__.append.call(this, this.ol = this.createEl("ol"));
|
3388
|
+
}
|
3389
|
+
return this.ol.appendChild(el);
|
3390
|
+
};
|
3391
|
+
|
3392
|
+
SuiteView.prototype.updateState = function(state) {
|
3393
|
+
var _base;
|
3394
|
+
if (this.state === "failed") {
|
3395
|
+
return;
|
3396
|
+
}
|
3397
|
+
this.el.className = "" + (this.el.className.replace(/\s?state-\w+/, "")) + " state-" + state;
|
3398
|
+
if (typeof (_base = this.parentView).updateState === "function") {
|
3399
|
+
_base.updateState(state);
|
3400
|
+
}
|
3401
|
+
return this.state = state;
|
3402
|
+
};
|
3403
|
+
|
3404
|
+
return SuiteView;
|
3405
|
+
|
3406
|
+
})(Teabag.Reporters.BaseView);
|
3407
|
+
|
3408
|
+
}).call(this);
|
3409
|
+
(function() {
|
3410
|
+
var __hasProp = {}.hasOwnProperty,
|
3411
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
3412
|
+
|
3413
|
+
Teabag.Reporters.HTML = (function(_super) {
|
3414
|
+
|
3415
|
+
__extends(HTML, _super);
|
3416
|
+
|
3417
|
+
function HTML() {
|
3418
|
+
return HTML.__super__.constructor.apply(this, arguments);
|
3419
|
+
}
|
3420
|
+
|
3421
|
+
HTML.prototype.readConfig = function() {
|
3422
|
+
HTML.__super__.readConfig.apply(this, arguments);
|
3423
|
+
return jasmine.CATCH_EXCEPTIONS = this.config["use-catch"];
|
3424
|
+
};
|
3425
|
+
|
3426
|
+
HTML.prototype.envInfo = function() {
|
3427
|
+
var ver, verString;
|
3428
|
+
ver = jasmine.getEnv().version();
|
3429
|
+
verString = [ver.major, ver.minor, ver.build].join(".");
|
3430
|
+
return "jasmine " + verString + " revision " + ver.revision;
|
3431
|
+
};
|
3432
|
+
|
3433
|
+
return HTML;
|
3434
|
+
|
3435
|
+
})(Teabag.Reporters.HTML);
|
3436
|
+
|
3437
|
+
}).call(this);
|
3438
|
+
(function() {
|
3439
|
+
var __hasProp = {}.hasOwnProperty,
|
3440
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
3441
|
+
|
3442
|
+
Teabag.Runner = (function(_super) {
|
3443
|
+
var env;
|
3444
|
+
|
3445
|
+
__extends(Runner, _super);
|
3446
|
+
|
3447
|
+
env = jasmine.getEnv();
|
3448
|
+
|
3449
|
+
function Runner() {
|
3450
|
+
Runner.__super__.constructor.apply(this, arguments);
|
3451
|
+
env.execute();
|
3452
|
+
}
|
3453
|
+
|
3454
|
+
Runner.prototype.setup = function() {
|
3455
|
+
var grep, reporter;
|
3456
|
+
env.updateInterval = 1000;
|
3457
|
+
if (grep = this.params["grep"]) {
|
3458
|
+
env.specFilter = function(spec) {
|
3459
|
+
return spec.getFullName().indexOf(grep) === 0;
|
3460
|
+
};
|
3461
|
+
}
|
3462
|
+
if (navigator.userAgent.match(/PhantomJS/)) {
|
3463
|
+
reporter = new Teabag.Reporters.Console();
|
3464
|
+
} else {
|
3465
|
+
reporter = new Teabag.Reporters.HTML();
|
3466
|
+
}
|
3467
|
+
if (typeof reporter.setFilter === "function") {
|
3468
|
+
reporter.setFilter(this.params["grep"]);
|
3469
|
+
}
|
3470
|
+
env.addReporter(reporter);
|
3471
|
+
return this.addFixtureSupport();
|
3472
|
+
};
|
3473
|
+
|
3474
|
+
Runner.prototype.addFixtureSupport = function() {
|
3475
|
+
if (!(jasmine.getFixtures && this.fixturePath)) {
|
3476
|
+
return;
|
3477
|
+
}
|
3478
|
+
jasmine.getFixtures().containerId = "teabag-fixtures";
|
3479
|
+
jasmine.getFixtures().fixturesPath = this.fixturePath;
|
3480
|
+
jasmine.getStyleFixtures().fixturesPath = this.fixturePath;
|
3481
|
+
return jasmine.getJSONFixtures().fixturesPath = this.fixturePath;
|
3482
|
+
};
|
3483
|
+
|
3484
|
+
return Runner;
|
3485
|
+
|
3486
|
+
})(Teabag.Runner);
|
3487
|
+
|
3488
|
+
}).call(this);
|