Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .travis.yml #28

Merged
merged 5 commits into from
Mar 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
language: ruby
sudo: false
dist: trusty
cache: bundler
script: "bundle exec rake test"

rvm:
- 2.1.10
- 2.2.6
- 2.3.3
- 2.4.0

gemfile:
- gemfiles/rails_4.1.gemfile
- gemfiles/rails_4.2.gemfile
- gemfiles/rails_5.0.gemfile
- gemfiles/rails_5.1.beta.gemfile

before_install:
- gem update --system
- gem update bundler
- gem cleanup bundler

matrix:
fast_finish: true
allow_failures:
- gemfile: gemfiles/rails_5.1.beta.gemfile
exclude:
- rvm: 2.1.10
gemfile: gemfiles/rails_5.0.gemfile
- rvm: 2.1.10
gemfile: gemfiles/rails_5.1.beta.gemfile
- rvm: 2.4.0
gemfile: gemfiles/rails_4.1.gemfile
5 changes: 4 additions & 1 deletion Appraisals
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
appraise "rails-4.1" do
gem "rails", "~> 4.1.0"
gem "mysql2", ">= 0.3.13", "< 0.4"
end

appraise "rails-4.2" do
Expand All @@ -10,3 +9,7 @@ end
appraise "rails-5.0" do
gem "rails", "~> 5.0", ">= 5.0.2"
end

appraise "rails-5.1.beta" do
gem 'rails', '~> 5.1.0.beta1'
end
2 changes: 0 additions & 2 deletions acts_as_archival.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ Gem::Specification.new do |gem|
gem.add_development_dependency "appraisal"
gem.add_development_dependency "assertions-eb"
gem.add_development_dependency "database_cleaner"
gem.add_development_dependency "mysql2"
gem.add_development_dependency "pg"
gem.add_development_dependency "rake"
gem.add_development_dependency "rr"
gem.add_development_dependency "sqlite3"
Expand Down
1 change: 0 additions & 1 deletion gemfiles/rails_4.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
source "https://rubygems.org"

gem "rails", "~> 4.1.0"
gem "mysql2", ">= 0.3.13", "< 0.4"

gemspec :path => "../"
7 changes: 7 additions & 0 deletions gemfiles/rails_5.1.beta.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "~> 5.1.0.beta1"

gemspec :path => "../"
51 changes: 0 additions & 51 deletions script/db_setup

This file was deleted.

3 changes: 0 additions & 3 deletions script/setup
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,5 @@ cd "`dirname \"$0\"`/.."
echo "\n---=== Bundling ===---"
bundle install

echo "\n---=== Setting up test databases ===---"
script/db_setup

echo "\n---=== Setting up various rails versions for testing ===---"
bundle exec appraisal install
21 changes: 0 additions & 21 deletions test/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,3 @@ sqlite:
database: aaa_test.sqlite3
pool: 5
timeout: 5000

mysql:
adapter: mysql2
pool: 5
timeout: 5000
encoding: utf8
reconnect: false
database: aaa_test
username: archival_tester
password: perspicacious
socket: /tmp/mysql.sock

pg:
adapter: postgresql
pool: 5
timeout: 5000
encoding: utf8
database: aaa_test
username: archival_tester
password: perspicacious
min_messages: WARNING
10 changes: 0 additions & 10 deletions test/fixtures/mysql_archival.rb

This file was deleted.

9 changes: 0 additions & 9 deletions test/fixtures/mysql_exploder.rb

This file was deleted.

10 changes: 0 additions & 10 deletions test/fixtures/pg_archival.rb

This file was deleted.

9 changes: 0 additions & 9 deletions test/fixtures/pg_exploder.rb

This file was deleted.

136 changes: 61 additions & 75 deletions test/schema.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# Rails 4.0 and before do not deal correctly with newer versions of mysql, so we're
# gonna force a non-null primary ID for old versions of Rails just as new ones do.
if (ActiveRecord.version <=> Gem::Version.new("4.1.0")) < 0
class ActiveRecord::ConnectionAdapters::Mysql2Adapter
NATIVE_DATABASE_TYPES[:primary_key] = "int(11) auto_increment PRIMARY KEY"
end
end

ActiveRecord::Schema.define(:version => 1) do
create_table :archivals, :force => true do |t|
t.column :name, :string
Expand All @@ -20,84 +12,78 @@ class ActiveRecord::ConnectionAdapters::Mysql2Adapter
t.column :archived_at, :datetime
end

###
# The classes above are used to test database-specific
# things in PG and MySQL, and we don't need to do all
# the tests there.
if "SQLite" == ActiveRecord::Base.connection.adapter_name
create_table :archival_kids, :force => true do |t|
t.column :archival_id, :integer
t.column :archive_number, :string
t.column :archived_at, :datetime
end
create_table :archival_kids, :force => true do |t|
t.column :archival_id, :integer
t.column :archive_number, :string
t.column :archived_at, :datetime
end

create_table :archival_grandkids, :force => true do |t|
t.column :archival_kid_id, :integer
t.column :archive_number, :string
t.column :archived_at, :datetime
end
create_table :archival_grandkids, :force => true do |t|
t.column :archival_kid_id, :integer
t.column :archive_number, :string
t.column :archived_at, :datetime
end

create_table :independent_archivals, :force => true do |t|
t.column :name, :string
t.column :archival_id, :integer
t.column :archive_number, :string
t.column :archived_at, :datetime
end
create_table :independent_archivals, :force => true do |t|
t.column :name, :string
t.column :archival_id, :integer
t.column :archive_number, :string
t.column :archived_at, :datetime
end

create_table :plains, :force => true do |t|
t.column :name, :string
t.column :archival_id, :integer
end
create_table :plains, :force => true do |t|
t.column :name, :string
t.column :archival_id, :integer
end

create_table :mass_attribute_protecteds, :force => true do |t|
t.column :name, :string
t.column :archive_number, :string
t.column :archived_at, :datetime
end
create_table :mass_attribute_protecteds, :force => true do |t|
t.column :name, :string
t.column :archive_number, :string
t.column :archived_at, :datetime
end

create_table :readonly_when_archiveds, :force => true do |t|
t.column :name, :string
t.column :archive_number, :string
t.column :archived_at, :datetime
end
create_table :readonly_when_archiveds, :force => true do |t|
t.column :name, :string
t.column :archive_number, :string
t.column :archived_at, :datetime
end

create_table :missing_archived_ats, :force => true do |t|
t.column :name, :string
t.column :archive_number, :string
end
create_table :missing_archived_ats, :force => true do |t|
t.column :name, :string
t.column :archive_number, :string
end

create_table :missing_archive_numbers, :force => true do |t|
t.column :name, :string
t.column :archived_at, :datetime
end
create_table :missing_archive_numbers, :force => true do |t|
t.column :name, :string
t.column :archived_at, :datetime
end

create_table :polys, :force => true do |t|
t.references :archiveable, :polymorphic => true
t.column :archive_number, :string
t.column :archived_at, :datetime
end
create_table :polys, :force => true do |t|
t.references :archiveable, :polymorphic => true
t.column :archive_number, :string
t.column :archived_at, :datetime
end

create_table :legacy, :force => true do |t|
t.column :name, :string
t.column :archive_number, :string
t.column :archived_at, :datetime
end
create_table :legacy, :force => true do |t|
t.column :name, :string
t.column :archive_number, :string
t.column :archived_at, :datetime
end

create_table :application_record_rows, :force => true do |t|
t.column :archive_number, :string
t.column :archived_at, :datetime
end
create_table :application_record_rows, :force => true do |t|
t.column :archive_number, :string
t.column :archived_at, :datetime
end

create_table :callback_archival4s, :force => true do |t|
t.column :settable_field, :string
t.column :archive_number, :string
t.column :archived_at, :datetime
end
create_table :callback_archival4s, :force => true do |t|
t.column :settable_field, :string
t.column :archive_number, :string
t.column :archived_at, :datetime
end

create_table :callback_archival5s, :force => true do |t|
t.column :settable_field, :string
t.column :archive_number, :string
t.column :archived_at, :datetime
end
create_table :callback_archival5s, :force => true do |t|
t.column :settable_field, :string
t.column :archive_number, :string
t.column :archived_at, :datetime
end
end
12 changes: 3 additions & 9 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,9 @@ def setup_database_cleaner

def create_test_tables
schema_file = File.dirname(__FILE__) + "/schema.rb"
["pg", "mysql", "sqlite"].each do |db|
puts "** Loading schema for #{db}"
ActiveRecord::Base.establish_connection($dbconfig[db])
load(schema_file) if File.exist?(schema_file)
end
puts "** Loading schema for SQLite"
ActiveRecord::Base.establish_connection($dbconfig['sqlite'])
load(schema_file) if File.exist?(schema_file)
end

def require_test_classes
Expand All @@ -69,12 +67,8 @@ def require_test_classes
:independent_archival,
:missing_archived_at,
:missing_archive_number,
:mysql_archival,
:mysql_exploder,
:plain,
:poly,
:pg_archival,
:pg_exploder,
:readonly_when_archived
]
$require_mass_protection = ActiveModel.constants.include?(:MassAssignmentSecurity)
Expand Down
Loading