Permalink
Browse files

add heroku runner

  • Loading branch information...
1 parent e9fb28c commit 897477e4ff66c235c4ed5a73ee5b8d01bc816612 @artemave artemave committed Mar 3, 2012
Showing with 38 additions and 14 deletions.
  1. +1 −0 Gemfile
  2. +1 −0 Procfile
  3. +23 −0 bin/heroku_runner
  4. +10 −10 features/command_line_options.feature
  5. +3 −4 lib/rest-assured/config.rb
View
@@ -14,6 +14,7 @@ gem 'capybara-firebug'
gem 'rake'
gem 'mysql2'
gem 'sqlite3'
+gem 'pg'
gem 'thin'
gem 'relish'
gem "spork", "> 0.9.0.rc"
View
@@ -0,0 +1 @@
+web: bundle exec ./bin/heroku_runner
View
@@ -0,0 +1,23 @@
+#!/usr/bin/env ruby
+
+$:.push File.expand_path('../../lib', __FILE__)
+
+require 'rest-assured/config'
+require 'uri'
+
+db = URI.parse(ENV['DATABASE_URL'])
+
+opts = {
+ port: ENV['PORT'],
+ adapter: 'postgresql',
+ dbhost: db.host,
+ user: db.user,
+ dbpass: db.password,
+ database: db.path[1..-1],
+ encoding: 'utf8'
+}
+
+RestAssured::Config.build(opts)
+
+require 'rest-assured/application'
+RestAssured::Application.run!
@@ -59,16 +59,16 @@ Feature: command line options
| <dbname> | <dbuser> | <dbpass> | <dbhost> | <dbport> | <dbencoding> | <adapter> |
Examples:
- | options | dbname | dbuser | dbpass | dbhost | dbport | dbencoding | adapter |
- | | rest_assured | postgres | | | | | postgresql |
- | -d resta | resta | postgres | | | | | postgresql |
- | --database resta | resta | postgres | | | | | postgresql |
- | -u bob | rest_assured | bob | | | | | postgresql |
- | --dbuser bob | rest_assured | bob | | | | | postgresql |
- | --dbpass pswd | rest_assured | postgres | pswd | | | | postgresql |
- | --dbhost remote | rest_assured | postgres | | remote | | | postgresql |
- | --dbport 5555 | rest_assured | postgres | | | 5555 | | postgresql |
- | --dbencoding utf16le | rest_assured | postgres | | | | utf16le | postgresql |
+ | options | dbname | dbuser | dbpass | dbhost | dbport | dbencoding | adapter |
+ | | rest_assured | root | | | | | postgresql |
+ | -d resta | resta | root | | | | | postgresql |
+ | --database resta | resta | root | | | | | postgresql |
+ | -u bob | rest_assured | bob | | | | | postgresql |
+ | --dbuser bob | rest_assured | bob | | | | | postgresql |
+ | --dbpass pswd | rest_assured | root | pswd | | | | postgresql |
+ | --dbhost remote | rest_assured | root | | remote | | | postgresql |
+ | --dbport 5555 | rest_assured | root | | | 5555 | | postgresql |
+ | --dbencoding utf16le | rest_assured | root | | | | utf16le | postgresql |
Scenario Outline: use ssl option
When I start rest-assured with <option>
@@ -138,7 +138,7 @@ def self.build_db_config
:adapter => 'sqlite3',
:database => AppConfig.database || default_database
}
- elsif AppConfig.adapter =~ /postgresql|mysql/i
+ elsif AppConfig.adapter =~ /postgres|mysql/i
adapter = $&.downcase
default_database = if AppConfig.environment != 'production'
@@ -149,16 +149,15 @@ def self.build_db_config
opts = {
:adapter => 'postgresql',
- :user => AppConfig.user || 'postgres',
+ :user => AppConfig.user || 'root',
:database => AppConfig.database || default_database
}
if adapter =~ /mysql/
opts.merge!(
:adapter => 'mysql2',
:reconnect => true,
- :pool => 20,
- :user => AppConfig.user || 'root'
+ :pool => 20
)
opts[:socket] = AppConfig.dbsocket if AppConfig.dbsocket
end

0 comments on commit 897477e

Please sign in to comment.