test_data 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/CHANGELOG.md +2 -0
  4. data/Gemfile +10 -0
  5. data/Gemfile.lock +104 -0
  6. data/LICENSE.txt +25 -0
  7. data/README.md +35 -0
  8. data/Rakefile +11 -0
  9. data/bin/console +14 -0
  10. data/bin/setup +8 -0
  11. data/example/.gitattributes +8 -0
  12. data/example/.gitignore +24 -0
  13. data/example/Gemfile +19 -0
  14. data/example/Gemfile.lock +211 -0
  15. data/example/README.md +24 -0
  16. data/example/Rakefile +6 -0
  17. data/example/app/assets/config/manifest.js +2 -0
  18. data/example/app/assets/stylesheets/application.css +15 -0
  19. data/example/app/controllers/application_controller.rb +2 -0
  20. data/example/app/controllers/boops_controller.rb +10 -0
  21. data/example/app/helpers/application_helper.rb +2 -0
  22. data/example/app/models/application_record.rb +3 -0
  23. data/example/app/models/boop.rb +2 -0
  24. data/example/app/views/boops/index.html.erb +8 -0
  25. data/example/app/views/layouts/application.html.erb +15 -0
  26. data/example/bin/bundle +114 -0
  27. data/example/bin/rails +4 -0
  28. data/example/bin/rake +4 -0
  29. data/example/bin/setup +33 -0
  30. data/example/config.ru +6 -0
  31. data/example/config/application.rb +35 -0
  32. data/example/config/boot.rb +4 -0
  33. data/example/config/credentials.yml.enc +1 -0
  34. data/example/config/database.yml +86 -0
  35. data/example/config/environment.rb +5 -0
  36. data/example/config/environments/development.rb +60 -0
  37. data/example/config/environments/production.rb +96 -0
  38. data/example/config/environments/test.rb +49 -0
  39. data/example/config/initializers/application_controller_renderer.rb +8 -0
  40. data/example/config/initializers/backtrace_silencers.rb +8 -0
  41. data/example/config/initializers/content_security_policy.rb +28 -0
  42. data/example/config/initializers/cookies_serializer.rb +5 -0
  43. data/example/config/initializers/filter_parameter_logging.rb +6 -0
  44. data/example/config/initializers/inflections.rb +16 -0
  45. data/example/config/initializers/mime_types.rb +4 -0
  46. data/example/config/initializers/permissions_policy.rb +11 -0
  47. data/example/config/initializers/wrap_parameters.rb +14 -0
  48. data/example/config/locales/en.yml +33 -0
  49. data/example/config/puma.rb +43 -0
  50. data/example/config/routes.rb +5 -0
  51. data/example/db/migrate/20210417143158_create_boops.rb +7 -0
  52. data/example/db/schema.rb +21 -0
  53. data/example/db/seeds.rb +11 -0
  54. data/example/public/404.html +67 -0
  55. data/example/public/422.html +67 -0
  56. data/example/public/500.html +66 -0
  57. data/example/public/apple-touch-icon-precomposed.png +0 -0
  58. data/example/public/apple-touch-icon.png +0 -0
  59. data/example/public/favicon.ico +0 -0
  60. data/example/public/robots.txt +1 -0
  61. data/example/test/application_system_test_case.rb +5 -0
  62. data/example/test/fixtures/boops.yml +5 -0
  63. data/example/test/integration/basic_boops_test.rb +18 -0
  64. data/example/test/integration/migrated_boops_test.rb +7 -0
  65. data/example/test/integration/parallel_boops_with_fixtures_test.rb +11 -0
  66. data/example/test/integration/parallel_boops_without_fixtures_test.rb +11 -0
  67. data/example/test/integration/updated_boops_test.rb +7 -0
  68. data/example/test/test_helper.rb +41 -0
  69. data/lib/generators/test_data/database_yaml_generator.rb +24 -0
  70. data/lib/generators/test_data/environment_file_generator.rb +29 -0
  71. data/lib/generators/test_data/webpacker_yaml_generator.rb +26 -0
  72. data/lib/test_data.rb +20 -0
  73. data/lib/test_data/active_support_ext.rb +9 -0
  74. data/lib/test_data/config.rb +52 -0
  75. data/lib/test_data/configuration_verification.rb +3 -0
  76. data/lib/test_data/configurators.rb +11 -0
  77. data/lib/test_data/configurators/database_yaml.rb +24 -0
  78. data/lib/test_data/configurators/environment_file.rb +25 -0
  79. data/lib/test_data/configurators/webpacker_yaml.rb +38 -0
  80. data/lib/test_data/detects_database_emptiness.rb +17 -0
  81. data/lib/test_data/dumps_database.rb +49 -0
  82. data/lib/test_data/error.rb +4 -0
  83. data/lib/test_data/installs_configuration.rb +9 -0
  84. data/lib/test_data/loads_database_dumps.rb +45 -0
  85. data/lib/test_data/railtie.rb +12 -0
  86. data/lib/test_data/rake.rb +104 -0
  87. data/lib/test_data/transactional_data_loader.rb +77 -0
  88. data/lib/test_data/verifies_configuration.rb +14 -0
  89. data/lib/test_data/verifies_dumps_are_loadable.rb +37 -0
  90. data/lib/test_data/version.rb +3 -0
  91. data/script/test +49 -0
  92. data/test_data.gemspec +27 -0
  93. metadata +150 -0
@@ -0,0 +1,3 @@
1
+ module TestData
2
+ VERSION = "0.0.1"
3
+ end
data/script/test ADDED
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env bash
2
+
3
+ PS4='[script/test:${LINENO}] $ '
4
+ set -e
5
+ set -x
6
+
7
+ # Make sure the main project installs & passes its own rake
8
+ bundle
9
+ bundle exec rake
10
+
11
+ # Exercise the example app
12
+ cd example
13
+ bundle
14
+
15
+ # Avoid test pollution by clearing out any initial state that might be lingering
16
+ rm -rf test/support/test_data
17
+ bin/rake db:reset
18
+
19
+ # Test basic initial usage
20
+ bin/rake test_data:install
21
+ bin/rake test_data:dump
22
+ bin/rails test test/integration/basic_boops_test.rb
23
+ bin/rails test test/integration/parallel_boops_with_fixtures_test.rb
24
+ bin/rails test test/integration/parallel_boops_without_fixtures_test.rb
25
+
26
+ # Test using the test_data env to interactively create test data
27
+ RAILS_ENV=test_data rails runner "5.times { Boop.create! }"
28
+ bin/rake test_data:dump
29
+ bin/rails test test/integration/updated_boops_test.rb
30
+
31
+ # Test a migration being added and run and an out-of-date dump being loaded
32
+ cp ../test/fixtures/20210418220133_add_beep_to_boops.rb db/migrate
33
+ bin/rake db:migrate
34
+ bin/rake db:test:prepare
35
+ bin/rake test_data:drop_database
36
+ bin/rake test_data:load
37
+ RAILS_ENV=test_data bin/rake db:migrate
38
+ bin/rake test_data:dump
39
+ bin/rails test test/integration/migrated_boops_test.rb
40
+
41
+ # Cleanup
42
+
43
+ # Delete the test_data database
44
+ bin/rake test_data:drop_database
45
+ # Unset file changes
46
+ git checkout config/database.yml
47
+ git checkout db/schema.rb
48
+ # Delete all untracked files (e.g. dumps, env config)
49
+ git clean -xdf .
data/test_data.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ require_relative "lib/test_data/version"
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "test_data"
5
+ spec.version = TestData::VERSION
6
+ spec.authors = ["Justin Searls"]
7
+ spec.email = ["searls@gmail.com"]
8
+
9
+ spec.summary = "Dumps and Loads data for your Rails app's tests"
10
+ spec.homepage = "https://github.com/testdouble/test_data"
11
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
12
+
13
+ spec.metadata["homepage_uri"] = spec.homepage
14
+ spec.metadata["source_code_uri"] = spec.homepage
15
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
21
+ end
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_dependency "railties", "~> 6.0"
27
+ end
metadata ADDED
@@ -0,0 +1,150 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: test_data
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Justin Searls
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-04-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '6.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '6.0'
27
+ description:
28
+ email:
29
+ - searls@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".gitignore"
35
+ - CHANGELOG.md
36
+ - Gemfile
37
+ - Gemfile.lock
38
+ - LICENSE.txt
39
+ - README.md
40
+ - Rakefile
41
+ - bin/console
42
+ - bin/setup
43
+ - example/.gitattributes
44
+ - example/.gitignore
45
+ - example/Gemfile
46
+ - example/Gemfile.lock
47
+ - example/README.md
48
+ - example/Rakefile
49
+ - example/app/assets/config/manifest.js
50
+ - example/app/assets/stylesheets/application.css
51
+ - example/app/controllers/application_controller.rb
52
+ - example/app/controllers/boops_controller.rb
53
+ - example/app/helpers/application_helper.rb
54
+ - example/app/models/application_record.rb
55
+ - example/app/models/boop.rb
56
+ - example/app/views/boops/index.html.erb
57
+ - example/app/views/layouts/application.html.erb
58
+ - example/bin/bundle
59
+ - example/bin/rails
60
+ - example/bin/rake
61
+ - example/bin/setup
62
+ - example/config.ru
63
+ - example/config/application.rb
64
+ - example/config/boot.rb
65
+ - example/config/credentials.yml.enc
66
+ - example/config/database.yml
67
+ - example/config/environment.rb
68
+ - example/config/environments/development.rb
69
+ - example/config/environments/production.rb
70
+ - example/config/environments/test.rb
71
+ - example/config/initializers/application_controller_renderer.rb
72
+ - example/config/initializers/backtrace_silencers.rb
73
+ - example/config/initializers/content_security_policy.rb
74
+ - example/config/initializers/cookies_serializer.rb
75
+ - example/config/initializers/filter_parameter_logging.rb
76
+ - example/config/initializers/inflections.rb
77
+ - example/config/initializers/mime_types.rb
78
+ - example/config/initializers/permissions_policy.rb
79
+ - example/config/initializers/wrap_parameters.rb
80
+ - example/config/locales/en.yml
81
+ - example/config/puma.rb
82
+ - example/config/routes.rb
83
+ - example/db/migrate/20210417143158_create_boops.rb
84
+ - example/db/schema.rb
85
+ - example/db/seeds.rb
86
+ - example/public/404.html
87
+ - example/public/422.html
88
+ - example/public/500.html
89
+ - example/public/apple-touch-icon-precomposed.png
90
+ - example/public/apple-touch-icon.png
91
+ - example/public/favicon.ico
92
+ - example/public/robots.txt
93
+ - example/test/application_system_test_case.rb
94
+ - example/test/fixtures/boops.yml
95
+ - example/test/integration/basic_boops_test.rb
96
+ - example/test/integration/migrated_boops_test.rb
97
+ - example/test/integration/parallel_boops_with_fixtures_test.rb
98
+ - example/test/integration/parallel_boops_without_fixtures_test.rb
99
+ - example/test/integration/updated_boops_test.rb
100
+ - example/test/test_helper.rb
101
+ - lib/generators/test_data/database_yaml_generator.rb
102
+ - lib/generators/test_data/environment_file_generator.rb
103
+ - lib/generators/test_data/webpacker_yaml_generator.rb
104
+ - lib/test_data.rb
105
+ - lib/test_data/active_support_ext.rb
106
+ - lib/test_data/config.rb
107
+ - lib/test_data/configuration_verification.rb
108
+ - lib/test_data/configurators.rb
109
+ - lib/test_data/configurators/database_yaml.rb
110
+ - lib/test_data/configurators/environment_file.rb
111
+ - lib/test_data/configurators/webpacker_yaml.rb
112
+ - lib/test_data/detects_database_emptiness.rb
113
+ - lib/test_data/dumps_database.rb
114
+ - lib/test_data/error.rb
115
+ - lib/test_data/installs_configuration.rb
116
+ - lib/test_data/loads_database_dumps.rb
117
+ - lib/test_data/railtie.rb
118
+ - lib/test_data/rake.rb
119
+ - lib/test_data/transactional_data_loader.rb
120
+ - lib/test_data/verifies_configuration.rb
121
+ - lib/test_data/verifies_dumps_are_loadable.rb
122
+ - lib/test_data/version.rb
123
+ - script/test
124
+ - test_data.gemspec
125
+ homepage: https://github.com/testdouble/test_data
126
+ licenses: []
127
+ metadata:
128
+ homepage_uri: https://github.com/testdouble/test_data
129
+ source_code_uri: https://github.com/testdouble/test_data
130
+ changelog_uri: https://github.com/testdouble/test_data/blob/master/CHANGELOG.md
131
+ post_install_message:
132
+ rdoc_options: []
133
+ require_paths:
134
+ - lib
135
+ required_ruby_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: 2.4.0
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ requirements: []
146
+ rubygems_version: 3.2.15
147
+ signing_key:
148
+ specification_version: 4
149
+ summary: Dumps and Loads data for your Rails app's tests
150
+ test_files: []