Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

TESTING.md 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. ## Running the mustache.js Test Suite
  2. Notice: the tests are only expected to run on unixoid systems.
  3. The mustache.js test suite uses the [RSpec](http://rspec.info/) testing
  4. framework. In order to run the tests you'll need to install [Ruby](http://ruby-lang.org/)
  5. as well as the `rake`, `rspec` (>=2), and `json` [RubyGems](http://rubygems.org/).
  6. ### How to install Ruby, Ruby gems and the required gems with a package manager
  7. Tested on Ubuntu 10.10.
  8. $ sudo apt-get install ruby1.8-dev
  9. $ sudo apt-get install rubygems1.8
  10. $ sudo gem install rake rspec
  11. $ # needed to build native json extension for json gem
  12. $ sudo apt-get install build-essential libreadline5-dev
  13. $ sudo gem install json
  14. ### How to install Ruby and the required gems from source
  15. Make sure you have the required tools to compile it:
  16. $ apt-get install build-essential libssl-dev libreadline5-dev zlib1g-dev
  17. Download and extract the Ruby source, and install it:
  18. $ wget ftp://ftp.ruby-lang.org/pub/ruby/stable-snapshot.tar.gz
  19. $ tar xvzf stable-snapshot.tar.gz
  20. $ cd ruby
  21. $ ./configure && make && make install
  22. Download and extract RubyGems, and install it:
  23. $ wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.12.tgz
  24. $ tar xzvf rubygems-1.8.12.tgz
  25. $ cd rubygems-1.8.12
  26. $ ruby setup.rb
  27. If you want to update RubyGems:
  28. $ gem update --system
  29. Install the required gems:
  30. $ gem install rake rspec json
  31. That's it!
  32. ### How to install node.js using a package manager
  33. Notice: the version of node.js included in Ubuntu repositories is quite old.
  34. It is recommended to install node.js from source instead.
  35. $ sudo apt-get install node
  36. ### How to install node.js from source
  37. $ git clone https://github.com/joyent/node.git
  38. $ cd node
  39. $ # select the version to install, master is unstable;
  40. $ # latest stable version is advertised on http://nodejs.org
  41. $ git checkout v0.6.11
  42. $ ./configure
  43. $ make
  44. $ sudo make install
  45. ### How to run the tests
  46. The mustache.js test suite currently uses 4 different JavaScript runtime engines
  47. to maximize portability across platforms and browsers. They are:
  48. * node
  49. * SpiderMonkey (Mozilla, Firefox)
  50. * JavaScriptCore (WebKit, Safari)
  51. * Rhino (Mozilla, Java)
  52. When the test suite runs it will automatically determine which platforms are
  53. available on your machine and run on all of them. The suite must run on at least
  54. one platform in order to succeed.
  55. Once you have at least one JavaScript platform installed, you can run the test
  56. suite with the following command:
  57. $ rake
  58. ### How to create a test
  59. All test files live in the spec/_files directory. To create a new test:
  60. * Create a template file `somename.mustache`
  61. * Create a javascript file with data and functions `somename.js`
  62. * Create a file the expected result `somename.txt`