audit_weasel 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7959e2a2946196d79cc052628975d4d6161475f8
4
+ data.tar.gz: c9bf245a0ee7bab30628209c0b636ca1895d4c69
5
+ SHA512:
6
+ metadata.gz: 3f67758c11b359ee9376d5d8a11c23e44c02e57e7a7ad4ac719b74ee84fcaaad53c993c04cd1c00b48a1da73d0c929053a27545de780d2128049c294fb481bfb
7
+ data.tar.gz: 74f6eee6942b0e253a8319d5114e729818897689f86bca07e625363fff1d2633e02644d5d61b66bf26cf71590627d1f0a18bd8c9556af6ab12746c3dafd10870
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,12 @@
1
+ require: rubocop-rspec
2
+
3
+ inherit_from: .rubocop_todo.yml
4
+
5
+ AllCops:
6
+ Exclude:
7
+ - 'vendor/**/*'
8
+ - 'spec/fixtures/**/*'
9
+ - 'Guardfile'
10
+ - 'audit_weasel.gemspec'
11
+ - 'lib/generators/audit_weasel/templates/*'
12
+ - 'lib/generators/install/templates/*'
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,25 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2015-11-01 21:32:53 +0200 using RuboCop version 0.34.2.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 2
10
+ # Configuration parameters: AllowURI, URISchemes.
11
+ Metrics/LineLength:
12
+ Max: 87
13
+
14
+ # Offense count: 1
15
+ # Cop supports --auto-correct.
16
+ Style/BlockComments:
17
+ Exclude:
18
+ - 'spec/spec_helper.rb'
19
+
20
+ # Offense count: 1
21
+ # Cop supports --auto-correct.
22
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
23
+ Style/TrailingBlankLines:
24
+ Exclude:
25
+ - 'Rakefile'
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.2.2
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - ruby-head
4
+ addons:
5
+ code_climate:
6
+ repo_token: f77d46750d5e66301a36c596b1e493bc5f23e5f7667748d258f3e64cc33c573c
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in audit_weasel.gemspec
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,70 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %w(app lib config test spec features) \
6
+ # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
+
8
+ ## Note: if you are using the `directories` clause above and you are not
9
+ ## watching the project directory ('.'), then you will want to move
10
+ ## the Guardfile to a watched dir and symlink it back, e.g.
11
+ #
12
+ # $ mkdir config
13
+ # $ mv Guardfile config/
14
+ # $ ln -s config/Guardfile .
15
+ #
16
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
+
18
+ # Note: The cmd option is now required due to the increasing number of ways
19
+ # rspec may be run, below are examples of the most common uses.
20
+ # * bundler: 'bundle exec rspec'
21
+ # * bundler binstubs: 'bin/rspec'
22
+ # * spring: 'bin/rspec' (This will use spring if running and you have
23
+ # installed the spring binstubs per the docs)
24
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
25
+ # * 'just' rspec: 'rspec'
26
+
27
+ guard :rspec, cmd: "bundle exec rspec" do
28
+ require "guard/rspec/dsl"
29
+ dsl = Guard::RSpec::Dsl.new(self)
30
+
31
+ # Feel free to open issues for suggestions and improvements
32
+
33
+ # RSpec files
34
+ rspec = dsl.rspec
35
+ watch(rspec.spec_helper) { rspec.spec_dir }
36
+ watch(rspec.spec_support) { rspec.spec_dir }
37
+ watch(rspec.spec_files)
38
+
39
+ # Ruby files
40
+ ruby = dsl.ruby
41
+ dsl.watch_spec_files_for(ruby.lib_files)
42
+
43
+ # Rails files
44
+ rails = dsl.rails(view_extensions: %w(erb haml slim))
45
+ dsl.watch_spec_files_for(rails.app_files)
46
+ dsl.watch_spec_files_for(rails.views)
47
+
48
+ watch(rails.controllers) do |m|
49
+ [
50
+ rspec.spec.("routing/#{m[1]}_routing"),
51
+ rspec.spec.("controllers/#{m[1]}_controller"),
52
+ rspec.spec.("acceptance/#{m[1]}")
53
+ ]
54
+ end
55
+
56
+ # Rails config changes
57
+ watch(rails.spec_helper) { rspec.spec_dir }
58
+ watch(rails.routes) { "#{rspec.spec_dir}/routing" }
59
+ watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
60
+
61
+ # Capybara features specs
62
+ watch(rails.view_dirs) { |m| rspec.spec.("features/#{m[1]}") }
63
+ watch(rails.layouts) { |m| rspec.spec.("features/#{m[1]}") }
64
+
65
+ # Turnip features and steps
66
+ watch(%r{^spec/acceptance/(.+)\.feature$})
67
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
68
+ Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
69
+ end
70
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Ryan-Neal Mes
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,88 @@
1
+ [![Code Climate](https://codeclimate.com/github/ryannealmes/audit_weasel/badges/gpa.svg)](https://codeclimate.com/github/ryannealmes/audit_weasel)
2
+ [![Build Status](https://travis-ci.org/ryannealmes/audit_weasel.svg?branch=master)](https://travis-ci.org/ryannealmes/audit_weasel.svg)
3
+ [![Test Coverage](https://codeclimate.com/github/ryannealmes/audit_weasel/badges/coverage.svg)](https://codeclimate.com/github/ryannealmes/audit_weasel/coverage)
4
+ [![Dependency Status](https://gemnasium.com/ryannealmes/audit_weasel.svg)](https://gemnasium.com/ryannealmes/audit_weasel)
5
+
6
+ # AuditWeasel
7
+
8
+ AuditWeasel is a light weight Rails auditing tool. It track changes
9
+ to database records using two fields on a table - created_by_user_id and
10
+ updated_by_user_id. It's sort of like a timestamp field, but for users.
11
+
12
+ So let's say user A updates a record, the record will have user A in the
13
+ created_by_user_id and updated_by_user_id fields. Now user B comes along and
14
+ makes a change to the record, the updated_by_user_Id will change to user B.
15
+
16
+ This is pretty handy if you don't want to burden your system with heavy
17
+ auditing, but you do want to be able to have insight into what your users
18
+ have done.
19
+
20
+ ## Installation
21
+
22
+ Add this line to your application's Gemfile:
23
+
24
+ gem 'audit_weasel'
25
+
26
+ And then execute:
27
+
28
+ $ bundle
29
+
30
+ Or install it yourself as:
31
+
32
+ $ gem install audit_weasel
33
+
34
+ ## Usage
35
+
36
+ To install audit_weasel:
37
+
38
+ ```
39
+ rails generate audit_weasel:install
40
+ ```
41
+
42
+ This will generate a config file under the initializers director. Right now
43
+ there no configuration settings, but I am looking to add a couple of things.
44
+
45
+ To audit a table:
46
+
47
+ ```
48
+ rails generate audit_weasel [table_name]
49
+ ```
50
+
51
+ This will generate migration scripts that will add created_by_user_id and
52
+ updated_by_user_id to the table. Run the migrations and you should be
53
+ good. Start making changes through your application and your should see
54
+ user ids recorded against the record being changed!
55
+
56
+ AuditWeasel depends on current_user being available at the application
57
+ controller level as that is where the active user is set. If you are using
58
+ devise things should just work. If you aren't using devise you can always
59
+ extend your application to expose a current user.
60
+
61
+ ```ruby
62
+ class ApplicationController < ActionController::Base
63
+ def current_user
64
+ # get the current user
65
+ end
66
+ end
67
+ ```
68
+
69
+ ## Contributing
70
+
71
+ 1. Fork it ( https://github.com/[my-github-username]/audit_weasel/fork )
72
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
73
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
74
+ 4. Push to the branch (`git push origin my-new-feature`)
75
+ 5. Create a new Pull Request
76
+ 6. Ensure your stuff is rubocop'd
77
+
78
+ I am always keen to learn so please feel free to create an issue with code
79
+ reviews, suggestions and possible refactorings.
80
+
81
+ ## TODOS
82
+
83
+ - Currently if the application controller does not have a `current_user`
84
+ accessible AuditWeasel will not do anything. Extend to code to allow
85
+ developers to configure the name of the method used to retrieve the current
86
+ user on the application controller.
87
+ - It would be nice to extend this to work with APIs. I am sure the concept
88
+ is pretty much the same, I just need to look at it. Feel free to make a PR.
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
7
+
8
+ task :console do
9
+ exec 'pry -r moodle -I ./lib'
10
+ end
@@ -0,0 +1,35 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'audit_weasel/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'audit_weasel'
8
+ spec.version = AuditWeasel::VERSION
9
+ spec.authors = ['Ryan-Neal Mes']
10
+ spec.email = ['ryan.mes@gmail.com']
11
+ spec.summary = %q{Keeps track of user changes.}
12
+ spec.description = %q{Uses created_by_user_id and updated_by_user_id to
13
+ store the changes made to a record. This is limited to storing the user
14
+ who created the record and the last user to update the record.}
15
+ spec.homepage = ''
16
+ spec.license = 'MIT'
17
+
18
+ spec.files = `git ls-files -z`.split("\x0")
19
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
+ spec.require_paths = ['lib']
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.6'
24
+ spec.add_development_dependency 'rake'
25
+ spec.add_development_dependency 'rspec'
26
+ spec.add_development_dependency 'sqlite3'
27
+ spec.add_development_dependency 'guard-rspec'
28
+ spec.add_development_dependency 'pry'
29
+ spec.add_development_dependency 'codeclimate-test-reporter'
30
+ spec.add_development_dependency 'rubocop'
31
+ spec.add_development_dependency 'rubocop-rspec'
32
+
33
+ spec.add_dependency 'activerecord', '>= 4.0.0'
34
+ spec.add_dependency 'activesupport', '>= 4.0.0'
35
+ end
@@ -0,0 +1,49 @@
1
+ module AuditWeasel
2
+ # Base functionality to check if a model requires auditing, get the fields
3
+ # that need to be updated and update the auditing fields with the user making
4
+ # the changes
5
+ module Base
6
+ extend ::ActiveSupport::Concern
7
+
8
+ included do
9
+ before_save :audit_user, if: proc { |model| model.new_record? || model.changed? }
10
+ end
11
+
12
+ private
13
+
14
+ def audit_user
15
+ update_fields if current_user
16
+ end
17
+
18
+ def update_fields
19
+ fields_to_update.each do |column|
20
+ column = column.to_s
21
+ self[column] = current_user.id if has_attribute?(column)
22
+ end
23
+ end
24
+
25
+ def fields_to_update
26
+ if self.new_record?
27
+ audit_fields
28
+ else
29
+ update_audit_fields
30
+ end
31
+ end
32
+
33
+ def audit_fields
34
+ create_audit_fields + update_audit_fields
35
+ end
36
+
37
+ def update_audit_fields
38
+ [:updated_by_user_id]
39
+ end
40
+
41
+ def create_audit_fields
42
+ [:created_by_user_id]
43
+ end
44
+
45
+ def current_user
46
+ RequestRegistry.current_user
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,15 @@
1
+ module AuditWeasel
2
+ # Add a global user variable for the request i.e. the user making the change
3
+ # This can be accessed anywhere in the application
4
+ module Callbacks
5
+ extend ::ActiveSupport::Concern
6
+
7
+ included do
8
+ before_action :set_user_registry
9
+ end
10
+
11
+ def set_user_registry
12
+ AuditWeasel::RequestRegistry.current_user = current_user
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ module AuditWeasel
2
+ # Load railties for auditing
3
+ class Railtie < Rails::Railtie
4
+ initializer 'active_record.add_auditing' do
5
+ ActiveSupport.on_load(:active_record) do
6
+ include AuditWeasel::Base
7
+ end
8
+ end
9
+
10
+ initializer 'action_controller.add_auditing' do
11
+ ActiveSupport.on_load(:action_controller) do
12
+ include AuditWeasel::Callbacks
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,8 @@
1
+ module AuditWeasel
2
+ # Registry to store current user which can be accessed across the application
3
+ class RequestRegistry
4
+ extend ::ActiveSupport::PerThreadRegistry
5
+
6
+ attr_accessor :current_user
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ # Gem follows symantic versioning
2
+ # http://guides.rubygems.org/patterns/#semantic-versioning
3
+ module AuditWeasel
4
+ MAJOR = 0
5
+ MINOR = 0
6
+ TINY = 1
7
+ PRE = nil
8
+
9
+ VERSION = [MAJOR, MINOR, TINY, PRE].compact.join('.')
10
+ end
@@ -0,0 +1,19 @@
1
+ require 'active_support/concern'
2
+ require 'active_support/per_thread_registry'
3
+ require 'active_record'
4
+ require 'audit_weasel/version'
5
+ require 'audit_weasel/base'
6
+ require 'audit_weasel/callbacks'
7
+ require 'audit_weasel/request_registry'
8
+ require 'audit_weasel/railtie' if defined?(Rails)
9
+
10
+ begin
11
+ require 'pry'
12
+ rescue
13
+ LoadError
14
+ end
15
+
16
+ # Load all functionality required by the gem
17
+ module AuditWeasel
18
+ # configuration to come
19
+ end
@@ -0,0 +1,25 @@
1
+ require 'rails/generators/active_record'
2
+
3
+ module AuditWeasel
4
+ module Generators
5
+ # Creates a migration script to add the
6
+ # auditing columns to the given table
7
+ class AuditWeaselGenerator < Rails::Generators::NamedBase
8
+ include Rails::Generators::Migration
9
+ extend ActiveRecord::Generators::Migration
10
+
11
+ desc 'Create a migration for a specific table to ' \
12
+ 'add the auditing columns required by audit_weasel'
13
+
14
+ source_root File.expand_path('../templates', __FILE__)
15
+
16
+ def self.next_migration_number(path)
17
+ ActiveRecord::Generators::Base.next_migration_number(path)
18
+ end
19
+
20
+ def create_audit_weasel_migration
21
+ migration_template 'migration.rb', "db/migrate/audit_weasel_#{plural_name}.rb"
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,6 @@
1
+ class <%= migration_class_name %> < ActiveRecord::Migration
2
+ def change
3
+ add_column :<%= table_name %>, :created_by_user_id, :integer
4
+ add_column :<%= table_name %>, :updated_by_user_id, :integer
5
+ end
6
+ end
@@ -0,0 +1,15 @@
1
+ module AuditWeasel
2
+ module Generators
3
+ # Creates a file under initializers which can
4
+ # be used to set configuration settings
5
+ class InstallGenerator < Rails::Generators::Base
6
+ source_root File.expand_path('../templates', __FILE__)
7
+
8
+ desc 'This generator creates an initializer file at config/initializers'
9
+
10
+ def create_initializer_file
11
+ template 'audit_weasel.rb', 'config/initializers/audit_weasel.rb'
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1 @@
1
+ # Audit weasel configuration
data/spec/base_spec.rb ADDED
@@ -0,0 +1,69 @@
1
+ require 'spec_helper'
2
+
3
+ # Tests the audit fields are updating correct.
4
+ # An in memory database is created before each test and a
5
+ # dummy model is extended with the auditing functionality.
6
+ module AuditWeasel
7
+ describe Base do
8
+ before do
9
+ ActiveRecord::Base.establish_connection(adapter: 'sqlite3',
10
+ database: ':memory:')
11
+
12
+ ActiveRecord::Schema.define do
13
+ create_table :articles do |t|
14
+ t.string :text
15
+ t.integer :created_by_user_id
16
+ t.integer :updated_by_user_id
17
+ end
18
+ end
19
+
20
+ class Article < ActiveRecord::Base
21
+ end
22
+
23
+ ActiveRecord::Base.send(:include, AuditWeasel::Base)
24
+
25
+ AuditWeasel::RequestRegistry.current_user = double(:user, id: 6)
26
+
27
+ article = Article.new(text: 'change')
28
+ article.save
29
+ end
30
+
31
+ it 'sets the created_by_user_id when creating the record' do
32
+ expect(Article.first.created_by_user_id).to eq(6)
33
+ end
34
+
35
+ it 'sets the updated_by_user_id when creating the record' do
36
+ expect(Article.first.updated_by_user_id).to eq(6)
37
+ end
38
+
39
+ it 'sets the created_by_user_id when created an empty record' do
40
+ article = Article.create
41
+ expect(article.created_by_user_id).to eq(6)
42
+ end
43
+
44
+ it 'sets the updated_by_user_id when created an empty record' do
45
+ article = Article.create
46
+ expect(article.updated_by_user_id).to eq(6)
47
+ end
48
+
49
+ it 'updates the user who updated the record' do
50
+ AuditWeasel::RequestRegistry.current_user = double(:user, id: 7)
51
+
52
+ article = Article.first
53
+ article.text = 'ping'
54
+ article.save
55
+
56
+ expect(Article.first.updated_by_user_id).to eq(7)
57
+ end
58
+
59
+ it 'does not update the created_by_user_id when updating an existing record' do
60
+ AuditWeasel::RequestRegistry.current_user = double(:user, id: 7)
61
+
62
+ article = Article.first
63
+ article.text = 'ping'
64
+ article.save
65
+
66
+ expect(article.created_by_user_id).to eq(6)
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,100 @@
1
+ require 'codeclimate-test-reporter'
2
+ CodeClimate::TestReporter.start
3
+
4
+ require 'audit_weasel'
5
+ # This file was generated by the `rspec --init` command. Conventionally, all
6
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
7
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
8
+ # this file to always be loaded, without a need to explicitly require it in any
9
+ # files.
10
+ #
11
+ # Given that it is always loaded, you are encouraged to keep this file as
12
+ # light-weight as possible. Requiring heavyweight dependencies from this file
13
+ # will add to the boot time of your test suite on EVERY test run, even for an
14
+ # individual file that may not need all of that loaded. Instead, consider making
15
+ # a separate helper file that requires the additional dependencies and performs
16
+ # the additional setup, and require it from the spec files that actually need
17
+ # it.
18
+ #
19
+ # The `.rspec` file also contains a few flags that are not defaults but that
20
+ # users commonly want.
21
+ #
22
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
23
+ RSpec.configure do |config|
24
+ # rspec-expectations config goes here. You can use an alternate
25
+ # assertion/expectation library such as wrong or the stdlib/minitest
26
+ # assertions if you prefer.
27
+ config.expect_with :rspec do |expectations|
28
+ # This option will default to `true` in RSpec 4. It makes the `description`
29
+ # and `failure_message` of custom matchers include text for helper methods
30
+ # defined using `chain`, e.g.:
31
+ # be_bigger_than(2).and_smaller_than(4).description
32
+ # # => "be bigger than 2 and smaller than 4"
33
+ # ...rather than:
34
+ # # => "be bigger than 2"
35
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
36
+ end
37
+
38
+ # rspec-mocks config goes here. You can use an alternate test double
39
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
40
+ config.mock_with :rspec do |mocks|
41
+ # Prevents you from mocking or stubbing a method that does not exist on
42
+ # a real object. This is generally recommended, and will default to
43
+ # `true` in RSpec 4.
44
+ mocks.verify_partial_doubles = true
45
+ end
46
+
47
+ # The settings below are suggested to provide a good initial experience
48
+ # with RSpec, but feel free to customize to your heart's content.
49
+ =begin
50
+ # These two settings work together to allow you to limit a spec run
51
+ # to individual examples or groups you care about by tagging them with
52
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
53
+ # get run.
54
+ config.filter_run :focus
55
+ config.run_all_when_everything_filtered = true
56
+
57
+ # Allows RSpec to persist some state between runs in order to support
58
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
59
+ # you configure your source control system to ignore this file.
60
+ config.example_status_persistence_file_path = "spec/examples.txt"
61
+
62
+ # Limits the available syntax to the non-monkey patched syntax that is
63
+ # recommended. For more details, see:
64
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
65
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
66
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
67
+ config.disable_monkey_patching!
68
+
69
+ # This setting enables warnings. It's recommended, but in some cases may
70
+ # be too noisy due to issues in dependencies.
71
+ config.warnings = true
72
+
73
+ # Many RSpec users commonly either run the entire suite or an individual
74
+ # file, and it's useful to allow more verbose output when running an
75
+ # individual spec file.
76
+ if config.files_to_run.one?
77
+ # Use the documentation formatter for detailed output,
78
+ # unless a formatter has already been configured
79
+ # (e.g. via a command-line flag).
80
+ config.default_formatter = 'doc'
81
+ end
82
+
83
+ # Print the 10 slowest examples and example groups at the
84
+ # end of the spec run, to help surface which specs are running
85
+ # particularly slow.
86
+ config.profile_examples = 10
87
+
88
+ # Run specs in random order to surface order dependencies. If you find an
89
+ # order dependency and want to debug it, you can fix the order by providing
90
+ # the seed, which is printed after each run.
91
+ # --seed 1234
92
+ config.order = :random
93
+
94
+ # Seed global randomization in this process using the `--seed` CLI option.
95
+ # Setting this allows you to use `--seed` to deterministically reproduce
96
+ # test failures related to randomization by passing the same `--seed` value
97
+ # as the one that triggered the failure.
98
+ Kernel.srand config.seed
99
+ =end
100
+ end
metadata ADDED
@@ -0,0 +1,227 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: audit_weasel
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ryan-Neal Mes
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-11-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: sqlite3
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: guard-rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: codeclimate-test-reporter
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop-rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: activerecord
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: 4.0.0
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: 4.0.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: activesupport
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: 4.0.0
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: 4.0.0
167
+ description: |-
168
+ Uses created_by_user_id and updated_by_user_id to
169
+ store the changes made to a record. This is limited to storing the user
170
+ who created the record and the last user to update the record.
171
+ email:
172
+ - ryan.mes@gmail.com
173
+ executables: []
174
+ extensions: []
175
+ extra_rdoc_files: []
176
+ files:
177
+ - ".gitignore"
178
+ - ".rspec"
179
+ - ".rubocop.yml"
180
+ - ".rubocop_todo.yml"
181
+ - ".ruby-version"
182
+ - ".travis.yml"
183
+ - Gemfile
184
+ - Guardfile
185
+ - LICENSE.txt
186
+ - README.md
187
+ - Rakefile
188
+ - audit_weasel.gemspec
189
+ - lib/audit_weasel.rb
190
+ - lib/audit_weasel/base.rb
191
+ - lib/audit_weasel/callbacks.rb
192
+ - lib/audit_weasel/railtie.rb
193
+ - lib/audit_weasel/request_registry.rb
194
+ - lib/audit_weasel/version.rb
195
+ - lib/generators/audit_weasel/audit_weasel_generator.rb
196
+ - lib/generators/audit_weasel/templates/migration.rb
197
+ - lib/generators/install/install_generator.rb
198
+ - lib/generators/install/templates/audit_weasel.rb
199
+ - spec/base_spec.rb
200
+ - spec/spec_helper.rb
201
+ homepage: ''
202
+ licenses:
203
+ - MIT
204
+ metadata: {}
205
+ post_install_message:
206
+ rdoc_options: []
207
+ require_paths:
208
+ - lib
209
+ required_ruby_version: !ruby/object:Gem::Requirement
210
+ requirements:
211
+ - - ">="
212
+ - !ruby/object:Gem::Version
213
+ version: '0'
214
+ required_rubygems_version: !ruby/object:Gem::Requirement
215
+ requirements:
216
+ - - ">="
217
+ - !ruby/object:Gem::Version
218
+ version: '0'
219
+ requirements: []
220
+ rubyforge_project:
221
+ rubygems_version: 2.4.8
222
+ signing_key:
223
+ specification_version: 4
224
+ summary: Keeps track of user changes.
225
+ test_files:
226
+ - spec/base_spec.rb
227
+ - spec/spec_helper.rb