ember-cli-custom-assertions
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "ember-cli-custom-assertions", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Easily add custom assertions to your Ember test suite", | ||
@@ -5,0 +5,0 @@ "directories": { |
# ember-cli-custom-assertions # | ||
[![Build Status](https://secure.travis-ci.org/dockyard/ember-cli-custom-assertions.svg?branch=master)](http://travis-ci.org/dockyard/ember-cli-custom-assertions) | ||
## About ## | ||
@@ -23,3 +25,2 @@ | ||
// tests/assertions/contains.js | ||
export default function(context, element, text, message) { | ||
@@ -42,2 +43,13 @@ var matches = context.$(element).text().match(new RegExp(text)); | ||
*Note: hyphenated file names like `tests/assertions/double-trouble.js` | ||
will be camelized: `assert.doubleTrouble`* | ||
### Blueprint | ||
You can generate a new assertion by using the `assertion` blueprint: | ||
``` | ||
ember g assertion double-trouble | ||
``` | ||
### Assertion | ||
@@ -44,0 +56,0 @@ |
import Ember from 'ember'; | ||
import { default as environment } from '../config/environment'; | ||
const { | ||
camelize | ||
} = Ember.String; | ||
let assertionCache; | ||
@@ -7,5 +12,8 @@ | ||
if (!assertionCache) { | ||
const { modulePrefix } = environment; | ||
const entries = Ember.A(Object.keys(requirejs.entries)); | ||
let _assertions = entries.filter(function(entry) { | ||
return entry.match(/^dummy\/tests\/assertions\/\w+$/); | ||
const pattern = new RegExp(`^${modulePrefix}/tests/assertions/[\\w-]+$`); | ||
const _assertions = entries.filter(function(entry) { | ||
return entry.match(pattern); | ||
}); | ||
@@ -18,2 +26,3 @@ | ||
entry = splitEntry[splitEntry.length - 1]; | ||
entry = camelize(entry); | ||
entries[entry] = fn; | ||
@@ -20,0 +29,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8408
10
105
113