Module: RealDataTests
- Defined in:
- lib/real_data_tests.rb,
lib/real_data_tests/engine.rb,
lib/real_data_tests/version.rb,
lib/real_data_tests/rspec_helper.rb,
lib/real_data_tests/configuration.rb,
lib/real_data_tests/data_anonymizer.rb,
lib/real_data_tests/record_collector.rb,
lib/real_data_tests/pg_dump_generator.rb,
lib/real_data_tests/test_data_builder.rb
Defined Under Namespace
Modules: RSpecHelper
Classes: Configuration, ConfigurationError, DataAnonymizer, DumpFileError, Engine, Error, PgDumpGenerator, PresetConfig, RecordCollector, TestDataBuilder
Constant Summary
collapse
- VERSION =
"0.3.17"
Class Method Summary
collapse
Class Method Details
.configuration ⇒ Object
19
20
21
|
# File 'lib/real_data_tests.rb', line 19
def configuration
@configuration ||= Configuration.new
end
|
23
24
25
26
|
# File 'lib/real_data_tests.rb', line 23
def configure
yield(configuration) if block_given?
configuration
end
|
.create_dump_file(record, name: nil) ⇒ Object
44
45
46
47
48
49
50
51
52
|
# File 'lib/real_data_tests.rb', line 44
def create_dump_file(record, name: nil)
raise ConfigurationError, "Configuration not initialized" unless @configuration
begin
TestDataBuilder.new(record, name: name).create_dump_file
rescue => e
raise DumpFileError, "Failed to create dump file: #{e.message}"
end
end
|
.env ⇒ Object
58
59
60
|
# File 'lib/real_data_tests.rb', line 58
def env
@env ||= (ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development')
end
|
.reset_configuration! ⇒ Object
28
29
30
|
# File 'lib/real_data_tests.rb', line 28
def reset_configuration!
@configuration = Configuration.new
end
|
.root ⇒ Object
54
55
56
|
# File 'lib/real_data_tests.rb', line 54
def root
File.expand_path('../..', __FILE__)
end
|
.use_preset(name) ⇒ Object
32
33
34
|
# File 'lib/real_data_tests.rb', line 32
def use_preset(name)
configuration.use_preset(name)
end
|
.with_preset(name) ⇒ Object
36
37
38
39
40
41
42
|
# File 'lib/real_data_tests.rb', line 36
def with_preset(name)
previous_preset = configuration.current_preset
configuration.use_preset(name)
yield if block_given?
ensure
configuration.current_preset = previous_preset
end
|