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
|
||||
gem "rails", "3.0.15"
|
||||
gem "sqlite3"
|
||||
end
|
||||
|
||||
appraise "rails31" do
|
||||
|
|
22
Rakefile
22
Rakefile
|
@ -3,13 +3,25 @@ require "bundler/setup"
|
|||
require "bundler/gem_tasks"
|
||||
require "appraisal"
|
||||
|
||||
include FileUtils
|
||||
|
||||
desc 'Create test Rails app'
|
||||
task :init_test_app do
|
||||
`rm -rf test/app >/dev/null 2>&1`
|
||||
task :init_test_app => 'appraisal:install' do
|
||||
# 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`
|
||||
FileUtils.cp("test/routes.rb", "test/app/config/routes.rb")
|
||||
File.open("test/app/Gemfile", 'a+') { |f| f.write(%Q{gem "pry-rails", :path => "../../"}) }
|
||||
FileUtils.cd("test/app")
|
||||
|
||||
# Copy test routes file into place
|
||||
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 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`
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
App::Application.routes.draw do
|
||||
resource :pokemon, :beer
|
||||
get 'pry' => proc { binding.pry; [200, {}, ['']] }
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue