diff options
| author | Thomas Haddad | 2016-11-15 11:46:13 +0100 |
|---|---|---|
| committer | Thomas Haddad | 2016-11-15 11:46:13 +0100 |
| commit | 4acc72a492853c50774275a8435e091f62acc08c (patch) | |
| tree | 420b586d9b85b86deed0d7d47f5e2f8ab8a2b7f1 | |
| parent | 19cc9e96028804609b3214c13de8480f857fc7e0 (diff) | |
| parent | 7f3a7ebaf17fa93fc8e6a26ddf7d9650e7251c77 (diff) | |
| download | chouette-core-4acc72a492853c50774275a8435e091f62acc08c.tar.bz2 | |
Merge branch 'itineraries_test'
| -rw-r--r-- | Gemfile | 2 | ||||
| -rw-r--r-- | Gemfile.lock | 7 | ||||
| -rw-r--r-- | app/assets/javascripts/es6_browserified/actions/index.js | 8 | ||||
| -rw-r--r-- | app/assets/javascripts/es6_browserified/components/App.js | 8 | ||||
| -rw-r--r-- | app/assets/javascripts/es6_browserified/components/BSelect2.js | 7 | ||||
| -rw-r--r-- | app/assets/javascripts/es6_browserified/components/Todo.js | 7 | ||||
| -rw-r--r-- | app/assets/javascripts/es6_browserified/components/TodoList.js | 7 | ||||
| -rw-r--r-- | app/assets/javascripts/es6_browserified/containers/AddTodo.js | 10 | ||||
| -rw-r--r-- | app/assets/javascripts/es6_browserified/containers/VisibleTodoList.js | 20 | ||||
| -rw-r--r-- | app/assets/javascripts/es6_browserified/form_helper.js | 18 | ||||
| -rw-r--r-- | app/assets/javascripts/es6_browserified/reducers/index.js | 6 | ||||
| -rw-r--r-- | app/assets/javascripts/es6_browserified/reducers/todos.js | 13 | ||||
| -rw-r--r-- | app/assets/javascripts/es6_browserified/stop_points.js | 14 | ||||
| -rw-r--r-- | config/application.rb | 9 | ||||
| -rw-r--r-- | spec/javascripts/actions_spec.js | 52 | ||||
| -rw-r--r-- | spec/javascripts/spec_helper.js | 32 | ||||
| -rw-r--r-- | spec/teaspoon_env.rb | 186 |
17 files changed, 348 insertions, 58 deletions
@@ -170,6 +170,8 @@ group :test, :development do gem 'rb-fsevent', require: RUBY_PLATFORM.include?('darwin') && 'rb-fsevent' gem 'transpec' gem 'shoulda-matchers' + gem "teaspoon-jasmine" + gem "phantomjs" end group :production do diff --git a/Gemfile.lock b/Gemfile.lock index 88f36e3e6..b1f7e3107 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -313,6 +313,7 @@ GEM parser (2.2.0.3) ast (>= 1.1, < 3.0) pg (0.18.1) + phantomjs (2.1.1.0) poltergeist (1.6.0) capybara (~> 2.1) cliver (~> 0.3.1) @@ -511,6 +512,10 @@ GEM activerecord (>= 3.0) activesupport (>= 3.0) polyamorous (~> 1.1.0) + teaspoon (1.1.5) + railties (>= 3.2.5, < 6) + teaspoon-jasmine (2.3.4) + teaspoon (>= 1.0.0) temple (0.7.7) term-ansicolor (1.3.2) tins (~> 1.0) @@ -622,6 +627,7 @@ DEPENDENCIES mimemagic newrelic_rpm pg + phantomjs poltergeist polylines pry-rails @@ -666,6 +672,7 @@ DEPENDENCIES spring sqlite3 squeel + teaspoon-jasmine therubyracer (~> 0.12) transpec turbolinks diff --git a/app/assets/javascripts/es6_browserified/actions/index.js b/app/assets/javascripts/es6_browserified/actions/index.js index de3bfc113..b92f9c913 100644 --- a/app/assets/javascripts/es6_browserified/actions/index.js +++ b/app/assets/javascripts/es6_browserified/actions/index.js @@ -1,4 +1,4 @@ -module.exports = { +const actions = { addStop : () => { return { type: 'ADD_STOP' @@ -16,13 +16,13 @@ module.exports = { index } }, - deleteStop: (index) => { + deleteStop : (index) => { return { type: 'DELETE_STOP', index } }, - updateInputValue: (index, text) => { + updateInputValue : (index, text) => { return { type : "UPDATE_INPUT_VALUE", index, @@ -30,3 +30,5 @@ module.exports = { } } } + +export default actions diff --git a/app/assets/javascripts/es6_browserified/components/App.js b/app/assets/javascripts/es6_browserified/components/App.js index 7488b0b39..d41c97217 100644 --- a/app/assets/javascripts/es6_browserified/components/App.js +++ b/app/assets/javascripts/es6_browserified/components/App.js @@ -1,6 +1,6 @@ -var React = require('react') -var AddTodo = require('../containers/AddTodo') -var VisibleTodoList = require('../containers/VisibleTodoList') +import React from 'react' +import AddTodo from '../containers/AddTodo' +import VisibleTodoList from '../containers/VisibleTodoList' const App = () => ( <div> @@ -9,4 +9,4 @@ const App = () => ( </div> ) -module.exports = App +export default App diff --git a/app/assets/javascripts/es6_browserified/components/BSelect2.js b/app/assets/javascripts/es6_browserified/components/BSelect2.js index a78dc625f..6fe0f6307 100644 --- a/app/assets/javascripts/es6_browserified/components/BSelect2.js +++ b/app/assets/javascripts/es6_browserified/components/BSelect2.js @@ -1,6 +1,5 @@ -var React = require('react') -var PropTypes = require('react').PropTypes -var Select2 = require('react-select2') +import React, {PropTypes} from 'react' +import Select2 from 'react-select2' // get JSON full path @@ -124,4 +123,4 @@ const formatRepo = (props) => { // ) } -module.exports = BSelect3 +export default BSelect3 diff --git a/app/assets/javascripts/es6_browserified/components/Todo.js b/app/assets/javascripts/es6_browserified/components/Todo.js index 16e42eb3c..e5effe582 100644 --- a/app/assets/javascripts/es6_browserified/components/Todo.js +++ b/app/assets/javascripts/es6_browserified/components/Todo.js @@ -1,6 +1,5 @@ -var React = require('react') -var PropTypes = require('react').PropTypes -var BSelect2 = require('./BSelect2') +import React, {PropTypes} from 'react' +import BSelect2 from './BSelect2' const Container = {display: 'table', width: '100%'} const firstBlock = {display: 'table-cell', verticalAlign: 'middle'} @@ -56,4 +55,4 @@ Todo.propTypes = { value: PropTypes.object } -module.exports = Todo +export default Todo diff --git a/app/assets/javascripts/es6_browserified/components/TodoList.js b/app/assets/javascripts/es6_browserified/components/TodoList.js index e909f07bb..79967e336 100644 --- a/app/assets/javascripts/es6_browserified/components/TodoList.js +++ b/app/assets/javascripts/es6_browserified/components/TodoList.js @@ -1,6 +1,5 @@ -var React = require('react') -var PropTypes = require('react').PropTypes -var Todo = require('./Todo') +import React, {PropTypes} from 'react' +import Todo from './Todo' const TodoList = ({ todos, onDeleteClick, onMoveUpClick, onMoveDownClick, onChange }) => { return ( @@ -31,4 +30,4 @@ TodoList.propTypes = { onMoveDownClick: PropTypes.func.isRequired } -module.exports = TodoList +export default TodoList diff --git a/app/assets/javascripts/es6_browserified/containers/AddTodo.js b/app/assets/javascripts/es6_browserified/containers/AddTodo.js index 539b6f78e..857732333 100644 --- a/app/assets/javascripts/es6_browserified/containers/AddTodo.js +++ b/app/assets/javascripts/es6_browserified/containers/AddTodo.js @@ -1,13 +1,13 @@ -var React = require('react') -var connect = require('react-redux').connect -var addTodo = require('../actions').addStop +import React from 'react' +import { connect } from 'react-redux' +import actions from '../actions' let AddTodo = ({ dispatch }) => { return ( <div className="clearfix" style={{marginBottom: 10}}> <form onSubmit={e => { e.preventDefault() - dispatch(addTodo()) + dispatch(actions.addStop()) }}> <button type="submit" className="btn btn-primary btn-xs pull-right"> <span className="fa fa-plus"></span> Ajouter un arrĂȘt @@ -18,4 +18,4 @@ let AddTodo = ({ dispatch }) => { } AddTodo = connect()(AddTodo) -module.exports = AddTodo +export default AddTodo diff --git a/app/assets/javascripts/es6_browserified/containers/VisibleTodoList.js b/app/assets/javascripts/es6_browserified/containers/VisibleTodoList.js index 09da36060..4bb4e6c05 100644 --- a/app/assets/javascripts/es6_browserified/containers/VisibleTodoList.js +++ b/app/assets/javascripts/es6_browserified/containers/VisibleTodoList.js @@ -1,10 +1,6 @@ -var connect = require('react-redux').connect -var toggleTodo = require('../actions').toggleTodo -var deleteStop = require('../actions').deleteStop -var moveStopUp = require('../actions').moveStopUp -var moveStopDown = require('../actions').moveStopDown -var handleChange = require('../actions').updateInputValue -var TodoList = require('../components/TodoList') +import actions from '../actions' +import { connect } from 'react-redux' +import TodoList from '../components/TodoList' const mapStateToProps = (state) => { return { @@ -15,16 +11,16 @@ const mapStateToProps = (state) => { const mapDispatchToProps = (dispatch) => { return { onDeleteClick: (index) =>{ - dispatch(deleteStop(index)) + dispatch(actions.deleteStop(index)) }, onMoveUpClick: (index) =>{ - dispatch(moveStopUp(index)) + dispatch(actions.moveStopUp(index)) }, onMoveDownClick: (index) =>{ - dispatch(moveStopDown(index)) + dispatch(actions.moveStopDown(index)) }, onChange: (index, text) =>{ - dispatch(handleChange(index, text)) + dispatch(actions.updateInputValue(index, text)) } } } @@ -34,4 +30,4 @@ const VisibleTodoList = connect( mapDispatchToProps )(TodoList) -module.exports = VisibleTodoList +export default VisibleTodoList diff --git a/app/assets/javascripts/es6_browserified/form_helper.js b/app/assets/javascripts/es6_browserified/form_helper.js index 5888f23b9..140794886 100644 --- a/app/assets/javascripts/es6_browserified/form_helper.js +++ b/app/assets/javascripts/es6_browserified/form_helper.js @@ -1,10 +1,10 @@ -module.exports = { - addInput : (name, value, index) => { - let form = document.querySelector('form') - let input = document.createElement('input') - input.setAttribute('type', 'hidden') - input.setAttribute('name', `route[stop_points_attributes][${index}][${name}]`) - input.setAttribute('value', value) - form.appendChild(input) - } +const addInput = (name, value, index) => { + let form = document.querySelector('form') + let input = document.createElement('input') + input.setAttribute('type', 'hidden') + input.setAttribute('name', `route[stop_points_attributes][${index}][${name}]`) + input.setAttribute('value', value) + form.appendChild(input) } + +export default addInput diff --git a/app/assets/javascripts/es6_browserified/reducers/index.js b/app/assets/javascripts/es6_browserified/reducers/index.js index ae8423673..aee1799aa 100644 --- a/app/assets/javascripts/es6_browserified/reducers/index.js +++ b/app/assets/javascripts/es6_browserified/reducers/index.js @@ -1,8 +1,8 @@ -var combineReducers = require('redux').combineReducers -var todos = require('./todos') +import { combineReducers } from 'redux' +import todos from './todos' const todoApp = combineReducers({ todos }) -module.exports = todoApp +export default todoApp diff --git a/app/assets/javascripts/es6_browserified/reducers/todos.js b/app/assets/javascripts/es6_browserified/reducers/todos.js index e46107efb..cf3c0cbf7 100644 --- a/app/assets/javascripts/es6_browserified/reducers/todos.js +++ b/app/assets/javascripts/es6_browserified/reducers/todos.js @@ -1,4 +1,4 @@ -var addInput = require('../form_helper').addInput +import addInput from '../form_helper' const todo = (state = {}, action, length) => { switch (action.type) { @@ -61,7 +61,14 @@ const todos = (state = [], action) => { }) ] case 'UPDATE_INPUT_VALUE': - return state.map((t, i) => (i === action.index) ? action.text : t) + return state.map( (t, i) => { + if (i === action.index) { + updateFormForDeletion(t) + return action.text + } else { + return t + } + }) // return state.map(t => // todo(t, action) // ) @@ -70,4 +77,4 @@ const todos = (state = [], action) => { } } -module.exports = todos +export default todos diff --git a/app/assets/javascripts/es6_browserified/stop_points.js b/app/assets/javascripts/es6_browserified/stop_points.js index 33af902c7..339264d51 100644 --- a/app/assets/javascripts/es6_browserified/stop_points.js +++ b/app/assets/javascripts/es6_browserified/stop_points.js @@ -1,14 +1,14 @@ -var React = require('react') -var render = require('react-dom').render -var Provider = require('react-redux').Provider -var createStore = require('redux').createStore +import React from 'react' +import { render } from 'react-dom' +import { Provider } from 'react-redux' +import { createStore } from 'redux' +import todoApp from './reducers' +import App from './components/App' +import addInput from './form_helper' // var applyMiddleware = require('redux').applyMiddleware -var todoApp = require('./reducers') -var App = require('./components/App') // var createLogger = require('redux-logger').default // var thunkMiddleware = require('redux-thunk').default // var promise = require('redux-promise') -var addInput = require('./form_helper').addInput const getInitialState = () => { let state = [] diff --git a/config/application.rb b/config/application.rb index 93a4cc8fd..e37e0a0a9 100644 --- a/config/application.rb +++ b/config/application.rb @@ -29,5 +29,14 @@ module ChouetteIhm # Configure Browserify to use babelify to compile ES6 config.browserify_rails.commandline_options = "-t [ babelify --presets [ es2015 react ] ]" + unless Rails.env.production? + # Work around sprockets+teaspoon mismatch: + Rails.application.config.assets.precompile += %w(spec_helper.js) + # Make sure Browserify is triggered when + # asked to serve javascript spec files + config.browserify_rails.paths << lambda { |p| + p.start_with?(Rails.root.join("spec/javascripts").to_s) + } + end end end diff --git a/spec/javascripts/actions_spec.js b/spec/javascripts/actions_spec.js new file mode 100644 index 000000000..43ebba77f --- /dev/null +++ b/spec/javascripts/actions_spec.js @@ -0,0 +1,52 @@ +var actions = require('es6_browserified/actions') + +describe('actions', () => { + it('should create an action to add a stop', () => { + const expectedAction = { + type: 'ADD_STOP', + } + expect(actions.addStop()).toEqual(expectedAction) + }) +}) +describe('actions', () => { + it('should create an action to move up a stop', () => { + const index = 1 + const expectedAction = { + type: 'MOVE_STOP_UP', + index + } + expect(actions.moveStopUp(index)).toEqual(expectedAction) + }) +}) +describe('actions', () => { + it('should create an action to add a stop', () => { + const index = 1 + const expectedAction = { + type: 'MOVE_STOP_DOWN', + index + } + expect(actions.moveStopDown(index)).toEqual(expectedAction) + }) +}) +describe('actions', () => { + it('should create an action to add a stop', () => { + const index = 1 + const expectedAction = { + type: 'DELETE_STOP', + index + } + expect(actions.deleteStop(index)).toEqual(expectedAction) + }) +}) +describe('actions', () => { + it('should create an action to add a stop', () => { + const text = 'updated text' + const index = 1 + const expectedAction = { + type: 'UPDATE_INPUT_VALUE', + index, + text + } + expect(actions.updateInputValue(index, text)).toEqual(expectedAction) + }) +}) diff --git a/spec/javascripts/spec_helper.js b/spec/javascripts/spec_helper.js new file mode 100644 index 000000000..71d30ff8d --- /dev/null +++ b/spec/javascripts/spec_helper.js @@ -0,0 +1,32 @@ +// Teaspoon includes some support files, but you can use anything from your own support path too. +// require support/jasmine-jquery-1.7.0 +// require support/jasmine-jquery-2.0.0 +// require support/jasmine-jquery-2.1.0 +// require support/sinon +// require support/your-support-file +// +// PhantomJS (Teaspoons default driver) doesn't have support for Function.prototype.bind, which has caused confusion. +// Use this polyfill to avoid the confusion. +//= require support/phantomjs-shims +// +// You can require your own javascript files here. By default this will include everything in application, however you +// may get better load performance if you require the specific files that are being used in the spec that tests them. +//= require application +// +// Deferring execution +// If you're using CommonJS, RequireJS or some other asynchronous library you can defer execution. Call +// Teaspoon.execute() after everything has been loaded. Simple example of a timeout: +// +// Teaspoon.defer = true +// setTimeout(Teaspoon.execute, 1000) +// +// Matching files +// By default Teaspoon will look for files that match _spec.{js,js.coffee,.coffee}. Add a filename_spec.js file in your +// spec path and it'll be included in the default suite automatically. If you want to customize suites, check out the +// configuration in teaspoon_env.rb +// +// Manifest +// If you'd rather require your spec files manually (to control order for instance) you can disable the suite matcher in +// the configuration and use this file as a manifest. +// +// For more information: http://github.com/modeset/teaspoon diff --git a/spec/teaspoon_env.rb b/spec/teaspoon_env.rb new file mode 100644 index 000000000..d9dd2cc47 --- /dev/null +++ b/spec/teaspoon_env.rb @@ -0,0 +1,186 @@ +Teaspoon.configure do |config| + # Determines where the Teaspoon routes will be mounted. Changing this to "/jasmine" would allow you to browse to + # `http://localhost:3000/jasmine` to run your tests. + config.mount_at = "/teaspoon" + + # Specifies the root where Teaspoon will look for files. If you're testing an engine using a dummy application it can + # be useful to set this to your engines root (e.g. `Teaspoon::Engine.root`). + # Note: Defaults to `Rails.root` if nil. + config.root = nil + + # Paths that will be appended to the Rails assets paths + # Note: Relative to `config.root`. + config.asset_paths = ["spec/javascripts", "spec/javascripts/stylesheets"] + + # Fixtures are rendered through a controller, which allows using HAML, RABL/JBuilder, etc. Files in these paths will + # be rendered as fixtures. + config.fixture_paths = ["spec/javascripts/fixtures"] + + # SUITES + # + # You can modify the default suite configuration and create new suites here. Suites are isolated from one another. + # + # When defining a suite you can provide a name and a block. If the name is left blank, :default is assumed. You can + # omit various directives and the ones defined in the default suite will be used. + # + # To run a specific suite + # - in the browser: http://localhost/teaspoon/[suite_name] + # - with the rake task: rake teaspoon suite=[suite_name] + # - with the cli: teaspoon --suite=[suite_name] + config.suite do |suite| + # Specify the framework you would like to use. This allows you to select versions, and will do some basic setup for + # you -- which you can override with the directives below. This should be specified first, as it can override other + # directives. + # Note: If no version is specified, the latest is assumed. + # + # Versions: 1.3.1, 2.0.3, 2.1.3, 2.2.0, 2.2.1, 2.3.4 + suite.use_framework :jasmine, "2.3.4" + + # Specify a file matcher as a regular expression and all matching files will be loaded when the suite is run. These + # files need to be within an asset path. You can add asset paths using the `config.asset_paths`. + suite.matcher = "{spec/javascripts,app/assets}/**/*_spec.{js,js.coffee,coffee}" + + # Load additional JS files, but requiring them in your spec helper is the preferred way to do this. + #suite.javascripts = [] + + # You can include your own stylesheets if you want to change how Teaspoon looks. + # Note: Spec related CSS can and should be loaded using fixtures. + #suite.stylesheets = ["teaspoon"] + + # This suites spec helper, which can require additional support files. This file is loaded before any of your test + # files are loaded. + suite.helper = "spec_helper" + + # Partial to be rendered in the head tag of the runner. You can use the provided ones or define your own by creating + # a `_boot.html.erb` in your fixtures path, and adjust the config to `"/boot"` for instance. + # + # Available: boot, boot_require_js + suite.boot_partial = "boot" + + # Partial to be rendered in the body tag of the runner. You can define your own to create a custom body structure. + suite.body_partial = "body" + + # Hooks allow you to use `Teaspoon.hook("fixtures")` before, after, or during your spec run. This will make a + # synchronous Ajax request to the server that will call all of the blocks you've defined for that hook name. + #suite.hook :fixtures, &proc{} + + # Determine whether specs loaded into the test harness should be embedded as individual script tags or concatenated + # into a single file. Similar to Rails' asset `debug: true` and `config.assets.debug = true` options. By default, + # Teaspoon expands all assets to provide more valuable stack traces that reference individual source files. + #suite.expand_assets = true + + # Non-.js file extensions Teaspoon should consider JavaScript files + #suite.js_extensions = [/(\.js)?.coffee/, /(\.js)?.es6/, ".es6.js"] + end + + # Example suite. Since we're just filtering to files already within the root test/javascripts, these files will also + # be run in the default suite -- but can be focused into a more specific suite. + #config.suite :targeted do |suite| + # suite.matcher = "spec/javascripts/targeted/*_spec.{js,js.coffee,coffee}" + #end + + # CONSOLE RUNNER SPECIFIC + # + # These configuration directives are applicable only when running via the rake task or command line interface. These + # directives can be overridden using the command line interface arguments or with ENV variables when using the rake + # task. + # + # Command Line Interface: + # teaspoon --driver=phantomjs --server-port=31337 --fail-fast=true --format=junit --suite=my_suite /spec/file_spec.js + # + # Rake: + # teaspoon DRIVER=phantomjs SERVER_PORT=31337 FAIL_FAST=true FORMATTERS=junit suite=my_suite + + # Specify which headless driver to use. Supports PhantomJS, Selenium Webdriver and BrowserStack Webdriver. + # + # Available: :phantomjs, :selenium, :browserstack, :capybara_webkit + # PhantomJS: https://github.com/modeset/teaspoon/wiki/Using-PhantomJS + # Selenium Webdriver: https://github.com/modeset/teaspoon/wiki/Using-Selenium-WebDriver + # BrowserStack Webdriver: https://github.com/modeset/teaspoon/wiki/Using-BrowserStack-WebDriver + # Capybara Webkit: https://github.com/modeset/teaspoon/wiki/Using-Capybara-Webkit + #config.driver = :phantomjs + + # Specify additional options for the driver. + # + # PhantomJS: https://github.com/modeset/teaspoon/wiki/Using-PhantomJS + # Selenium Webdriver: https://github.com/modeset/teaspoon/wiki/Using-Selenium-WebDriver + # BrowserStack Webdriver: https://github.com/modeset/teaspoon/wiki/Using-BrowserStack-WebDriver + # Capybara Webkit: https://github.com/modeset/teaspoon/wiki/Using-Capybara-Webkit + #config.driver_options = nil + + # Specify the timeout for the driver. Specs are expected to complete within this time frame or the run will be + # considered a failure. This is to avoid issues that can arise where tests stall. + #config.driver_timeout = 180 + + # Specify a server to use with Rack (e.g. thin, mongrel). If nil is provided Rack::Server is used. + #config.server = nil + + # Specify a host to run on a specific host, otherwise Teaspoon will use 127.0.0.1. + #config.server_host = nil + + # Specify a port to run on a specific port, otherwise Teaspoon will use a random available port. + #config.server_port = nil + + # Timeout for starting the server in seconds. If your server is slow to start you may have to bump this, or you may + # want to lower this if you know it shouldn't take long to start. + #config.server_timeout = 20 + + # Force Teaspoon to fail immediately after a failing suite. Can be useful to make Teaspoon fail early if you have + # several suites, but in environments like CI this may not be desirable. + #config.fail_fast = true + + # Specify the formatters to use when outputting the results. + # Note: Output files can be specified by using `"junit>/path/to/output.xml"`. + # + # Available: :dot, :clean, :documentation, :json, :junit, :pride, :rspec_html, :snowday, :swayze_or_oprah, :tap, :tap_y, :teamcity + #config.formatters = [:dot] + + # Specify if you want color output from the formatters. + #config.color = true + + # Teaspoon pipes all console[log/debug/error] to $stdout. This is useful to catch places where you've forgotten to + # remove them, but in verbose applications this may not be desirable. + #config.suppress_log = false + + # COVERAGE REPORTS / THRESHOLD ASSERTIONS + # + # Coverage reports requires Istanbul (https://github.com/gotwarlost/istanbul) to add instrumentation to your code and + # display coverage statistics. + # + # Coverage configurations are similar to suites. You can define several, and use different ones under different + # conditions. + # + # To run with a specific coverage configuration + # - with the rake task: rake teaspoon USE_COVERAGE=[coverage_name] + # - with the cli: teaspoon --coverage=[coverage_name] + + # Specify that you always want a coverage configuration to be used. Otherwise, specify that you want coverage + # on the CLI. + # Set this to "true" or the name of your coverage config. + #config.use_coverage = nil + + # You can have multiple coverage configs by passing a name to config.coverage. + # e.g. config.coverage :ci do |coverage| + # The default coverage config name is :default. + config.coverage do |coverage| + # Which coverage reports Istanbul should generate. Correlates directly to what Istanbul supports. + # + # Available: text-summary, text, html, lcov, lcovonly, cobertura, teamcity + #coverage.reports = ["text-summary", "html"] + + # The path that the coverage should be written to - when there's an artifact to write to disk. + # Note: Relative to `config.root`. + #coverage.output_path = "coverage" + + # Assets to be ignored when generating coverage reports. Accepts an array of filenames or regular expressions. The + # default excludes assets from vendor, gems and support libraries. + #coverage.ignore = [%r{/lib/ruby/gems/}, %r{/vendor/assets/}, %r{/support/}, %r{/(.+)_helper.}] + + # Various thresholds requirements can be defined, and those thresholds will be checked at the end of a run. If any + # aren't met the run will fail with a message. Thresholds can be defined as a percentage (0-100), or nil. + #coverage.statements = nil + #coverage.functions = nil + #coverage.branches = nil + #coverage.lines = nil + end +end |
