Permalink
Browse files

Changing the README over to Markdown and expanding. Still miles to go…

… before I sleep.
  • Loading branch information...
1 parent c8d048a commit 978739f87f131575542a4d79a8d6074cc2b44921 Larry Karnowski committed Apr 14, 2009
Showing with 129 additions and 74 deletions.
  1. +0 −73 README
  2. +128 −0 README.markdown
  3. +1 −1 TODO.taskpaper
View
@@ -1,73 +0,0 @@
-JavaScript Testing
-==================
-
-This collection of files is useful for getting a Rails app up and running with headless Screw.Unit tests for your JavaScript files.
-
-More information at: http://blog.thinkrelevance.com/2008/7/31/fully-headless-jsspec
-
-To install:
-
- rails_project> ./script/plugin install git://github.com/relevance/javascript_testing.git
- rails_project> ./script/generate javascript_testing
-
-
-... example of creating just one spec ...
-
-Example
-=======
-
-We don’t actually encourage you to write specs and tests for standard libraries like Prototype, JQuery, etc. It just makes for an easy demo.
-
-In test/javascript/fixtures/selector.html
-
- <html>
- <body>
- <div class="select_me"/>
- <span class="select_me"/>
- <div class="dont_select_me"/>
- </body>
- </html>
-
-In test/javascript/selector_spec.js
-
- require("spec_helper.js");
- require("../../public/javascripts/prototype.js");
-
- Screw.Unit(function() {
- describe("Prototype's $$ selector", function() {
- it("should find only elements with the provided class selector", function() {
- expect($$('.select_me').length).to(equal, 2);
- });
-
- it("should find only elements with the provided tag", function() {
- expect($$('div').length).to(equal,2);
- });
- });
- });
-
-
-Now run the individual spec:
-
- rake test:javascripts TEST=selector_spec.js
-
-Or run all of the specs:
-
- rake test:javascripts
-
-
-... API: require, etc ...
-
-Copyright (c) 2008-9 Relevance, Inc., released under the MIT license
- env.js - Copyright 2007-9 John Resig, under the MIT License
- Screw.Unit - Copyright 2008 Nick Kallen, license attached
- Rhino - Copyright 2009 Mozilla Foundation, GPL 2.0
- Smoke - Copyright 2008 Andy Kent, license attached
-
-Contributors
-===================
-* Justin Gehtland
-* Geof Dagley
-* Larry Karnowski
-* Raimonds Simanovskis
-* Jason Rudolph
-* Chris Thatcher (for numerous env.js bug fixes!)
View
@@ -0,0 +1,128 @@
+JavaScript Testing
+==================
+
+The JavaScript Testing Rails Plugin adds support for command-line and in-browser JavaScript unit testing to your Rails app.
+
+
+Installing and Running
+----------------------
+
+To install:
+
+ rails_project> ./script/plugin install git://github.com/relevance/javascript_testing.git
+ rails_project> ./script/generate javascript_testing
+
+This will create one of the following directories:
+
+* `examples/javascripts`: if you're using [Micronaut](http://github.com/spicycode/micronaut)
+* `spec/javascripts`: if you're using [RSpec]()
+* `test/javascript`: if you're using anything else
+
+To run all of the specs:
+
+ rails_project> rake test:javascripts
+
+(Hint: You can also use `spec:javascripts` or `examples:javascripts`. They're all the same.)
+
+To run an individual spec file "selector_spec.js":
+
+ rails_project> rake test:javascripts TEST=selector
+
+
+Example using jQuery (the default)
+----------------------------------
+
+ require("spec_helper.js");
+ require("../../public/javascripts/application.js");
+
+ Screw.Unit(function() {
+ describe("Your application javascript", function() {
+ it("does something", function() {
+ expect("hello").to(equal, "hello");
+ });
+
+ it("accesses the DOM from fixtures/application.html", function() {
+ expect($('.select_me').length).to(equal, 2);
+ });
+ });
+ });
+
+
+
+Example using Prototype
+-----------------------
+
+We don’t actually encourage you to write specs and tests for standard libraries like Prototype, JQuery, etc. It just makes for an easy demo.
+
+In test/javascript/fixtures/selector.html
+
+ <html>
+ <body>
+ <div class="select_me"/>
+ <span class="select_me"/>
+ <div class="dont_select_me"/>
+ </body>
+ </html>
+
+In test/javascript/selector_spec.js
+
+ jQuery.noConflict();
+ require("spec_helper.js");
+ require("../../public/javascripts/prototype.js", {onload: function() {
+ require("../../public/javascripts/application.js");
+ }});
+
+ Screw.Unit(function() {
+ describe("Your application javascript", function() {
+ it("does something", function() {
+ expect("hello").to(equal, "hello");
+ });
+
+ it("accesses the DOM from fixtures/application.html", function() {
+ expect($$('.select_me').length).to(equal, 2);
+ });
+ });
+ });
+
+
+JavaScript API
+--------------
+
+... API: require, etc ...
+
+Extras
+-------------
+
+.. js:fixtures ..
+.. js:shell ..
+
+Mocking Example with Smoke
+--------------------------
+
+TBD
+
+Links
+-------------
+* [http://github.com/relevance/javascript_testing](http://github.com/relevance/javascript_testing)
+* [http://blog.thinkrelevance.com/2008/7/31/fully-headless-jsspec](http://blog.thinkrelevance.com/2008/7/31/fully-headless-jsspec)
+* link to screw.unit
+* link to smoke
+* link to env.js
+* link to rhino
+
+Contributors
+------------
+* Justin Gehtland
+* Geof Dagley
+* Larry Karnowski
+* Chris Thatcher (for numerous env.js bug fixes!)
+* Raimonds Simanovskis
+* Jason Rudolph
+
+Copyrights
+------------
+* Copyright &copy; 2008-2009 Relevance, Inc., under the MIT license
+* env.js - Copyright 2007-2009 John Resig, under the MIT License
+* Screw.Unit - Copyright 2008 Nick Kallen, license attached
+* Rhino - Copyright 2009 Mozilla Foundation, GPL 2.0
+* Smoke - Copyright 2008 Andy Kent, license attached
View
@@ -27,5 +27,5 @@ Release 1:
- what is the new name? "blueridge"? "blue-ridge"? something else?
Release 2:
- sprockets support?
-- improve "require" to take an array and chain them together in order?
+- improve "require" to take an array and chain them together in order
- handle display of nested describes better for command-line

0 comments on commit 978739f

Please sign in to comment.