Skip to content

Commit

Permalink
Merge branch '87-get-travis-working'
Browse files Browse the repository at this point in the history
  • Loading branch information
marnen committed Aug 9, 2013
2 parents 5283e46 + 589447b commit 51c6ec9
Show file tree
Hide file tree
Showing 14 changed files with 81 additions and 258 deletions.
2 changes: 2 additions & 0 deletions .rspec.travis
@@ -0,0 +1,2 @@
--colour
--format progress
10 changes: 10 additions & 0 deletions .travis.yml
@@ -0,0 +1,10 @@
language: ruby
rvm:
- 1.9.3
bundler_args: --without development
services: postgresql
before_install:
- gem update --system 1.8.25 # since ZenTest needs ~> 1.8
- gem --version
before_script: ./ci/before_script.sh
script: rake ci
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -44,10 +44,10 @@ gem 'exception_notification'
group :development do
gem 'rvm-capistrano'
gem 'gettext', '>= 1.9.3', :require => false
gem 'ruby-debug19'
end

group :test, :development do
gem 'ruby-debug19'
gem 'autotest-rails', :require => false
gem 'rspec-rails', '~> 2.11.0', :require => false
gem 'test-unit', '1.2.3', :require => false # amazingly, RSpec needs this
Expand Down
256 changes: 0 additions & 256 deletions README

This file was deleted.

5 changes: 5 additions & 0 deletions README.md
@@ -0,0 +1,5 @@
[![Build Status](https://travis-ci.org/marnen/quorum2.png?branch=master)](https://travis-ci.org/marnen/quorum2)

# Quorum Calendar System

This is the Quorum Calendar System, an easy-to-use solution for collaborative scheduling. For more information, please see http://quorum2.sf.net.
3 changes: 3 additions & 0 deletions ci/before_script.sh
@@ -0,0 +1,3 @@
#!/usr/bin/env sh
./ci/install_postgis.sh
./ci/create_config_files.sh
24 changes: 24 additions & 0 deletions ci/create_config_files.sh
@@ -0,0 +1,24 @@
#!/usr/bin/env sh
warn () {
printf >&2 "$*"
}

warn 'Setting up config files... '
cat >config/database.yml <<EOF
test:
adapter: postgis
database: quorum2_test
username: postgres
encoding: UTF8
EOF
warn 'config/database.yml '

cp config/config-orig.yml config/config.yml
warn 'config/config.yml '

cat >config/initializers/secret_token.rb 2>/dev/null <<EOF
Quorum2::Application.config.secret_token = '`bundle exec rake secret`'
EOF
warn 'config/initializers/secret_token.rb '

warn "done\n"
11 changes: 11 additions & 0 deletions ci/install_postgis.sh
@@ -0,0 +1,11 @@
#!/usr/bin/env sh

# PostGIS installation stuff from https://github.com/geoalchemy/geoalchemy2/pull/43/files
# TODO: this could really use some refinement

echo >&2 'Installing PostGIS...'
sudo apt-add-repository -y ppa:sharpie/for-science
sudo apt-add-repository -y ppa:sharpie/postgis-nightly
sudo apt-get update
sudo apt-get install postgresql-9.1-postgis -q
echo >&2 'PostGIS installed!'
6 changes: 5 additions & 1 deletion features/support/additional_cucumber_setup.rb
@@ -1,6 +1,10 @@
# coding: UTF-8

require 'ruby-debug'
begin
require 'ruby-debug'
rescue LoadError
warn 'Failed to load ruby-debug; continuing without it...'
end

# Set Gettext stuff so we can load Web pages.
FastGettext.text_domain ||= SITE_TITLE
Expand Down
15 changes: 15 additions & 0 deletions lib/tasks/ci.rake
@@ -0,0 +1,15 @@
namespace :db do
desc 'Install PostGIS in the database'
task install_postgis: :environment do
ActiveRecord::Base.connection.execute 'CREATE EXTENSION postgis;'
end

desc 'Create database and load PostGIS and schema'
task setup_with_postgis: %w(db:create db:install_postgis db:schema:load)
end

desc 'Run CI tests (intended for Travis)'
task ci: 'db:setup_with_postgis' do
sh 'bundle exec rspec -O .rspec.travis'
sh 'bundle exec cucumber'
end
1 change: 1 addition & 0 deletions spec/helpers/events_helper_spec.rb
Expand Up @@ -4,6 +4,7 @@

describe EventsHelper do
before(:each) do
User.delete_all # TODO: why is this necessary?
@event = FactoryGirl.create :event
end

Expand Down
2 changes: 2 additions & 0 deletions spec/models/commitment_spec.rb
Expand Up @@ -15,6 +15,8 @@
describe Commitment, "(validations)" do
let(:commitment) { FactoryGirl.create :commitment, event: FactoryGirl.create(:event), user: FactoryGirl.create(:user) }

before(:each) { User.delete_all } # TODO: why is this necessary?

it "should not be valid without an event" do
commitment.should be_valid
commitment.event_id = nil
Expand Down
1 change: 1 addition & 0 deletions spec/views/events/_attendance.html.haml_spec.rb
Expand Up @@ -8,6 +8,7 @@

describe 'events/_attendance' do
before(:each) do
User.delete_all # TODO: why is this necessary?
render :partial => 'events/attendance', :locals => {:event => FactoryGirl.create(:event)}
end

Expand Down
1 change: 1 addition & 0 deletions spec/views/events/_event.html.haml_spec.rb
Expand Up @@ -9,6 +9,7 @@
describe 'events/_event' do
before(:each) do
Role.destroy_all(:name => 'admin')
User.destroy_all # TODO: why is this necessary?
@event = FactoryGirl.create :event, :description => 'Testing use of *Markdown*.'
@user = FactoryGirl.create :user
[User, view].each {|x| x.stub!(:current_user).and_return @user }
Expand Down

0 comments on commit 51c6ec9

Please sign in to comment.