Skip to content

Commit

Permalink
Test Ruby on Rails 5.1, Ruby 2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
domcleal committed Mar 27, 2017
1 parent de1064a commit 8b81f3a
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Expand Up @@ -4,6 +4,7 @@ rvm:
- 2.1
- 2.2.4
- 2.3.1
- 2.4.1
- ruby-head
env:
- DB=SQLITE
Expand All @@ -16,12 +17,19 @@ gemfile:
- gemfiles/rails41.gemfile
- gemfiles/rails42.gemfile
- gemfiles/rails50.gemfile
- gemfiles/rails51.gemfile
matrix:
allow_failures:
- rvm: ruby-head
exclude:
- rvm: 2.1
gemfile: gemfiles/rails50.gemfile
- rvm: 2.1
gemfile: gemfiles/rails51.gemfile
- rvm: 2.4.1
gemfile: gemfiles/rails40.gemfile
- rvm: 2.4.1
gemfile: gemfiles/rails41.gemfile
fast_finish: true
branches:
only:
Expand Down
4 changes: 4 additions & 0 deletions Appraisals
Expand Up @@ -17,3 +17,7 @@ end
appraise 'rails50' do
gem 'rails', '~> 5.0.0'
end

appraise 'rails51' do
gem 'rails', '>= 5.1.0.rc1', '< 5.2'
end
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -3,7 +3,7 @@ Audited [![Build Status](https://secure.travis-ci.org/collectiveidea/audited.svg

**Audited** (previously acts_as_audited) is an ORM extension that logs all changes to your models. Audited can also record who made those changes, save comments and associate models related to the changes.

Audited currently (4.x) works with Rails 5.0 and 4.2. It may work with 4.1 and 4.0, but this is not guaranteed.
Audited currently (4.x) works with Rails 5.1, 5.0 and 4.2. It may work with 4.1 and 4.0, but this is not guaranteed.

For Rails 3, use gem version 3.0 or see the [3.0-stable branch](https://github.com/collectiveidea/audited/tree/3.0-stable).

Expand All @@ -14,6 +14,7 @@ Audited supports and is [tested against](http://travis-ci.org/collectiveidea/aud
* 2.1.5
* 2.2.4
* 2.3.1
* 2.4.1

Audited may work just fine with a Ruby version not listed above, but we can't guarantee that it will. If you'd like to maintain a Ruby that isn't listed, please let us know with a [pull request](https://github.com/collectiveidea/audited/pulls).

Expand Down
7 changes: 7 additions & 0 deletions gemfiles/rails51.gemfile
@@ -0,0 +1,7 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", ">= 5.1.0.rc1", "< 5.2"

gemspec :name => "audited", :path => "../"
2 changes: 1 addition & 1 deletion spec/audited/sweeper_spec.rb
Expand Up @@ -76,7 +76,7 @@ def update
controller.send(:current_user=, user)

expect {
put :update, id: 123
put :update, Rails::VERSION::MAJOR == 4 ? {id: 123} : {params: {id: 123}}
}.to_not change( Audited::Audit, :count )
end
end
Expand Down
1 change: 1 addition & 0 deletions spec/support/active_record/models.rb
Expand Up @@ -15,6 +15,7 @@ def name=(val)

class UserOnlyPassword < ::ActiveRecord::Base
self.table_name = :users
attribute :non_column_attr if Rails.version >= '5.1'
audited allow_mass_assignment: true, only: :password
end

Expand Down
@@ -1,4 +1,5 @@
class ChangeAuditedChangesTypeToJson < ActiveRecord::Migration
parent = Rails::VERSION::MAJOR == 4 ? ActiveRecord::Migration : ActiveRecord::Migration[4.2]
class ChangeAuditedChangesTypeToJson < parent
def self.up
remove_column :audits, :audited_changes
add_column :audits, :audited_changes, :json
Expand Down
@@ -1,4 +1,5 @@
class ChangeAuditedChangesTypeToJsonb < ActiveRecord::Migration
parent = Rails::VERSION::MAJOR == 4 ? ActiveRecord::Migration : ActiveRecord::Migration[4.2]
class ChangeAuditedChangesTypeToJsonb < parent
def self.up
remove_column :audits, :audited_changes
add_column :audits, :audited_changes, :jsonb
Expand Down
6 changes: 5 additions & 1 deletion test/upgrade_generator_test.rb
Expand Up @@ -6,7 +6,11 @@ class UpgradeGeneratorTest < Rails::Generators::TestCase
destination File.expand_path('../../tmp', __FILE__)
setup :prepare_destination
tests Audited::Generators::UpgradeGenerator
self.use_transactional_fixtures = false
if Rails::VERSION::MAJOR == 4
self.use_transactional_fixtures = false
else
self.use_transactional_tests = false
end

test "should add 'comment' to audits table" do
load_schema 1
Expand Down

0 comments on commit 8b81f3a

Please sign in to comment.