#!/bin/sh

set -ex

exec 2>&1

ruby -v
gem list

if [ -z "$AUTOPKGTEST_TMP" ]; then
  AUTOPKGTEST_TMP=$(mktemp -d)
fi
cd $AUTOPKGTEST_TMP

rails new --skip-javascript --skip-webpack-install foo
cd foo

# Does the empty app boots? This should catch dependency problems with gemspecs
rails runner 'puts "Empty Rails %s app booted correctly" % Rails.version'

# quick smoke test
rails generate scaffold Product title
rake db:migrate
rake test

