Skip to content

Commit

Permalink
Merge pull request #99 from notmessenger/Issue96
Browse files Browse the repository at this point in the history
Closes #96
  • Loading branch information
notmessenger committed Jul 6, 2015
2 parents 8706024 + db0e8c5 commit 561c698
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 21 deletions.
9 changes: 7 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,15 @@ functionality or fixing a bug, we need a test!

4. Make the test pass.

5. Commit your changes. If your pull request fixes an issue specify it in the commit message. Here's an example:
5. Document your code and make sure the documentation is still able to generate and creates the result you are
expecting. This addon leverages the [ember-cli-jsdoc](https://github.com/softlayer/ember-cli-jsdoc) addon to
generate documentation. Simply run either `ember ember-cli-jsdoc` or `npm run docs` (shortcut setup in this repo)
and then visit *http://localhost:4200/docs*.

6. Commit your changes. If your pull request fixes an issue specify it in the commit message. Here's an example:
git commit -m "Close #12 Fix passing of context"`

6. Push to your fork and submit a pull request againt the `master` branch. Please provide us with some explanation
7. Push to your fork and submit a pull request againt the `master` branch. Please provide us with some explanation
of why you made the changes you made. For new features make sure to explain a standard use case to us.

We try to be quick about responding to tickets but sometimes we get a bit backlogged. If the response is slow, try
Expand Down
46 changes: 27 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@

To see which issues are currently being worked on or are scheduled to be worked on next, visit [https://huboard.com/softlayer/sl-ember-test-helpers/#/](https://huboard.com/softlayer/sl-ember-test-helpers/#/)

---

# What is sl-ember-test-helpers

This addon provides and registers test helpers for use in the testing of your application. This addon is compatible with QUnit, Mocha, and any other testing framework you wish to use (or at least should be).


---

# Provided helpers

Expand All @@ -27,7 +25,8 @@ Emulates the beginning and completion of an AJAX request or requests.
* `Ajax.begin()` triggers the `ajaxStart` event on the document
* `Ajax.begin( 'endpointValue' )` triggers the `ajaxSend` event on the document, passing the supplied endpoint value
* `Ajax.end()` triggers the `ajaxStop` event on the document
* `Ajax.end( 'endpointValue' )` triggers the `ajaxComplete` event on the document, passing the supplied endpoint value
* `Ajax.end( 'endpointValue' )` triggers the `ajaxComplete` event on the document, passing the supplied endpoint
value


### contains
Expand All @@ -36,7 +35,9 @@ Emulates the beginning and completion of an AJAX request or requests.
contains( valuesUnderTest, valuesToTestFor );
```

Determine whether values are contained in other values. These values can be a combination of Arrays, Strings, or Objects (for which the keys are extracted). All *valuesToTestFor* must exist in *valuesUnderTest* for this determination to pass successfully.
Determine whether values are contained in other values. These values can be a combination of Arrays, Strings, or
Objects (for which the keys are extracted). All *valuesToTestFor* must exist in *valuesUnderTest* for this
determination to pass successfully.

Calls to `contains()` return a boolean which can then be used in your tests.

Expand All @@ -54,7 +55,8 @@ contains( [ 'a', 'b' ], 'b' );

### requires

Use this helper to test that an argument passed to a function is of the required type(s). The first argument is the function under test and the second argument is an array of types to test for.
Use this helper to test that an argument passed to a function is of the required type(s). The first argument is the
function under test and the second argument is an array of types to test for.

```
requires( functionUnderTest, [ 'string', 'object', 'function' ] );
Expand Down Expand Up @@ -95,23 +97,22 @@ See description in *Synchronous* section
See description in *Synchronous* section


---

# Utilities

There are several utility functions provided in the */test-support/helpers/sl/utils/utils.js* file that, while used internally by the helpers themselves, can be imported as needed for use. These include:
There are several utility functions provided in the */test-support/helpers/sl/utils/utils.js* file that, while used
internally by the helpers themselves, can be imported as needed for use. These include:

* convertToArray()
* convertStringToArray()
* convertObjectKeysToArray()
* doArraysIntersect()


---

# How to use this addon in your application

## Install this addon as a Node module
## Install

```
ember install sl-ember-test-helpers
Expand All @@ -127,38 +128,45 @@ import { contains } from '../../helpers/sl/synchronous';

## If running Asynchronous tests, such as Acceptance Tests

Installing this addon via the `ember install:addon` command will automatically run the generator, which will make changes to the following files:
Installing this addon via the `ember install:addon` command will automatically run the generator, which will make
changes to the following files:

* tests/helpers/start-app.js
* tests/.jshintrc

If your application is under source control management, such as via Git, make sure to commit these changes.

The generator makes changes to the above files assuming the structure of them has not changed much from the default version created during the initial Ember application creation. If too many changes have been made you will need to manually make the changes below:
The generator makes changes to the above files assuming the structure of them has not changed much from the default
version created during the initial Ember application creation. If too many changes have been made you will need to
manually make the changes below:

* Add `import slRegisterTestHelpers from './sl/register-test-helpers';` to the beginning of the *tests/helpers/start-app.js* file
* In the *tests/helpers/start-app.js* file, place `slRegisterTestHelpers();` before the `application.injectTestHelpers()` line
* Add `import slRegisterTestHelpers from './sl/register-test-helpers';` to the beginning of the *tests/helpers/start-
app.js* file
* In the *tests/helpers/start-app.js* file, place `slRegisterTestHelpers();` before the `application.
injectTestHelpers()` line
* Add `"contains",` to the `predef` section of the */tests/.jshintrc* file

## Generated documentation

This addon leverages the [ember-cli-jsdoc](https://github.com/softlayer/ember-cli-jsdoc) addon. Simply run either
`ember ember-cli-jsdoc` or `npm run docs` (shortcut setup in this repo) and then visit *http://localhost:4200/docs*.


---

# Versioning
Employs [Semantic Versioning 2.0.0](http://semver.org/)

---

# Contribution
[See CONTRIBUTING.md](https://github.com/softlayer/sl-ember-test-helpers/blob/master/CONTRIBUTING.md)

---

# Copyright and License
sl-ember-test-helpers and its source files are Copyright © 2014-2015 [SoftLayer Technologies, Inc.](http://www.softlayer.com/)
The software is [MIT Licensed](https://github.com/softlayer/sl-ember-test-helpers/blob/master/LICENSE.md)
sl-ember-test-helpers and its source files are Copyright © 2014-2015
[SoftLayer Technologies, Inc.](http://www.softlayer.com/). The software is
[MIT Licensed](https://github.com/softlayer/sl-ember-test-helpers/blob/master/LICENSE.md)


---

# Warranty
This software is provided “as is” and without any express or implied warranties, including, without limitation, the
Expand Down

0 comments on commit 561c698

Please sign in to comment.