attr_masker 0.1.0 → 0.3.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 +5 -5
- data/.github/workflows/tests.yml +91 -0
- data/.gitignore +5 -1
- data/.rubocop.yml +13 -1069
- data/CHANGELOG.adoc +31 -0
- data/Gemfile +5 -0
- data/README.adoc +81 -30
- data/Rakefile +0 -27
- data/attr_masker.gemspec +15 -10
- data/bin/console +14 -0
- data/bin/rake +29 -0
- data/bin/rspec +29 -0
- data/bin/rubocop +29 -0
- data/bin/setup +9 -0
- data/gemfiles/Rails-4.2.gemfile +2 -3
- data/gemfiles/Rails-5.0.gemfile +2 -3
- data/gemfiles/Rails-5.1.gemfile +2 -3
- data/gemfiles/Rails-5.2.gemfile +4 -0
- data/gemfiles/Rails-6.0.gemfile +3 -0
- data/gemfiles/Rails-6.1.gemfile +3 -0
- data/gemfiles/Rails-head.gemfile +1 -3
- data/gemfiles/common.gemfile +4 -0
- data/lib/attr_masker.rb +6 -210
- data/lib/attr_masker/attribute.rb +80 -0
- data/lib/attr_masker/error.rb +1 -0
- data/lib/attr_masker/maskers/replacing.rb +20 -3
- data/lib/attr_masker/maskers/simple.rb +20 -5
- data/lib/attr_masker/model.rb +143 -0
- data/lib/attr_masker/performer.rb +56 -17
- data/lib/attr_masker/version.rb +1 -16
- data/lib/tasks/db.rake +13 -4
- data/spec/dummy/app/models/non_persisted_model.rb +2 -0
- data/spec/dummy/config/attr_masker.rb +1 -0
- data/spec/dummy/config/mongoid.yml +33 -0
- data/spec/dummy/config/routes.rb +0 -1
- data/spec/dummy/db/schema.rb +1 -0
- data/spec/features/active_record_spec.rb +97 -0
- data/spec/features/mongoid_spec.rb +36 -0
- data/spec/features/shared_examples.rb +382 -0
- data/spec/spec_helper.rb +26 -3
- data/spec/support/00_control_constants.rb +2 -0
- data/spec/support/10_mongoid_env.rb +9 -0
- data/spec/support/20_combustion.rb +10 -0
- data/spec/support/db_cleaner.rb +13 -2
- data/spec/support/force_config_file_reload.rb +9 -0
- data/spec/support/rake.rb +1 -1
- data/spec/unit/attribute_spec.rb +210 -0
- data/spec/{maskers → unit/maskers}/replacing_spec.rb +0 -0
- data/spec/{maskers → unit/maskers}/simple_spec.rb +2 -2
- data/spec/unit/model_spec.rb +12 -0
- data/spec/unit/rake_task_spec.rb +30 -0
- metadata +139 -32
- data/.travis.yml +0 -32
- data/gemfiles/Rails-4.0.gemfile +0 -5
- data/gemfiles/Rails-4.1.gemfile +0 -5
- data/spec/features_spec.rb +0 -203
- data/spec/support/0_combustion.rb +0 -5
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,35 @@
|
|
1
1
|
# (c) 2017 Ribose Inc.
|
2
2
|
#
|
3
3
|
|
4
|
+
# Warnings gem must be added to Gemfile or otherwise loaded in order to have
|
5
|
+
# the following configuration in effect.
|
6
|
+
#
|
7
|
+
# TODO: Add Warning to gemspec or Gemfile after dropping support for Ruby 2.3.
|
8
|
+
begin
|
9
|
+
require "warning"
|
10
|
+
|
11
|
+
# Deduplicate warnings
|
12
|
+
Warning.dedup
|
13
|
+
|
14
|
+
# Ignore all warnings in Gem dependencies
|
15
|
+
Gem.path.each do |path|
|
16
|
+
Warning.ignore(//, path)
|
17
|
+
end
|
18
|
+
rescue LoadError
|
19
|
+
end
|
20
|
+
|
21
|
+
require "simplecov"
|
22
|
+
SimpleCov.start
|
23
|
+
|
24
|
+
if ENV.key?("CI")
|
25
|
+
require "codecov"
|
26
|
+
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
27
|
+
end
|
28
|
+
|
4
29
|
require "bundler"
|
5
30
|
Bundler.require :default, :development
|
6
31
|
|
7
|
-
Dir[File.expand_path "
|
32
|
+
Dir[File.expand_path "support/**/*.rb", __dir__].sort.each { |f| require f }
|
8
33
|
|
9
34
|
RSpec.configure do |config|
|
10
35
|
# Enable flags like --only-failures and --next-failure
|
@@ -17,5 +42,3 @@ RSpec.configure do |config|
|
|
17
42
|
c.syntax = :expect
|
18
43
|
end
|
19
44
|
end
|
20
|
-
|
21
|
-
require "rails/all"
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# Copied from Mongoid's test suite
|
2
|
+
# https://github.com/mongodb/mongoid/blob/v6.2.0/spec/spec_helper.rb
|
3
|
+
|
4
|
+
# These environment variables can be set if wanting to test against a database
|
5
|
+
# that is not on the local machine.
|
6
|
+
ENV["MONGOID_SPEC_HOST"] ||= "127.0.0.1"
|
7
|
+
ENV["MONGOID_SPEC_PORT"] ||= "27017"
|
8
|
+
|
9
|
+
require "mongoid" unless WITHOUT_MONGOID
|
data/spec/support/db_cleaner.rb
CHANGED
@@ -2,9 +2,20 @@ require "database_cleaner"
|
|
2
2
|
|
3
3
|
RSpec.configure do |config|
|
4
4
|
config.before(:suite) do
|
5
|
-
|
5
|
+
unless WITHOUT_ACTIVE_RECORD
|
6
|
+
require "database_cleaner-active_record"
|
7
|
+
DatabaseCleaner[:active_record].strategy = :truncation
|
8
|
+
end
|
6
9
|
|
7
|
-
|
10
|
+
# Since models are defined dynamically in specs, Database Cleaner is unable
|
11
|
+
# to list them and to determine collection names to be cleaned.
|
12
|
+
# Therefore, they are specified explicitly here.
|
13
|
+
unless WITHOUT_MONGOID
|
14
|
+
require "database_cleaner-mongoid"
|
15
|
+
DatabaseCleaner[:mongoid].strategy = :truncation, { only: "users" }
|
16
|
+
end
|
17
|
+
|
18
|
+
DatabaseCleaner.clean_with(:truncation)
|
8
19
|
end
|
9
20
|
|
10
21
|
config.around(:each) do |example|
|
@@ -0,0 +1,9 @@
|
|
1
|
+
RSpec.configure do |config|
|
2
|
+
config.before(:each, :force_config_file_reload) do
|
3
|
+
config_path = Rails.root.join("config", "attr_masker.rb").to_s
|
4
|
+
# $" holds names of source files which have been loaded already.
|
5
|
+
# Removing a path from that list causes given file to be loaded
|
6
|
+
# again at next #require call.
|
7
|
+
$".delete(config_path)
|
8
|
+
end
|
9
|
+
end
|
data/spec/support/rake.rb
CHANGED
@@ -0,0 +1,210 @@
|
|
1
|
+
# (c) 2017 Ribose Inc.
|
2
|
+
#
|
3
|
+
|
4
|
+
require "spec_helper"
|
5
|
+
|
6
|
+
RSpec.describe AttrMasker::Attribute do
|
7
|
+
describe "::new" do
|
8
|
+
subject { described_class.method :new }
|
9
|
+
|
10
|
+
it "instantiates a new attribute definition" do
|
11
|
+
opts = { arbitrary: :options }
|
12
|
+
retval = subject.call(:some_attr, :some_model, opts)
|
13
|
+
expect(retval.name).to eq(:some_attr)
|
14
|
+
expect(retval.model).to eq(:some_model)
|
15
|
+
expect(retval.options).to eq(opts)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "#column_names" do
|
20
|
+
subject { receiver.method :column_names }
|
21
|
+
let(:receiver) { described_class.new :some_attr, :some_model, options }
|
22
|
+
let(:options) { {} }
|
23
|
+
|
24
|
+
it "defaults to array containing attribute name only" do
|
25
|
+
expect(subject.call).to contain_exactly(:some_attr)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "can be overriden with :column_names option" do
|
29
|
+
options[:column_names] = :some_column
|
30
|
+
expect(subject.call).to eq(:some_column)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "#should_mask?" do
|
35
|
+
subject { described_class.instance_method :should_mask? }
|
36
|
+
|
37
|
+
let(:model_instance) { double }
|
38
|
+
let(:truthy) { double call: true }
|
39
|
+
let(:falsey) { double call: false }
|
40
|
+
|
41
|
+
example { expect(retval_for_opts({})).to be(true) }
|
42
|
+
example { expect(retval_for_opts(if: truthy)).to be(true) }
|
43
|
+
example { expect(retval_for_opts(if: falsey)).to be(false) }
|
44
|
+
example { expect(retval_for_opts(unless: truthy)).to be(false) }
|
45
|
+
example { expect(retval_for_opts(unless: falsey)).to be(true) }
|
46
|
+
example { expect(retval_for_opts(if: truthy, unless: truthy)).to be(false) }
|
47
|
+
example { expect(retval_for_opts(if: truthy, unless: falsey)).to be(true) }
|
48
|
+
example { expect(retval_for_opts(if: falsey, unless: truthy)).to be(false) }
|
49
|
+
example { expect(retval_for_opts(if: falsey, unless: falsey)).to be(false) }
|
50
|
+
|
51
|
+
def retval_for_opts(opts)
|
52
|
+
receiver = described_class.new(:some_attr, :some_model, opts)
|
53
|
+
callable = subject.bind(receiver)
|
54
|
+
callable.(model_instance)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "mask" do
|
59
|
+
subject { described_class.instance_method :mask }
|
60
|
+
let(:receiver) { described_class.new :some_attr, :some_model, options }
|
61
|
+
let(:model_instance) { Struct.new(:some_attr).new("value") }
|
62
|
+
let(:options) { { masker: masker } }
|
63
|
+
let(:masker) { ->(**) { "masked_value" } }
|
64
|
+
|
65
|
+
it "takes the instance.options[:masker] and calls it" do
|
66
|
+
expect(masker).to receive(:call)
|
67
|
+
subject.bind(receiver).call(model_instance)
|
68
|
+
end
|
69
|
+
|
70
|
+
it "passes the unmarshalled attribute value to the masker" do
|
71
|
+
expect(receiver).to receive(:unmarshal_data).
|
72
|
+
with("value").and_return("unmarshalled_value")
|
73
|
+
expect(masker).to receive(:call).
|
74
|
+
with(hash_including(value: "unmarshalled_value"))
|
75
|
+
subject.bind(receiver).call(model_instance)
|
76
|
+
end
|
77
|
+
|
78
|
+
it "passes the model instance to the masker" do
|
79
|
+
expect(masker).to receive(:call).
|
80
|
+
with(hash_including(model: model_instance))
|
81
|
+
subject.bind(receiver).call(model_instance)
|
82
|
+
end
|
83
|
+
|
84
|
+
it "passes the attribute name to the masker" do
|
85
|
+
expect(masker).to receive(:call).
|
86
|
+
with(hash_including(attribute_name: :some_attr))
|
87
|
+
subject.bind(receiver).call(model_instance)
|
88
|
+
end
|
89
|
+
|
90
|
+
it "passes the masking options to the masker" do
|
91
|
+
expect(masker).to receive(:call).
|
92
|
+
with(hash_including(masking_options: options))
|
93
|
+
subject.bind(receiver).call(model_instance)
|
94
|
+
end
|
95
|
+
|
96
|
+
it "marshals the masked value, and assigns it to the attribute" do
|
97
|
+
expect(receiver).to receive(:marshal_data).
|
98
|
+
with("masked_value").and_return("marshalled_masked_value")
|
99
|
+
subject.bind(receiver).call(model_instance)
|
100
|
+
expect(model_instance.some_attr).to eq("marshalled_masked_value")
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
describe "#masked_attributes_new_values" do
|
105
|
+
subject { receiver.method :masked_attributes_new_values }
|
106
|
+
let(:receiver) { described_class.new :some_attr, :some_model, options }
|
107
|
+
let(:options) { {} }
|
108
|
+
let(:model_instance) { double } # Struct.new(:some_attr, :other_attr) }
|
109
|
+
let(:changes) { { some_attr: [nil, "new"], other_attr: [nil, "other"] } }
|
110
|
+
|
111
|
+
before { allow(model_instance).to receive(:changes).and_return(changes) }
|
112
|
+
|
113
|
+
# rubocop:disable Style/BracesAroundHashParameters
|
114
|
+
# We are comparing hashes here, and we want hash literals
|
115
|
+
it "returns a hash of required database updates which include masked field \
|
116
|
+
change, but ignores other attribute changes" do
|
117
|
+
expect(subject.(model_instance)).to eq({ some_attr: "new" })
|
118
|
+
end
|
119
|
+
|
120
|
+
it "returns an emtpy hash for an unchanged object" do
|
121
|
+
changes.clear
|
122
|
+
expect(subject.(model_instance)).to eq({})
|
123
|
+
end
|
124
|
+
|
125
|
+
it "allows overriding column/field name to be updated with column_name \
|
126
|
+
option" do
|
127
|
+
options[:column_names] = %i[other_attr]
|
128
|
+
expect(subject.(model_instance)).to eq({ other_attr: "other" })
|
129
|
+
end
|
130
|
+
|
131
|
+
it "allows specifying more than one column/field name to be updated \
|
132
|
+
with column_name option" do
|
133
|
+
options[:column_names] = %i[some_attr other_attr]
|
134
|
+
expect(subject.(model_instance)).
|
135
|
+
to eq({ some_attr: "new", other_attr: "other" })
|
136
|
+
end
|
137
|
+
# rubocop:enable Style/BracesAroundHashParameters
|
138
|
+
end
|
139
|
+
|
140
|
+
describe "#evaluate_option" do
|
141
|
+
subject { receiver.method :evaluate_option }
|
142
|
+
let(:receiver) { described_class.new :some_attr, model_instance, options }
|
143
|
+
let(:options) { {} }
|
144
|
+
let(:model_instance) { double }
|
145
|
+
let(:retval) { subject.call(:option_name, model_instance) }
|
146
|
+
|
147
|
+
context "when that option value is a symbol" do
|
148
|
+
let(:options) { { option_name: :meth } }
|
149
|
+
|
150
|
+
before do
|
151
|
+
allow(model_instance).to receive(:meth).with(no_args).and_return(:rv)
|
152
|
+
end
|
153
|
+
|
154
|
+
it "evaluates an object's method pointed by that symbol" do
|
155
|
+
expect(retval).to be(:rv)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
context "when that option_nameion value responds to #call" do
|
160
|
+
let(:options) { { option_name: callable } }
|
161
|
+
let(:callable) { double }
|
162
|
+
|
163
|
+
before do
|
164
|
+
allow(callable).to receive(:call).with(model_instance).and_return(:rv)
|
165
|
+
end
|
166
|
+
|
167
|
+
it "calls #call on it passing model instance as the only argument" do
|
168
|
+
expect(retval).to be(:rv)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
describe "#marshal_data" do
|
174
|
+
subject { receiver.method :marshal_data }
|
175
|
+
let(:receiver) { described_class.new :some_attr, model_instance, options }
|
176
|
+
let(:options) { { marshaler: marshaller, dump_method: :dump_m } }
|
177
|
+
let(:marshaller) { double }
|
178
|
+
let(:model_instance) { double }
|
179
|
+
|
180
|
+
it "returns unmodified argument when marshal option is falsey" do
|
181
|
+
options[:marshal] = false
|
182
|
+
expect(subject.call(:data)).to be(:data)
|
183
|
+
end
|
184
|
+
|
185
|
+
it "returns unmodified argument when marshal option is falsey" do
|
186
|
+
options[:marshal] = true
|
187
|
+
expect(marshaller).to receive(:dump_m).with(:data).and_return(:retval)
|
188
|
+
expect(subject.call(:data)).to be(:retval)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
describe "#unmarshal_data" do
|
193
|
+
subject { receiver.method :unmarshal_data }
|
194
|
+
let(:receiver) { described_class.new :some_attr, model_instance, options }
|
195
|
+
let(:options) { { marshaler: marshaller, load_method: :load_m } }
|
196
|
+
let(:marshaller) { double }
|
197
|
+
let(:model_instance) { double }
|
198
|
+
|
199
|
+
it "returns unmodified argument when marshal option is falsey" do
|
200
|
+
options[:marshal] = false
|
201
|
+
expect(subject.call(:data)).to be(:data)
|
202
|
+
end
|
203
|
+
|
204
|
+
it "returns unmodified argument when marshal option is falsey" do
|
205
|
+
options[:marshal] = true
|
206
|
+
expect(marshaller).to receive(:load_m).with(:data).and_return(:retval)
|
207
|
+
expect(subject.call(:data)).to be(:retval)
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
File without changes
|
@@ -5,8 +5,8 @@
|
|
5
5
|
|
6
6
|
require "spec_helper"
|
7
7
|
|
8
|
-
RSpec.describe AttrMasker::Maskers::
|
9
|
-
subject { described_class }
|
8
|
+
RSpec.describe AttrMasker::Maskers::Simple do
|
9
|
+
subject { described_class.new }
|
10
10
|
|
11
11
|
example { expect(subject.(value: "Solo")).to eq("(redacted)") }
|
12
12
|
example { expect(subject.(value: Math::PI)).to eq("(redacted)") }
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# (c) 2017 Ribose Inc.
|
2
|
+
#
|
3
|
+
|
4
|
+
require "spec_helper"
|
5
|
+
|
6
|
+
RSpec.describe AttrMasker::Model do
|
7
|
+
it "extends every class and provides class methods" do
|
8
|
+
c = Class.new
|
9
|
+
expect(c).to respond_to(:attr_masker)
|
10
|
+
expect(c.singleton_class.included_modules).to include(described_class)
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# (c) 2017 Ribose Inc.
|
2
|
+
#
|
3
|
+
|
4
|
+
require "spec_helper"
|
5
|
+
|
6
|
+
RSpec.describe "db:mask", :suppress_progressbar do
|
7
|
+
subject { Rake::Task["db:mask"] }
|
8
|
+
|
9
|
+
let(:config_file_path) do
|
10
|
+
File.expand_path("../dummy/config/attr_masker.rb", __dir__)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "loads all application's models eagerly" do
|
14
|
+
expect(Rails.application).to receive(:eager_load!)
|
15
|
+
subject.execute
|
16
|
+
expect(defined? NonPersistedModel).to be_truthy
|
17
|
+
end
|
18
|
+
|
19
|
+
it "loads configuration file if it exists", :force_config_file_reload do
|
20
|
+
allow(File).to receive(:file?).and_call_original
|
21
|
+
allow(File).to receive(:file?).with(config_file_path).and_return(true)
|
22
|
+
expect { subject.execute }.to change { $CONFIG_LOADED_AT }
|
23
|
+
end
|
24
|
+
|
25
|
+
it "works without configuration file", :force_config_file_reload do
|
26
|
+
allow(File).to receive(:file?).and_call_original
|
27
|
+
allow(File).to receive(:file?).with(config_file_path).and_return(false)
|
28
|
+
expect { subject.execute }.not_to change { $CONFIG_LOADED_AT }
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attr_masker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: 4.0.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '7'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: 4.0.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '7'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: ruby-progressbar
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -48,14 +48,14 @@ dependencies:
|
|
48
48
|
name: bundler
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - "
|
51
|
+
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '1.15'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- - "
|
58
|
+
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '1.15'
|
61
61
|
- !ruby/object:Gem::Dependency
|
@@ -64,28 +64,70 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
67
|
+
version: '1.0'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
74
|
+
version: '1.0'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: database_cleaner
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '1.
|
81
|
+
version: '1.8'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '1.8'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: database_cleaner-active_record
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '1.8'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '1.8'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: database_cleaner-mongoid
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '1.8'
|
82
110
|
type: :development
|
83
111
|
prerelease: false
|
84
112
|
version_requirements: !ruby/object:Gem::Requirement
|
85
113
|
requirements:
|
86
114
|
- - "~>"
|
87
115
|
- !ruby/object:Gem::Version
|
88
|
-
version: '1.
|
116
|
+
version: '1.8'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: mongoid
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '5'
|
124
|
+
type: :development
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '5'
|
89
131
|
- !ruby/object:Gem::Dependency
|
90
132
|
name: pry
|
91
133
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,14 +146,14 @@ dependencies:
|
|
104
146
|
name: rspec
|
105
147
|
requirement: !ruby/object:Gem::Requirement
|
106
148
|
requirements:
|
107
|
-
- - "
|
149
|
+
- - "~>"
|
108
150
|
- !ruby/object:Gem::Version
|
109
151
|
version: '3.0'
|
110
152
|
type: :development
|
111
153
|
prerelease: false
|
112
154
|
version_requirements: !ruby/object:Gem::Requirement
|
113
155
|
requirements:
|
114
|
-
- - "
|
156
|
+
- - "~>"
|
115
157
|
- !ruby/object:Gem::Version
|
116
158
|
version: '3.0'
|
117
159
|
- !ruby/object:Gem::Dependency
|
@@ -120,28 +162,62 @@ dependencies:
|
|
120
162
|
requirements:
|
121
163
|
- - "~>"
|
122
164
|
- !ruby/object:Gem::Version
|
123
|
-
version: 0.
|
165
|
+
version: 0.54.0
|
124
166
|
type: :development
|
125
167
|
prerelease: false
|
126
168
|
version_requirements: !ruby/object:Gem::Requirement
|
127
169
|
requirements:
|
128
170
|
- - "~>"
|
129
171
|
- !ruby/object:Gem::Version
|
130
|
-
version: 0.
|
172
|
+
version: 0.54.0
|
173
|
+
- !ruby/object:Gem::Dependency
|
174
|
+
name: simplecov
|
175
|
+
requirement: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '0'
|
180
|
+
type: :development
|
181
|
+
prerelease: false
|
182
|
+
version_requirements: !ruby/object:Gem::Requirement
|
183
|
+
requirements:
|
184
|
+
- - ">="
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '0'
|
131
187
|
- !ruby/object:Gem::Dependency
|
132
188
|
name: sqlite3
|
133
189
|
requirement: !ruby/object:Gem::Requirement
|
134
190
|
requirements:
|
135
|
-
- - "
|
191
|
+
- - ">="
|
136
192
|
- !ruby/object:Gem::Version
|
137
193
|
version: 1.3.13
|
194
|
+
- - "<"
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
version: '2'
|
138
197
|
type: :development
|
139
198
|
prerelease: false
|
140
199
|
version_requirements: !ruby/object:Gem::Requirement
|
141
200
|
requirements:
|
142
|
-
- - "
|
201
|
+
- - ">="
|
143
202
|
- !ruby/object:Gem::Version
|
144
203
|
version: 1.3.13
|
204
|
+
- - "<"
|
205
|
+
- !ruby/object:Gem::Version
|
206
|
+
version: '2'
|
207
|
+
- !ruby/object:Gem::Dependency
|
208
|
+
name: warning
|
209
|
+
requirement: !ruby/object:Gem::Requirement
|
210
|
+
requirements:
|
211
|
+
- - "~>"
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: '1.1'
|
214
|
+
type: :development
|
215
|
+
prerelease: false
|
216
|
+
version_requirements: !ruby/object:Gem::Requirement
|
217
|
+
requirements:
|
218
|
+
- - "~>"
|
219
|
+
- !ruby/object:Gem::Version
|
220
|
+
version: '1.1'
|
145
221
|
description: It is desired to mask certain attributes of certain models by modifying
|
146
222
|
the database.
|
147
223
|
email:
|
@@ -151,49 +227,70 @@ extensions: []
|
|
151
227
|
extra_rdoc_files: []
|
152
228
|
files:
|
153
229
|
- ".editorconfig"
|
230
|
+
- ".github/workflows/tests.yml"
|
154
231
|
- ".gitignore"
|
155
232
|
- ".hound.yml"
|
156
233
|
- ".rspec"
|
157
234
|
- ".rubocop.yml"
|
158
|
-
-
|
235
|
+
- CHANGELOG.adoc
|
159
236
|
- Gemfile
|
160
237
|
- LICENSE
|
161
238
|
- README.adoc
|
162
239
|
- Rakefile
|
163
240
|
- attr_masker.gemspec
|
241
|
+
- bin/console
|
242
|
+
- bin/rake
|
243
|
+
- bin/rspec
|
244
|
+
- bin/rubocop
|
245
|
+
- bin/setup
|
164
246
|
- config.ru
|
165
|
-
- gemfiles/Rails-4.0.gemfile
|
166
|
-
- gemfiles/Rails-4.1.gemfile
|
167
247
|
- gemfiles/Rails-4.2.gemfile
|
168
248
|
- gemfiles/Rails-5.0.gemfile
|
169
249
|
- gemfiles/Rails-5.1.gemfile
|
250
|
+
- gemfiles/Rails-5.2.gemfile
|
251
|
+
- gemfiles/Rails-6.0.gemfile
|
252
|
+
- gemfiles/Rails-6.1.gemfile
|
170
253
|
- gemfiles/Rails-head.gemfile
|
254
|
+
- gemfiles/common.gemfile
|
171
255
|
- lib/attr_masker.rb
|
256
|
+
- lib/attr_masker/attribute.rb
|
172
257
|
- lib/attr_masker/error.rb
|
173
258
|
- lib/attr_masker/maskers/replacing.rb
|
174
259
|
- lib/attr_masker/maskers/simple.rb
|
260
|
+
- lib/attr_masker/model.rb
|
175
261
|
- lib/attr_masker/performer.rb
|
176
262
|
- lib/attr_masker/railtie.rb
|
177
263
|
- lib/attr_masker/version.rb
|
178
264
|
- lib/tasks/db.rake
|
265
|
+
- spec/dummy/app/models/non_persisted_model.rb
|
266
|
+
- spec/dummy/config/attr_masker.rb
|
179
267
|
- spec/dummy/config/database.yml
|
268
|
+
- spec/dummy/config/mongoid.yml
|
180
269
|
- spec/dummy/config/routes.rb
|
181
270
|
- spec/dummy/db/schema.rb
|
182
271
|
- spec/dummy/public/favicon.ico
|
183
|
-
- spec/
|
184
|
-
- spec/
|
185
|
-
- spec/
|
272
|
+
- spec/features/active_record_spec.rb
|
273
|
+
- spec/features/mongoid_spec.rb
|
274
|
+
- spec/features/shared_examples.rb
|
186
275
|
- spec/spec_helper.rb
|
187
|
-
- spec/support/
|
276
|
+
- spec/support/00_control_constants.rb
|
277
|
+
- spec/support/10_mongoid_env.rb
|
278
|
+
- spec/support/20_combustion.rb
|
188
279
|
- spec/support/db_cleaner.rb
|
280
|
+
- spec/support/force_config_file_reload.rb
|
189
281
|
- spec/support/matchers.rb
|
190
282
|
- spec/support/rake.rb
|
191
283
|
- spec/support/silence_stdout.rb
|
284
|
+
- spec/unit/attribute_spec.rb
|
285
|
+
- spec/unit/maskers/replacing_spec.rb
|
286
|
+
- spec/unit/maskers/simple_spec.rb
|
287
|
+
- spec/unit/model_spec.rb
|
288
|
+
- spec/unit/rake_task_spec.rb
|
192
289
|
homepage: https://github.com/riboseinc/attr_masker
|
193
290
|
licenses:
|
194
291
|
- MIT
|
195
292
|
metadata: {}
|
196
|
-
post_install_message:
|
293
|
+
post_install_message:
|
197
294
|
rdoc_options: []
|
198
295
|
require_paths:
|
199
296
|
- lib
|
@@ -208,22 +305,32 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
305
|
- !ruby/object:Gem::Version
|
209
306
|
version: '0'
|
210
307
|
requirements: []
|
211
|
-
|
212
|
-
|
213
|
-
signing_key:
|
308
|
+
rubygems_version: 3.2.3
|
309
|
+
signing_key:
|
214
310
|
specification_version: 4
|
215
311
|
summary: Masking attributes
|
216
312
|
test_files:
|
313
|
+
- spec/dummy/app/models/non_persisted_model.rb
|
314
|
+
- spec/dummy/config/attr_masker.rb
|
217
315
|
- spec/dummy/config/database.yml
|
316
|
+
- spec/dummy/config/mongoid.yml
|
218
317
|
- spec/dummy/config/routes.rb
|
219
318
|
- spec/dummy/db/schema.rb
|
220
319
|
- spec/dummy/public/favicon.ico
|
221
|
-
- spec/
|
222
|
-
- spec/
|
223
|
-
- spec/
|
320
|
+
- spec/features/active_record_spec.rb
|
321
|
+
- spec/features/mongoid_spec.rb
|
322
|
+
- spec/features/shared_examples.rb
|
224
323
|
- spec/spec_helper.rb
|
225
|
-
- spec/support/
|
324
|
+
- spec/support/00_control_constants.rb
|
325
|
+
- spec/support/10_mongoid_env.rb
|
326
|
+
- spec/support/20_combustion.rb
|
226
327
|
- spec/support/db_cleaner.rb
|
328
|
+
- spec/support/force_config_file_reload.rb
|
227
329
|
- spec/support/matchers.rb
|
228
330
|
- spec/support/rake.rb
|
229
331
|
- spec/support/silence_stdout.rb
|
332
|
+
- spec/unit/attribute_spec.rb
|
333
|
+
- spec/unit/maskers/replacing_spec.rb
|
334
|
+
- spec/unit/maskers/simple_spec.rb
|
335
|
+
- spec/unit/model_spec.rb
|
336
|
+
- spec/unit/rake_task_spec.rb
|