mirror of
https://github.com/pry/pry-rails.git
synced 2022-11-09 12:36:03 -05:00
Make it easier to test server behavior with all Rails versions
This commit is contained in:
parent
aa8399d0f4
commit
99e8e07877
3 changed files with 19 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
||||||
appraise "rails30" do
|
appraise "rails30" do
|
||||||
gem "rails", "3.0.15"
|
gem "rails", "3.0.15"
|
||||||
|
gem "sqlite3"
|
||||||
end
|
end
|
||||||
|
|
||||||
appraise "rails31" do
|
appraise "rails31" do
|
||||||
|
|
22
Rakefile
22
Rakefile
|
@ -3,13 +3,25 @@ require "bundler/setup"
|
||||||
require "bundler/gem_tasks"
|
require "bundler/gem_tasks"
|
||||||
require "appraisal"
|
require "appraisal"
|
||||||
|
|
||||||
|
include FileUtils
|
||||||
|
|
||||||
desc 'Create test Rails app'
|
desc 'Create test Rails app'
|
||||||
task :init_test_app do
|
task :init_test_app => 'appraisal:install' do
|
||||||
`rm -rf test/app >/dev/null 2>&1`
|
# Remove and generate test app using Rails 3.0
|
||||||
|
rm_rf 'test/app'
|
||||||
`env BUNDLE_GEMFILE=gemfiles/rails30.gemfile bundle exec rails new test/app`
|
`env BUNDLE_GEMFILE=gemfiles/rails30.gemfile bundle exec rails new test/app`
|
||||||
FileUtils.cp("test/routes.rb", "test/app/config/routes.rb")
|
|
||||||
File.open("test/app/Gemfile", 'a+') { |f| f.write(%Q{gem "pry-rails", :path => "../../"}) }
|
# Copy test routes file into place
|
||||||
FileUtils.cd("test/app")
|
cp 'test/routes.rb', 'test/app/config/routes.rb'
|
||||||
|
|
||||||
|
# Remove rjs line from environment, since it's gone in versions >= 3.1
|
||||||
|
env_contents = File.readlines('test/app/config/environments/development.rb')
|
||||||
|
File.open('test/app/config/environments/development.rb', 'w') do |f|
|
||||||
|
f.puts env_contents.reject { |l| l =~ /rjs/ }.join("\n")
|
||||||
|
end
|
||||||
|
|
||||||
|
# Generate a few models
|
||||||
|
cd 'test/app'
|
||||||
`env BUNDLE_GEMFILE=../../gemfiles/rails30.gemfile bundle exec rails g model Pokemon name:string caught:binary species:string abilities:string`
|
`env BUNDLE_GEMFILE=../../gemfiles/rails30.gemfile bundle exec rails g model Pokemon name:string caught:binary species:string abilities:string`
|
||||||
`env BUNDLE_GEMFILE=../../gemfiles/rails30.gemfile bundle exec rails g model Hacker social_ability:integer`
|
`env BUNDLE_GEMFILE=../../gemfiles/rails30.gemfile bundle exec rails g model Hacker social_ability:integer`
|
||||||
`env BUNDLE_GEMFILE=../../gemfiles/rails30.gemfile bundle exec rails g model Beer name:string type:string rating:integer ibu:integer abv:integer`
|
`env BUNDLE_GEMFILE=../../gemfiles/rails30.gemfile bundle exec rails g model Beer name:string type:string rating:integer ibu:integer abv:integer`
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
App::Application.routes.draw do
|
App::Application.routes.draw do
|
||||||
resource :pokemon, :beer
|
resource :pokemon, :beer
|
||||||
|
get 'pry' => proc { binding.pry; [200, {}, ['']] }
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue