notifiably_audited 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/audited/adapters/active_record/audit.rb +69 -0
- data/lib/audited/adapters/active_record.rb +15 -0
- data/lib/audited-activerecord.rb +2 -0
- data/lib/generators/audited/install_generator.rb +28 -0
- data/lib/generators/audited/templates/add_association_to_audits.rb +11 -0
- data/lib/generators/audited/templates/add_comment_to_audits.rb +9 -0
- data/lib/generators/audited/templates/add_remote_address_to_audits.rb +10 -0
- data/lib/generators/audited/templates/install.rb +35 -0
- data/lib/generators/audited/templates/rename_association_to_associated.rb +23 -0
- data/lib/generators/audited/templates/rename_changes_to_audited_changes.rb +9 -0
- data/lib/generators/audited/templates/rename_parent_to_association.rb +11 -0
- data/lib/generators/audited/upgrade_generator.rb +63 -0
- metadata +24 -157
- data/.gitignore +0 -17
- data/Appraisals +0 -11
- data/CHANGELOG +0 -34
- data/Gemfile +0 -3
- data/LICENSE.txt +0 -22
- data/README.md +0 -234
- data/Rakefile +0 -24
- data/audited-activerecord.gemspec +0 -21
- data/audited-mongo_mapper.gemspec +0 -21
- data/audited.gemspec +0 -27
- data/gemfiles/rails30.gemfile +0 -7
- data/gemfiles/rails31.gemfile +0 -7
- data/gemfiles/rails32.gemfile +0 -7
- data/lib/audited/audit.rb +0 -115
- data/lib/audited/auditor.rb +0 -449
- data/lib/audited/rspec_matchers.rb +0 -173
- data/lib/audited/sweeper.rb +0 -51
- data/lib/audited.rb +0 -15
- data/lib/notifiably_audited/version.rb +0 -3
- data/lib/notifiably_audited.rb +0 -15
- data/notifiably_audited.gemspec +0 -23
- data/spec/audited_spec_helpers.rb +0 -31
- data/spec/rails_app/config/application.rb +0 -5
- data/spec/rails_app/config/database.yml +0 -24
- data/spec/rails_app/config/environment.rb +0 -5
- data/spec/rails_app/config/environments/development.rb +0 -19
- data/spec/rails_app/config/environments/production.rb +0 -33
- data/spec/rails_app/config/environments/test.rb +0 -33
- data/spec/rails_app/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/rails_app/config/initializers/inflections.rb +0 -2
- data/spec/rails_app/config/initializers/secret_token.rb +0 -2
- data/spec/rails_app/config/routes.rb +0 -6
- data/spec/spec_helper.rb +0 -23
- data/spec/support/active_record/models.rb +0 -84
- data/spec/support/active_record/schema.rb +0 -54
- data/spec/support/mongo_mapper/connection.rb +0 -4
- data/spec/support/mongo_mapper/models.rb +0 -210
- data/test/db/version_1.rb +0 -17
- data/test/db/version_2.rb +0 -18
- data/test/db/version_3.rb +0 -19
- data/test/db/version_4.rb +0 -20
- data/test/db/version_5.rb +0 -18
- data/test/install_generator_test.rb +0 -17
- data/test/test_helper.rb +0 -19
- data/test/upgrade_generator_test.rb +0 -65
data/test/db/version_5.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
ActiveRecord::Schema.define do
|
2
|
-
create_table :audits, :force => true do |t|
|
3
|
-
t.column :auditable_id, :integer
|
4
|
-
t.column :auditable_type, :string
|
5
|
-
t.column :user_id, :integer
|
6
|
-
t.column :user_type, :string
|
7
|
-
t.column :username, :string
|
8
|
-
t.column :action, :string
|
9
|
-
t.column :audited_changes, :text
|
10
|
-
t.column :version, :integer, :default => 0
|
11
|
-
t.column :comment, :string
|
12
|
-
t.column :created_at, :datetime
|
13
|
-
t.column :remote_address, :string
|
14
|
-
t.column :association_id, :integer
|
15
|
-
t.column :association_type, :string
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
require 'generators/audited/install_generator'
|
4
|
-
|
5
|
-
class InstallGeneratorTest < Rails::Generators::TestCase
|
6
|
-
destination File.expand_path('../../tmp', __FILE__)
|
7
|
-
setup :prepare_destination
|
8
|
-
tests Audited::Generators::InstallGenerator
|
9
|
-
|
10
|
-
test "should generate a migration" do
|
11
|
-
run_generator %w(install)
|
12
|
-
|
13
|
-
assert_migration "db/migrate/install_audited.rb" do |content|
|
14
|
-
assert_match /class InstallAudited/, content
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
data/test/test_helper.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
ENV['RAILS_ENV'] = 'test'
|
2
|
-
|
3
|
-
$:.unshift File.dirname(__FILE__)
|
4
|
-
|
5
|
-
require File.expand_path('../../spec/rails_app/config/environment', __FILE__)
|
6
|
-
require 'rails/test_help'
|
7
|
-
|
8
|
-
require 'audited'
|
9
|
-
|
10
|
-
class ActiveSupport::TestCase
|
11
|
-
|
12
|
-
setup do
|
13
|
-
ActiveRecord::Migration.verbose = false
|
14
|
-
end
|
15
|
-
|
16
|
-
def load_schema( version )
|
17
|
-
load File.dirname(__FILE__) + "/db/version_#{version}.rb"
|
18
|
-
end
|
19
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
require 'generators/audited/upgrade_generator'
|
4
|
-
|
5
|
-
class UpgradeGeneratorTest < Rails::Generators::TestCase
|
6
|
-
destination File.expand_path('../../tmp', __FILE__)
|
7
|
-
setup :prepare_destination
|
8
|
-
tests Audited::Generators::UpgradeGenerator
|
9
|
-
|
10
|
-
test "should add 'comment' to audits table" do
|
11
|
-
load_schema 1
|
12
|
-
|
13
|
-
run_generator %w(upgrade)
|
14
|
-
|
15
|
-
assert_migration "db/migrate/add_comment_to_audits.rb" do |content|
|
16
|
-
assert_match /add_column :audits, :comment, :string/, content
|
17
|
-
end
|
18
|
-
|
19
|
-
assert_migration "db/migrate/rename_changes_to_audited_changes.rb"
|
20
|
-
end
|
21
|
-
|
22
|
-
test "should rename 'changes' to 'audited_changes'" do
|
23
|
-
load_schema 2
|
24
|
-
|
25
|
-
run_generator %w(upgrade)
|
26
|
-
|
27
|
-
assert_no_migration "db/migrate/add_comment_to_audits.rb"
|
28
|
-
|
29
|
-
assert_migration "db/migrate/rename_changes_to_audited_changes.rb" do |content|
|
30
|
-
assert_match /rename_column :audits, :changes, :audited_changes/, content
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
test "should add a 'remote_address' to audits table" do
|
35
|
-
load_schema 3
|
36
|
-
|
37
|
-
run_generator %w(upgrade)
|
38
|
-
|
39
|
-
assert_migration "db/migrate/add_remote_address_to_audits.rb" do |content|
|
40
|
-
assert_match /add_column :audits, :remote_address, :string/, content
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
test "should add 'association_id' and 'association_type' to audits table" do
|
45
|
-
load_schema 4
|
46
|
-
|
47
|
-
run_generator %w(upgrade)
|
48
|
-
|
49
|
-
assert_migration "db/migrate/add_association_to_audits.rb" do |content|
|
50
|
-
assert_match /add_column :audits, :association_id, :integer/, content
|
51
|
-
assert_match /add_column :audits, :association_type, :string/, content
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
test "should rename 'association_id' to 'associated_id' and 'association_type' to 'associated_type'" do
|
56
|
-
load_schema 5
|
57
|
-
|
58
|
-
run_generator %w(upgrade)
|
59
|
-
|
60
|
-
assert_migration "db/migrate/rename_association_to_associated.rb" do |content|
|
61
|
-
assert_match /rename_column :audits, :association_id, :associated_id/, content
|
62
|
-
assert_match /rename_column :audits, :association_type, :associated_type/, content
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|