Skip to content

Latest commit

 

History

History
43 lines (33 loc) · 1.27 KB

lint-free.spec.coffee.md

File metadata and controls

43 lines (33 loc) · 1.27 KB

Test Pattern Code is Lint-Free

RULE: The code inside the test pattern block should be pass lint validation. This helps ensure clear and consistent use of the testing patterns.

The convention I use when writting literate CoffeeScript is that code colorized as CoffeeScript is the actual code used to implement this rule, while example code does not have syntax highlighting.

Examples

    ```CoffeeScript
    x = ->
      return 1234 + 4567
    ```
    ```JavaScript
    var x = function () {
      return 1234 + 4567;
    };
    ```

This rule uses the isCodeLintFree and getCode functions from rule util.

    'use strict'
    util = require('../lib/rule.util')
    getCode = (lang) ->
        util.getCode "lint-free/#{lang}"

Define rule acceptance tests.

    describe 'the code block', ->
        it 'should contain lint-free code', ->
            #validate based on language
            block = getCode 'javascript'
            expect(util.isCodeLintFree(block)).toBe yes

            block = getCode 'coffeescript'
            expect(util.isCodeLintFree(block)).toBe yes