audited-activejob 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/audited-activejob.rb +2 -0
- data/lib/audited/active_job.rb +17 -0
- data/lib/audited/active_job/version.rb +5 -0
- data/spec/spec_helper.rb +72 -0
- metadata +106 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 32b258b8dbc931a94341a85aa462d2bccfb4f4fc
|
4
|
+
data.tar.gz: b5244775f57927f659db1721ba4b7fd4eb1649c7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e4b610d463e0d17a87d1f1bfe657bafdce9a7a0d55aba1c85b560f45d2c4ef2228e7196f07f739fb5b6c219c65f4dc43f01af59ba930bb9ae9392ceb47f61349
|
7
|
+
data.tar.gz: f0bad6a05b606f169c98f9310eaeffe4c6656dbc8d8e12d9c892495e99dcaca0bcd362e55c25ffbbf3889bd126abefe78f4162f932c84b8e8c16cba09d080f54
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Audited
|
2
|
+
module ActiveJob
|
3
|
+
def self.included(base)
|
4
|
+
base.send :attr_reader, :current_user
|
5
|
+
|
6
|
+
base.send :around_perform do |job, block|
|
7
|
+
options = arguments.extract_options!
|
8
|
+
@current_user = options.delete(:current_user)
|
9
|
+
arguments << options unless options.empty?
|
10
|
+
|
11
|
+
Audited.audit_class.as_user(current_user) do
|
12
|
+
block.call
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'coveralls'
|
2
|
+
Coveralls.wear!
|
3
|
+
require 'audited-activejob'
|
4
|
+
require 'rspec'
|
5
|
+
|
6
|
+
#Dir[File.join(File.dirname(__FILE__), '..', "spec/support/**/*.rb")].each { |f| require f }
|
7
|
+
|
8
|
+
RSpec.configure do |config|
|
9
|
+
# rspec-expectations config goes here. You can use an alternate
|
10
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
11
|
+
# assertions if you prefer.
|
12
|
+
config.expect_with :rspec do |expectations|
|
13
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
14
|
+
# and `failure_message` of custom matchers include text for helper methods
|
15
|
+
# defined using `chain`, e.g.:
|
16
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
17
|
+
# # => "be bigger than 2 and smaller than 4"
|
18
|
+
# ...rather than:
|
19
|
+
# # => "be bigger than 2"
|
20
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
21
|
+
end
|
22
|
+
|
23
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
24
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
25
|
+
config.mock_with :rspec do |mocks|
|
26
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
27
|
+
# a real object. This is generally recommended, and will default to
|
28
|
+
# `true` in RSpec 4.
|
29
|
+
mocks.verify_partial_doubles = true
|
30
|
+
end
|
31
|
+
|
32
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
33
|
+
# file, and it's useful to allow more verbose output when running an
|
34
|
+
# individual spec file.
|
35
|
+
if config.files_to_run.one?
|
36
|
+
# Use the documentation formatter for detailed output,
|
37
|
+
# unless a formatter has already been configured
|
38
|
+
# (e.g. via a command-line flag).
|
39
|
+
config.default_formatter = 'doc'
|
40
|
+
end
|
41
|
+
|
42
|
+
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
43
|
+
# For more details, see:
|
44
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
45
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
46
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
47
|
+
config.disable_monkey_patching!
|
48
|
+
|
49
|
+
# Run specs in random order to surface order dependencies. If you find an
|
50
|
+
# order dependency and want to debug it, you can fix the order by providing
|
51
|
+
# the seed, which is printed after each run.
|
52
|
+
# --seed 1234
|
53
|
+
config.order = :random
|
54
|
+
|
55
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
56
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
57
|
+
# test failures related to randomization by passing the same `--seed` value
|
58
|
+
# as the one that triggered the failure.
|
59
|
+
Kernel.srand config.seed
|
60
|
+
|
61
|
+
# Print the 10 slowest examples and example groups at the
|
62
|
+
# end of the spec run, to help surface which specs are running
|
63
|
+
# particularly slow.
|
64
|
+
#config.profile_examples = 10
|
65
|
+
|
66
|
+
# These two settings work together to allow you to limit a spec run
|
67
|
+
# to individual examples or groups you care about by tagging them with
|
68
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
69
|
+
# get run.
|
70
|
+
#config.filter_run :focus
|
71
|
+
#config.run_all_when_everything_filtered = true
|
72
|
+
end
|
metadata
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: audited-activejob
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mark Rebec
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-04-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activejob
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: audited
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
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: rake
|
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: rspec
|
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
|
+
description: Pass a current_user through to your active_jobs and use it in any generated
|
70
|
+
audits
|
71
|
+
email:
|
72
|
+
- mark@markrebec.com
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- lib/audited-activejob.rb
|
78
|
+
- lib/audited/active_job.rb
|
79
|
+
- lib/audited/active_job/version.rb
|
80
|
+
- spec/spec_helper.rb
|
81
|
+
homepage: http://github.com/markrebec/audited-activejob
|
82
|
+
licenses: []
|
83
|
+
metadata: {}
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
requirements: []
|
99
|
+
rubyforge_project:
|
100
|
+
rubygems_version: 2.4.8
|
101
|
+
signing_key:
|
102
|
+
specification_version: 4
|
103
|
+
summary: Pass a current_user through to your active_jobs and use it in any generated
|
104
|
+
audits
|
105
|
+
test_files:
|
106
|
+
- spec/spec_helper.rb
|