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.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 run the tests
  33. The mustache.js test suite currently uses 4 different JavaScript runtime engines
  34. to maximize portability across platforms and browsers. They are:
  35. * node
  36. * SpiderMonkey (Mozilla, Firefox)
  37. * JavaScriptCore (WebKit, Safari)
  38. * Rhino (Mozilla, Java)
  39. When the test suite runs it will automatically determine which platforms are
  40. available on your machine and run on all of them. The suite must run on at least
  41. one platform in order to succeed.
  42. Once you have at least one JavaScript platform installed, you can run the test
  43. suite with the following command:
  44. $ rake
  45. ### How to create a test
  46. All test files live in the spec/_files directory. To create a new test:
  47. * Create a template file `somename.mustache`
  48. * Create a javascript file with data and functions `somename.js`
  49. * Create a file the expected result `somename.txt`