diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..50c611e88f --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ +WORKING_SPECS = \ + spec/lib \ + spec/models/layer_spec.rb \ + spec/models/tag_spec.rb \ + $(NULL) + +all: + @echo "Try make check" + +prepare-test-db: + # TODO skip this if db already exists ? + bundle exec rake db:test:prepare + +check-prepared: + bundle exec rspec $(WORKING_SPECS) + +check: prepare-test-db check-prepared + + diff --git a/TESTING b/TESTING index 333f07e3e6..5caaf81b77 100644 --- a/TESTING +++ b/TESTING @@ -1,6 +1,14 @@ Testing CartoDB =============== +Easy way +-------- + +Just run "make check". + +Detailed way +------------ + CartoDB tests are based on [Ruby Spec](http://rspec.info/). The procedure to run them is as follows: @@ -24,7 +32,8 @@ Common system configuration issues are reported in this section. Make sure test.port in config/database.yml is not pointing to pg_bouncer, as dynamically created database roles aren't easily - supported by it (you need to explicitly list allowed usernames). + supported by it (you'd need to explicitly list allowed usernames, + and over 70 new users are created during a full testsuite run). Speeding up test runs --------------------- diff --git a/spec/support/matchers/schema.rb b/spec/support/matchers/schema.rb index e0a5505278..3dd3d60a8d 100644 --- a/spec/support/matchers/schema.rb +++ b/spec/support/matchers/schema.rb @@ -57,6 +57,7 @@ RSpec::Matchers.define :pass_sql_tests do Dir.glob(glob).each do |f| testname = File.basename(f) tname = File.basename(f, '.sql') + puts "Testing #{tname}" expfile = File.dirname(f) + '/' + tname + '_expect' cmd = "#{env} psql -X -tA < #{f} #{actual.database_name} 2>&1 | diff -U2 #{expfile} - 2>&1" result = `#{cmd}`