jets-factory 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7278e35a4721cc403aedeee2c437a45bfd7bca94767bf370cea623978d4338fe
4
+ data.tar.gz: 0c05822b97041858c97b849c22bfd13ed82143a1a12f5186af5f2524658463ec
5
+ SHA512:
6
+ metadata.gz: 1eb9c876352bab2e8f462dad417b42b3f5f0e3dd3514fa305ab7179de9696b350714a62283d62a84bb45e2a4c2e7ee6f6cfe89f8b6f739c28cb642e36ccb02a3
7
+ data.tar.gz: 3c6d0348ec2df9515152f8483524ad8ad55990d7b20ddb432d623c927c7d2fbd16465198363615ce5fe1947feecd5b41d2956139bd1c7b0592c32cf209f6323a
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "jets/factory"
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "jets/factory/faker"
4
+ require "factory_bot"
5
+
6
+ # Run load hooks before loading definitions to
7
+ # allow engines to register their factories
8
+ ActiveSupport.run_load_hooks(:factory_bot, FactoryBot)
9
+
10
+ # And only after that load Rails integration
11
+ require "factory_bot_rails"
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Faker load tons of useless locales by default
4
+ # (see https://github.com/stympy/faker/tree/master/lib/locales)
5
+ #
6
+ # And it's impossible to configure it(
7
+ # (see https://github.com/stympy/faker/blob/v1.9.3/lib/faker.rb#L14-L15)
8
+ #
9
+ # It's likely that we'll start using Estonian or Armenian or Mandarin
10
+ # for test/seed data in the nearest future.
11
+
12
+ # Read also https://evilmartians.com/chronicles/rails-profiling-story-or-how-i-caught-faker-trying-to-teach-my-app-australian-slang
13
+
14
+ # First, ensure i18n is loaded
15
+ require "i18n"
16
+
17
+ # Then, stub the `I18n` module with no-op one
18
+ save_i18n = Object.__send__(:const_get, :I18n)
19
+
20
+ # rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing
21
+ i18n_stub = Module.new do
22
+ class << self
23
+ def load_path
24
+ []
25
+ end
26
+
27
+ def backend
28
+ self
29
+ end
30
+
31
+ def initialized?
32
+ false
33
+ end
34
+
35
+ def method_missing(*)
36
+ end
37
+ end
38
+ end
39
+ # rubocop:enable Style/MethodMissingSuper, Style/MissingRespondToMissing
40
+
41
+ # We don't want to show warnings
42
+ Kernel.silence_warnings do
43
+ Object.__send__(:const_set, :I18n, i18n_stub)
44
+
45
+ # Load fake and make it think like it's loading all the locales
46
+ # to i18n
47
+ require "faker"
48
+
49
+ # Restore the original `I18n` module
50
+ Object.__send__(:const_set, :I18n, save_i18n)
51
+ end
52
+
53
+ # Load only `en` locales
54
+ faker_spec = Gem.loaded_specs["faker"]
55
+ I18n.load_path += Dir[File.join(faker_spec.full_gem_path, "lib", "locales", "en/*.yml")]
56
+ I18n.reload! if I18n.backend.initialized?
metadata ADDED
@@ -0,0 +1,144 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jets-factory
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Lauri Jutila
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-11-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
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
+ - !ruby/object:Gem::Dependency
28
+ name: factory_bot_rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: faker
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.7'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry-byebug
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.4'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.4'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '13.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '13.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: jets-rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.1'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.1'
111
+ description:
112
+ email: ruby@laurijutila.com
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files: []
116
+ files:
117
+ - Rakefile
118
+ - lib/jets-factory.rb
119
+ - lib/jets/factory.rb
120
+ - lib/jets/factory/faker.rb
121
+ homepage: https://github.com/getjets/jets-factory
122
+ licenses:
123
+ - MIT
124
+ metadata: {}
125
+ post_install_message:
126
+ rdoc_options: []
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ requirements: []
140
+ rubygems_version: 3.1.2
141
+ signing_key:
142
+ specification_version: 4
143
+ summary: Common FactoryBot utils for Jets application development
144
+ test_files: []