Skip to content

Commit

Permalink
Test against MongoDB 3.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
brianhempel committed Mar 30, 2015
1 parent 7bd37ae commit d29c4d9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@ matrix:
- rvm: jruby-head
- rvm: ruby-head
- rvm: rbx-2.2.9
services:
- mongodb
before_script:
- wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.1.tgz -O /tmp/mongodb.tgz
- tar -xvf /tmp/mongodb.tgz
- mkdir /tmp/data
- ${PWD}/mongodb-linux-x86_64-3.0.1/bin/mongod --dbpath /tmp/data --bind_ip 127.0.0.1 &> /dev/null &
15 changes: 8 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@ gemspec :name => 'mongo_session_store-rails4'

group :development, :test do
gem 'rake'
if ENV['MONGO_SESSION_STORE_ORM'] == 'mongo_mapper'
gem 'mongo_mapper', '>= 0.13.1'
end

if ENV['MONGO_SESSION_STORE_ORM'] == 'mongoid'
case ENV['MONGO_SESSION_STORE_ORM']
when 'mongo_mapper'
gem 'mongo_mapper', '>= 0.13.1'
when 'mongoid'
if ENV['RAILS_VERS'] =~ /^4\.\d/
gem 'mongoid', '>= 4.0.2'
elsif ENV['RAILS_VERS'] =~ /^3\.2\d/
gem 'mongoid', '>= 3.1.0'
else
gem 'mongoid', '>= 3.0.0'
end
end

if ENV['MONGO_SESSION_STORE_ORM'] == 'mongo'
when 'mongo'
gem 'mongo'
else
gem 'mongo' # So rake test_all can wait for Mongo to start
end

gem 'pry'
Expand All @@ -50,6 +50,7 @@ group :development, :test do
else
gem 'sqlite3' # for devise User storage
end

if RAILS_VERS
gem 'rails', RAILS_VERS
else
Expand Down
16 changes: 16 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@ desc 'Test each session store against Rails 3.1, 3.2, 4.0, 4.1, and 4.2'
task :test_all do
# inspired by http://pivotallabs.com/users/jdean/blog/articles/1728-testing-your-gem-against-multiple-rubies-and-rails-versions-with-rvm

# Wait for mongod to start on Travis.
# From the Mongo Ruby Driver gem.
if ENV['TRAVIS']
require 'mongo'
client = Mongo::Client.new(['127.0.0.1:27017'])
begin
puts "Waiting for MongoDB..."
client.command(Mongo::Server::Monitor::STATUS)
rescue Mongo::ServerSelector::NoServerAvailable => e
sleep(2)
# 1 Retry
puts "Waiting for MongoDB..."
client.cluster.scan!
client.command(Mongo::ServerSelector::NoServerAvailable)
end
end

@failed_suites = []

Expand Down

0 comments on commit d29c4d9

Please sign in to comment.