Skip to content

Commit

Permalink
Merge pull request activeadmin#1293 from gregbell/travis-ci
Browse files Browse the repository at this point in the history
Travis ci
  • Loading branch information
gregbell committed May 9, 2012
2 parents d112aa6 + 05c2c4d commit 9cb763a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ script: bundle exec rake
rvm:
- ree
- 1.9.2
- 1.9.3
before_install:
- gem update --system
- gem --version
env:
- RAILS=3.0.12
- RAILS=3.1.4
- RAILS=3.2.3
26 changes: 16 additions & 10 deletions spec/support/detect_rails_version.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Detects the current version of Rails that is being used
#
# You can pass it in as an ENV variable or it will use
# the current Gemfile.lock to find it

#
unless defined?(RAILS_VERSION_FILE)
RAILS_VERSION_FILE = File.expand_path("../../../.rails-version", __FILE__)
end
Expand All @@ -12,16 +10,24 @@
end

def detect_rails_version
detected_version = if File.exists?(RAILS_VERSION_FILE)
version = version_from_file || version_from_env || DEFAULT_RAILS_VERSION

puts "Detected Rails: #{version}" if ENV['DEBUG']

version
end

def version_from_file
if File.exists?(RAILS_VERSION_FILE)
version = File.read(RAILS_VERSION_FILE).chomp.strip
version != "" ? version : DEFAULT_RAILS_VERSION
else
DEFAULT_RAILS_VERSION
end
version = nil if version == ""

puts "Detected Rails: #{detected_version}" if ENV['DEBUG']
version
end
end

detected_version
def version_from_env
ENV['RAILS']
end

def write_rails_version(version)
Expand Down
2 changes: 2 additions & 0 deletions spec/support/rails_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
# Generate some test models
generate :model, "post title:string body:text published_at:datetime author_id:integer category_id:integer"
inject_into_file 'app/models/post.rb', " belongs_to :author, :class_name => 'User'\n belongs_to :category\n accepts_nested_attributes_for :author\n", :after => "class Post < ActiveRecord::Base\n"
# Rails 3.2.3 model generator declare attr_accessible
inject_into_file 'app/models/post.rb', " attr_accessible :author\n", :before => "end" if Rails::VERSION::STRING >= '3.2.3'
generate :model, "user type:string first_name:string last_name:string username:string age:integer"
inject_into_file 'app/models/user.rb', " has_many :posts, :foreign_key => 'author_id'\n", :after => "class User < ActiveRecord::Base\n"
generate :model, "publisher --migration=false --parent=User"
Expand Down
2 changes: 1 addition & 1 deletion tasks/test.rake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace :test do

desc "Run the full suite against the important versions of rails"
task :major_supported_rails do
run_tests_against "3.0.11", "3.1.3", "3.2.0"
run_tests_against "3.0.12", "3.1.4", "3.2.3"
end

desc "Alias for major_supported_rails"
Expand Down

0 comments on commit 9cb763a

Please sign in to comment.