Skip to content

Testing

Kartones edited this page Jul 24, 2014 · 2 revisions

Testing CartoDB

Running the full testsuite

make check

This will setup the testing environment if needed, and run all WORKING_SPECS defined inside the Makefile.

This can be also used whenever you break something in the testing environment (for example if you drop a required table), just drop the carto_db_test database and it will get recreated.

Running a specific test battery

bundle exec rspec spec/models/visualization/member_spec.rb

This will run all specs found inside member_spec.rb file

Running a specific test

bundle exec rspec spec/models/visualization/member_spec.rb:15

This will run either the test/spec found around line 15 (the spec that contains that line), or the full suite from that line onwards if wasn't included in a specific spec.

Building tests for CartoDB

Requires

If you can build a unit test without any dependencies, great as it will run really fast, but in general you'll need to include the following require to make standard tests that load the DB, configuration and such:

require_relative '../../spec_helper'

Mocks, stubs and expectations

Refer to RSpec 2.x documentation.

Clone this wiki locally