Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1293 from gregbell/travis-ci

Travis ci
  • Loading branch information...
commit 9cb763ab80742f6cf41673022eda51f2767354ee 2 parents d112aa6 + 05c2c4d
@gregbell gregbell authored
View
5 .travis.yml
@@ -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
View
26 spec/support/detect_rails_version.rb
@@ -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
@@ -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)
View
2  spec/support/rails_template.rb
@@ -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"
View
2  tasks/test.rake
@@ -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"
Please sign in to comment.
Something went wrong with that request. Please try again.