README.md in netzke-testing-0.9.1 vs README.md in netzke-testing-0.10.0.rc1

- old
+ new

@@ -22,12 +22,12 @@ http://localhost:3000/netzke/components/UserGrid?height=600 ## Testing components with Mocha and Expect.js -Place the Mocha specs (written in Coffeescript) for your components inside `spec/javascripts` folder. An example spec -may look like this (in `spec/javascripts/user_grid.js.coffee`): +Place the Mocha specs (written in Coffeescript) for your components inside `spec/features/javascripts` folder. An +example spec may look like this (in `spec/features/javascripts/user_grid.js.coffee`): describe 'UserGrid', -> it 'shows proper title', -> grid = Ext.ComponentQuery.query('panel[id="user_grid"]')[0] expect(grid.getHeader().title).to.eql 'Test component' @@ -39,12 +39,12 @@ Specs can be structured into directories. For example, let's say we have a namescope for admin components: class Admin::UserGrid < Netzke::Basepack::Grid end -It makes sense to put the corresponding specs in `spec/javascripts/admin/user_grid.js.coffee`. In this case, the URL -to run the Mocha specs will be: +It makes sense to put the corresponding specs in `spec/features/javascripts/admin/user_grid.js.coffee`. In this case, + the URL to run the Mocha specs will be: http://localhost:3000/netzke/components/UserGrid?spec=admin/user_grid ## Mocha spec helpers @@ -65,28 +65,29 @@ end Keep in mind the following: * the current set of helpers is in flux, and may be drastically changed sooner than you may expect - * the helpers directly pollute the `window` namespace; if you decide you're better off without provided helpers, - specify 'no-helpers=true' as an extra URL parameter + * the helpers directly pollute the global (`window`) namespace; if you decide you're better off without provided + helpers, specify 'no-helpers=true' as an extra URL parameter See the [source code](https://github.com/netzke/netzke-testing/tree/master/app/assets/javascripts/netzke/testing/helpers) for currently implemented helpers (TODO: document them). Also, refer to other Netzke gems source code (like netzke-core and - netzke-basepack) to see examples using the helpers. +netzke-basepack) to see examples using the helpers. ## Testing with selenium webdriver Generate the `netzke_mocha_spec.rb` file that will automatically run the specs that follow a certain naming convention: rails g netzke_testing -This spec will pick up all the `*_spec.js.coffee` files from `spec/javascripts` folder and generate an `it` clause for -each of them. Let's say we want to create the spec for UserGrid. For this we name the spec file -`spec/javascripts/user_grid_spec.js.coffee`. And the other way around: when `netzke_mocha_spec.rb` finds a file called -`spec/javascripts/order_grid_spec.js.coffee`, it'll assume existance of `OrderGrid` component that should be tested. +This spec will pick up all the `*_spec.js.coffee` files from `spec/features/javascripts` folder and generate an `it` +clause for each of them. Let's say we want to create the spec for UserGrid. For this we name the spec file +`spec/features/javascripts/user_grid_spec.js.coffee`. And the other way around: when `netzke_mocha_spec.rb` finds a file +called `spec/features/javascripts/order_grid_spec.js.coffee`, it'll assume existance of `OrderGrid` component that +should be tested. ## Mixing client- and server-side testing code Often we want to run some Ruby code before running the Mocha spec (e.g. to seed some test data using factories), or after (e.g. to assert changes in the database). In this case you can create a RSpec spec that uses the `run_mocha_spec` @@ -107,9 +108,9 @@ You can explicitely specify a component to run the spec on (in order to override the convention): run_mocha_spec 'grid_with_destructive_button', component: 'UserGrid' --- -Copyright (c) 2008-2013 [Max Gorin](https://twitter.com/uptomax), released under the MIT license (see LICENSE). +Copyright (c) 2008-2014 [Max Gorin](https://twitter.com/uptomax), released under the MIT license (see LICENSE). **Note** that Ext JS is licensed [differently](http://www.sencha.com/products/extjs/license/), and you may need to purchase a commercial license in order to use it in your projects!