Skip to content

Commit

Permalink
Merge pull request #14 from cartodb-org/feature/travis
Browse files Browse the repository at this point in the history
Add initial travis.yml file
  • Loading branch information
Andrew Fink committed Feb 16, 2016
2 parents 7ead651 + 8ef49e7 commit d674508
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 74 deletions.
67 changes: 10 additions & 57 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,18 @@
cache: false
language: node_js
node_js:
- "0.10"
before_install:
- lsb_release -a
- sudo mv /etc/apt/sources.list.d/pgdg-source.list* /tmp
- sudo apt-get -qq purge postgis* postgresql*
- sudo rm -Rf /var/lib/postgresql /etc/postgresql
- sudo apt-add-repository --yes ppa:cartodb/postgresql-9.3
- sudo apt-add-repository --yes ppa:cartodb/gis
- sudo apt-get update
- sudo apt-get install gdal-bin libgdal1-dev python-gdal
- sudo apt-get install postgresql-9.3-postgis-2.1 postgresql-plpython-9.3
- sudo apt-get install postgis
- sudo apt-get install -q unp zip ruby1.9.3 ruby1.9.1-dev python-pip ruby-rspec libicu-dev
- sudo apt-get install postgresql-contrib-9.3
- echo -e "local\tall\tall\ttrust\nhost\tall\tall\t127.0.0.1/32\ttrust\nhost\tall\tall\t::1/128\ttrust" |sudo tee /etc/postgresql/9.3/main/pg_hba.conf
- sudo service postgresql restart
- sudo su postgres -c "createdb template_postgis"
- echo "SELECT VERSION();" | sudo su postgres -c "psql template_postgis"
- sudo su postgres -c "echo 'CREATE EXTENSION postgis;' | psql template_postgis"
- sudo su postgres -c "echo 'SELECT POSTGIS_FULL_VERSION();' | psql template_postgis"
# Needed to build PostgreSQL extensions
- sudo apt-get install postgresql-server-dev-9.3
# Install schema_triggers
- hg clone https://bitbucket.org/malloclabs/pg_schema_triggers &&
cd pg_schema_triggers && make && sudo make install && cd -
# Preload schema_triggers module
# NOTE: might change if we make it part of the installcheck instead
- echo "shared_preload_libraries = 'schema_triggers.so'" |
sudo tee -a /etc/postgresql/9.3/main/postgresql.conf &&
sudo service postgresql restart
# Install cartodb-postgresql from the submodule dir
- cd lib/sql
- make all && sudo make install
- PGUSER=postgres make installcheck || cat regression.diffs
- cd -

before_script:
- npm install -g grunt-cli
- "4.1"

install:
- gdal-config --version
- ruby --version
- sudo gem install bundler
# http://stackoverflow.com/questions/10916784/error-installing-debugger-linecache-in-ruby-1-9-3
- gem install debugger-linecache -v '1.1.2' -- --with-ruby-include=$rvm_path/src/ruby-1.9.3-p484/
- bundle install
- cp config/app_config.yml.testing config/app_config.yml
- cp config/database.yml.sample config/database.yml
# Needs fixing first some tests:
#- cp services/importer/spec/factories/database.json.sample services/importer/spec/factories/database.json
- cat python_requirements.txt | grep -v gdal | sudo pip install -r /dev/stdin
- npm install

script:
- make travis
before_script:
- npm install -g grunt-cli

env:
script:
- grunt test

#notifications:
# irc:
# channels:
# - "irc.freenode.org#cartodb"
# use_notice: true
notifications:
email:
on_success: never
on_failure: change
42 changes: 25 additions & 17 deletions lib/assets/test/spec/cartodb/models/filters.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ describe('modules.Filters', function() {
});

describe('FilterDiscrete', function() {
var model, model2, table, hist, stub;
var model, model2, model3, table, hist, stub;

beforeEach(function() {

Expand Down Expand Up @@ -364,6 +364,11 @@ describe('modules.Filters', function() {
}, {
bucket: 'test3',
selected: false
}],
operations: [{
operation: 'CONTAINS',
operator: 'OR',
text: 'test1'
}]
});

Expand All @@ -379,7 +384,16 @@ describe('modules.Filters', function() {
}, {
bucket: 'test3',
selected: true
}]
}],
operations: []
});

model3 = new cdb.admin.models.FilterDiscrete({
table: table,
column: 'c',
list_view: false,
items: [ ],
operations: []
});

});
Expand All @@ -395,25 +409,16 @@ describe('modules.Filters', function() {

});

it("should return SQL with free_text", function() {
model.set({ free_text: "Valladolid", list_view : false });

var sql = model.getSQLCondition();
expect(model.get("column")).toEqual("c");
expect(sql).toEqual("c ILIKE '%Valladolid%' ");
});

it("shouldn't return a free_text query in list_view mode", function() {
model.set({ free_text: "Valladolid", list_view : true });
it("shouldn't return an operations query in list_view mode", function() {
model.set({ list_view : true });

var sql = model.getSQLCondition();
expect(model.get("column")).toEqual("c");
expect(sql).toEqual("c IN ('test1','test2') ");
});

it("should return a valid SQL when free_text is empty", function() {
model.set({ free_text: "", list_view : false });
var sql = model.getSQLCondition();
it("should return a valid SQL when operations is empty", function() {
var sql = model3.getSQLCondition();
expect(sql).toEqual(" (true) ");
});

Expand All @@ -438,7 +443,8 @@ describe('modules.Filters', function() {
items: [{
bucket: 'test',
selected: false
}]
}],
operations: []
});

hist = {};
Expand All @@ -461,7 +467,9 @@ describe('modules.Filters', function() {
{ bucket: 'test2', selected: true },
{ bucket: 'test3', selected: false }
],
free_text : undefined,
operations: [
{ operation: 'CONTAINS', operator: 'OR', text: 'test1' }
],
column_type : undefined,
list_view : true
});
Expand Down

0 comments on commit d674508

Please sign in to comment.