Skip to content

Commit 7cfc106

Browse files
Add .travis.yml. Refactor multi-Rails version testing to use Gemfile. Fix Rails 4 issue in tests.
1 parent 12eccf9 commit 7cfc106

File tree

7 files changed

+23
-122
lines changed

7 files changed

+23
-122
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
test.sqlite3
22
TODO
3+
Gemfile.lock
34
*.gem

.travis.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
env:
2+
- "RAILS_VERSION=3.2.0"
3+
- "RAILS_VERSION=4.0.0"
4+
- "RAILS_VERSION=master"
15
rvm:
2-
- 1.8.7
3-
- 1.9.2
46
- 1.9.3
5-
- ree
7+
- 2.0.0

Gemfile

+13-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@ source "http://rubygems.org"
22

33
gemspec
44

5-
gem "rails", "~> 3.2.0"
5+
rails_version = ENV["RAILS_VERSION"] || "default"
6+
7+
rails = case rails_version
8+
when "master"
9+
{github: "rails/rails"}
10+
when "default"
11+
"~> 3.2.0"
12+
else
13+
"~> #{rails_version}"
14+
end
15+
16+
gem "rails", rails
617
gem 'sqlite3', '~> 1.3.3'
7-
gem 'fakeweb'
18+
gem 'fakeweb'

Gemfile.lock

-99
This file was deleted.

Rakefile

-11
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,3 @@ desc 'Test AutoHtml'
77
Rake::TestTask.new(:test) do |t|
88
t.pattern = 'test/**/*_test.rb'
99
end
10-
11-
desc 'Test with versions of Rails available on the system'
12-
task :test_with_installed do
13-
versions = `gem list rails | grep rails`.gsub("rails (", "").chop.chop.split(', ')
14-
exclude = []
15-
(versions-exclude).each do |v|
16-
puts "\n###### TESTING WITH RAILS #{v}"
17-
ENV['RAILS_VERSION'] = v
18-
Rake::Task['test'].execute
19-
end
20-
end

lib/auto_html/auto_html_for.rb

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
require 'rails'
2+
3+
require 'active_support/core_ext/module/attribute_accessors' if Rails::VERSION::MAJOR >= 4
4+
15
module AutoHtmlFor
26

37
# default options that can be overridden on the global level

test/test_helper.rb

-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
require 'rubygems'
22

3-
rails_version = ENV['RAILS_VERSION']
4-
if rails_version
5-
gem "activesupport", rails_version
6-
gem "activerecord", rails_version
7-
gem "actionpack", rails_version
8-
end
9-
103
require 'test/unit'
114
require 'active_record'
125
require 'active_support/core_ext/class'

0 commit comments

Comments
 (0)