Skip to content

Commit

Permalink
Merge pull request #658 from airblade/bug_template
Browse files Browse the repository at this point in the history
Introduce bug report template
  • Loading branch information
jaredbeck committed Nov 27, 2015
2 parents 357d4a4 + 385f3fe commit 99a01b9
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Expand Up @@ -12,6 +12,10 @@ suggestions, and especially pull requests.

Thanks, and happy (paper) trails :)

## Reporting Bugs

Please use our [bug report template][1].

## Development

Testing is a little awkward because the test suite:
Expand Down Expand Up @@ -54,3 +58,5 @@ cd ../..
# Run tests
DB=mysql bundle exec rake
```

[1]: https://github.com/airblade/paper_trail/blob/master/doc/bug_report_template.rb
65 changes: 65 additions & 0 deletions doc/bug_report_template.rb
@@ -0,0 +1,65 @@
# Use this template to report PaperTrail bugs.
# It is based on the ActiveRecord template.
# https://github.com/rails/rails/blob/master/guides/bug_report_templates/active_record_gem.rb
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end

gemfile(true) do
ruby '2.2.3'
source 'https://rubygems.org'
gem 'activerecord', '4.2.0'
gem 'minitest', '5.8.3'
gem 'paper_trail', '4.0.0', require: false
gem 'sqlite3'
end

require 'active_record'
require 'minitest/autorun'
require 'logger'
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
ActiveRecord::Base.logger = Logger.new(STDOUT)
require 'paper_trail'

ActiveRecord::Schema.define do
create_table :users, force: true do |t|
t.text :first_name, null: false
t.timestamps null: false
end
create_table :versions do |t|
t.string :item_type, null: false
t.integer :item_id, null: false
t.string :event, null: false
t.string :whodunnit
t.text :object, limit: 1_073_741_823
t.text :object_changes, limit: 1_073_741_823
t.integer :transaction_id
t.datetime :created_at
end
add_index :versions, [:item_type, :item_id]
add_index :versions, [:transaction_id]

create_table :version_associations do |t|
t.integer :version_id
t.string :foreign_key_name, null: false
t.integer :foreign_key_id
end
add_index :version_associations, [:version_id]
add_index :version_associations, [:foreign_key_name, :foreign_key_id],
name: 'index_version_associations_on_foreign_key'
end

class User < ActiveRecord::Base
has_paper_trail
end

class BugTest < ActiveSupport::TestCase
def test_1
assert_difference(-> { PaperTrail::Version.count }, +1) {
User.create(first_name: "Jane")
}
end
end

0 comments on commit 99a01b9

Please sign in to comment.