suspenders 1.54.1 → 1.56.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/CONTRIBUTING.md +1 -1
  4. data/NEWS.md +38 -1
  5. data/README.md +5 -12
  6. data/bin/suspenders +29 -2
  7. data/lib/suspenders/actions/strip_comments_action.rb +254 -0
  8. data/lib/suspenders/actions.rb +1 -1
  9. data/lib/suspenders/adapters/heroku.rb +16 -16
  10. data/lib/suspenders/app_builder.rb +49 -47
  11. data/lib/suspenders/exit_on_failure.rb +19 -0
  12. data/lib/suspenders/generators/advisories_generator.rb +1 -1
  13. data/lib/suspenders/generators/analytics_generator.rb +1 -1
  14. data/lib/suspenders/generators/app_generator.rb +30 -23
  15. data/lib/suspenders/generators/base.rb +3 -2
  16. data/lib/suspenders/generators/db_optimizations_generator.rb +2 -2
  17. data/lib/suspenders/generators/factories_generator.rb +1 -1
  18. data/lib/suspenders/generators/jobs_generator.rb +3 -3
  19. data/lib/suspenders/generators/js_driver_generator.rb +1 -1
  20. data/lib/suspenders/generators/json_generator.rb +4 -0
  21. data/lib/suspenders/generators/lint_generator.rb +5 -0
  22. data/lib/suspenders/generators/production/compression_generator.rb +1 -1
  23. data/lib/suspenders/generators/production/email_generator.rb +7 -7
  24. data/lib/suspenders/generators/production/manifest_generator.rb +8 -8
  25. data/lib/suspenders/generators/production/single_redirect.rb +1 -1
  26. data/lib/suspenders/generators/production/timeout_generator.rb +2 -2
  27. data/lib/suspenders/generators/profiler_generator.rb +4 -4
  28. data/lib/suspenders/generators/runner_generator.rb +4 -4
  29. data/lib/suspenders/generators/staging/pull_requests_generator.rb +2 -2
  30. data/lib/suspenders/generators/stylelint_generator.rb +2 -1
  31. data/lib/suspenders/generators/stylesheet_base_generator.rb +1 -1
  32. data/lib/suspenders/generators/testing_generator.rb +2 -3
  33. data/lib/suspenders/version.rb +5 -5
  34. data/lib/suspenders.rb +2 -1
  35. data/templates/capybara_silence_puma.rb +1 -1
  36. data/templates/descriptions/testing.md +1 -1
  37. data/templates/errors.rb +4 -3
  38. data/templates/hound.yml +1 -2
  39. data/templates/oj.rb +3 -0
  40. data/templates/partials/ci_simplecov.rb +0 -2
  41. data/templates/partials/email_smtp.rb +0 -1
  42. data/templates/partials/pull_requests_config.rb +4 -4
  43. data/templates/partials/runner_setup.rb +1 -2
  44. data/templates/postgresql_database.yml.erb +1 -0
  45. data/templates/spec_helper.rb +1 -1
  46. metadata +64 -89
  47. data/.gitignore +0 -5
  48. data/.travis.yml +0 -15
  49. data/Gemfile +0 -3
  50. data/Rakefile +0 -8
  51. data/USAGE +0 -13
  52. data/bin/rake +0 -16
  53. data/bin/rspec +0 -16
  54. data/bin/setup +0 -13
  55. data/lib/suspenders/generators/preloader_generator.rb +0 -122
  56. data/spec/adapters/heroku_spec.rb +0 -98
  57. data/spec/expand_json_spec.rb +0 -89
  58. data/spec/fakes/bin/heroku +0 -5
  59. data/spec/fakes/bin/hub +0 -5
  60. data/spec/features/advisories_spec.rb +0 -24
  61. data/spec/features/api_spec.rb +0 -18
  62. data/spec/features/ci_spec.rb +0 -31
  63. data/spec/features/cli_help_spec.rb +0 -36
  64. data/spec/features/db_optimizations_spec.rb +0 -19
  65. data/spec/features/github_spec.rb +0 -16
  66. data/spec/features/heroku_spec.rb +0 -64
  67. data/spec/features/inline_svg_spec.rb +0 -10
  68. data/spec/features/json_spec.rb +0 -15
  69. data/spec/features/new_project_spec.rb +0 -319
  70. data/spec/features/preloader_spec.rb +0 -25
  71. data/spec/features/production/compression_spec.rb +0 -23
  72. data/spec/features/production/deployment_spec.rb +0 -22
  73. data/spec/features/production/email_spec.rb +0 -47
  74. data/spec/features/production/manifest_spec.rb +0 -37
  75. data/spec/features/production/single_redirect_spec.rb +0 -25
  76. data/spec/features/profiler_spec.rb +0 -20
  77. data/spec/features/runner_spec.rb +0 -30
  78. data/spec/features/staging/pull_requests_spec.rb +0 -22
  79. data/spec/features/static_spec.rb +0 -17
  80. data/spec/features/stylelint_spec.rb +0 -60
  81. data/spec/spec_helper.rb +0 -21
  82. data/spec/support/be_executable_matcher.rb +0 -7
  83. data/spec/support/contain_json_matcher.rb +0 -30
  84. data/spec/support/exist_as_a_file_matcher.rb +0 -7
  85. data/spec/support/fake_github.rb +0 -21
  86. data/spec/support/fake_heroku.rb +0 -53
  87. data/spec/support/generators.rb +0 -5
  88. data/spec/support/match_contents_matcher.rb +0 -6
  89. data/spec/support/project_files.rb +0 -25
  90. data/spec/support/rails_template.rb +0 -1
  91. data/spec/support/suspenders.rb +0 -185
  92. data/suspenders.gemspec +0 -35
  93. data/templates/descriptions/preloader.md +0 -3
  94. data/templates/spring.rb +0 -6
@@ -1,319 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "Suspend a new project with default configuration" do
4
- before(:all) do
5
- drop_dummy_database
6
- remove_project_directory
7
- run_suspenders
8
- setup_app_dependencies
9
- end
10
-
11
- it "uses custom Gemfile" do
12
- gemfile_file = IO.read("#{project_path}/Gemfile")
13
- expect(gemfile_file).to match(
14
- /^ruby "#{Suspenders::RUBY_VERSION}"$/,
15
- )
16
- expect(gemfile_file).to match(
17
- /^gem "autoprefixer-rails"$/,
18
- )
19
- expect(gemfile_file).to match(
20
- /^gem "rails", "#{Suspenders::RAILS_VERSION}"$/,
21
- )
22
- end
23
-
24
- it "ensures project specs pass" do
25
- Dir.chdir(project_path) do
26
- Bundler.with_unbundled_env do
27
- expect(`rake`).to include('0 failures')
28
- end
29
- end
30
- end
31
-
32
- it "includes the bundle:audit task" do
33
- Dir.chdir(project_path) do
34
- Bundler.with_unbundled_env do
35
- expect(`rails -T`).to include("rails bundle:audit")
36
- end
37
- end
38
- end
39
-
40
- it "creates .ruby-version from Suspenders .ruby-version" do
41
- ruby_version_file = IO.read("#{project_path}/.ruby-version")
42
-
43
- expect(ruby_version_file).to eq "#{RUBY_VERSION}\n"
44
- end
45
-
46
- it "copies dotfiles" do
47
- expect(File).to exist("#{project_path}/.env")
48
- end
49
-
50
- it "doesn't generate test directory" do
51
- expect(File).not_to exist("#{project_path}/test")
52
- end
53
-
54
- it "loads secret_key_base from env" do
55
- secrets_file = IO.read("#{project_path}/config/secrets.yml")
56
-
57
- expect(secrets_file).
58
- to match(/secret_key_base: <%= ENV\["SECRET_KEY_BASE"\] %>/)
59
- end
60
-
61
- it "adds bin/setup file" do
62
- expect(File).to exist("#{project_path}/bin/setup")
63
- end
64
-
65
- it "makes bin/setup executable" do
66
- expect("bin/setup").to be_executable
67
- end
68
-
69
- it "adds support file for action mailer" do
70
- expect(File).to exist("#{project_path}/spec/support/action_mailer.rb")
71
- end
72
-
73
- it "configures capybara-chromedriver" do
74
- expect(File).to exist("#{project_path}/spec/support/chromedriver.rb")
75
- end
76
-
77
- it "adds support file for i18n" do
78
- expect(File).to exist("#{project_path}/spec/support/i18n.rb")
79
- end
80
-
81
- it "creates good default .hound.yml" do
82
- hound_config_file = IO.read("#{project_path}/.hound.yml")
83
-
84
- expect(hound_config_file).to include "enabled: true"
85
- end
86
-
87
- it "initializes ActiveJob to avoid memory bloat" do
88
- expect(File).
89
- to exist("#{project_path}/config/initializers/active_job.rb")
90
- end
91
-
92
- it "records pageviews through Segment if ENV variable set" do
93
- expect(analytics_partial).
94
- to include(%{<% if ENV["SEGMENT_KEY"] %>})
95
- expect(analytics_partial).
96
- to include(%{analytics.load("<%= ENV["SEGMENT_KEY"] %>");})
97
- end
98
-
99
- it "raises on unpermitted parameters in all environments" do
100
- result = IO.read("#{project_path}/config/application.rb")
101
-
102
- expect(result).to match(
103
- /^ +config.action_controller.action_on_unpermitted_parameters = :raise$/
104
- )
105
- end
106
-
107
- it "adds explicit quiet_assets configuration" do
108
- result = IO.read("#{project_path}/config/application.rb")
109
-
110
- expect(result).to match(/^ +config.assets.quiet = true$/)
111
- end
112
-
113
- it "configures public_file_server.headers in production" do
114
- expect(production_config).to match(
115
- /^ +config.public_file_server.headers = {\n +"Cache-Control" => "public,/,
116
- )
117
- end
118
-
119
- it "configures production environment to enforce SSL" do
120
- expect(production_config).to match(
121
- /^ +config.force_ssl = true/,
122
- )
123
- end
124
-
125
- it "raises on missing translations in development and test" do
126
- [development_config, test_config].each do |environment_file|
127
- expect(environment_file).to match(
128
- /^ +config.action_view.raise_on_missing_translations = true$/
129
- )
130
- end
131
- end
132
-
133
- it "evaluates en.yml.erb" do
134
- locales_en_file = IO.read("#{project_path}/config/locales/en.yml")
135
-
136
- expect(locales_en_file).to match(/application: #{app_name.humanize}/)
137
- end
138
-
139
- it "configs simple_form" do
140
- expect(File).to exist("#{project_path}/config/initializers/simple_form.rb")
141
- end
142
-
143
- it "configs :test email delivery method for development" do
144
- expect(development_config).
145
- to match(/^ +config.action_mailer.delivery_method = :file$/)
146
- end
147
-
148
- it "sets action mailer default host and asset host" do
149
- config_key = 'config\.action_mailer\.asset_host'
150
- config_value =
151
- %q{ENV\.fetch\("ASSET_HOST", ENV\.fetch\("APPLICATION_HOST"\)\)}
152
- expect(production_config).to match(/#{config_key} = #{config_value}/)
153
- end
154
-
155
- it "uses APPLICATION_HOST, not HOST in the production config" do
156
- expect(production_config).to match(/"APPLICATION_HOST"/)
157
- expect(production_config).not_to match(/"HOST"/)
158
- end
159
-
160
- it "configures email interceptor" do
161
- email_file = File.join(project_path, "config", "initializers", "email.rb")
162
- email_config = IO.read(email_file)
163
-
164
- expect(email_config).
165
- to include(%{RecipientInterceptor.new(ENV["EMAIL_RECIPIENTS"])})
166
- end
167
-
168
- it "configures language in html element" do
169
- layout_path = "/app/views/layouts/application.html.erb"
170
- layout_file = IO.read("#{project_path}#{layout_path}")
171
- expect(layout_file).to match(/<html lang="en">/)
172
- end
173
-
174
- it "configs active job queue adapter" do
175
- application_config = IO.read("#{project_path}/config/application.rb")
176
-
177
- expect(application_config).to match(
178
- /^ +config.active_job.queue_adapter = :delayed_job$/
179
- )
180
- expect(test_config).to match(
181
- /^ +config.active_job.queue_adapter = :inline$/
182
- )
183
- end
184
-
185
- it "configs background jobs for rspec" do
186
- delayed_job = IO.read("#{project_path}/bin/delayed_job")
187
-
188
- expect(delayed_job).to match(
189
- /^require 'delayed\/command'$/,
190
- )
191
- end
192
-
193
- it "configs bullet gem in development" do
194
- expect(development_config).to match /^ +Bullet.enable = true$/
195
- expect(development_config).to match /^ +Bullet.bullet_logger = true$/
196
- expect(development_config).to match /^ +Bullet.rails_logger = true$/
197
- end
198
-
199
- it "configs missing assets to raise in test" do
200
- expect(test_config).to match(
201
- /^ +config.assets.raise_runtime_errors = true$/,
202
- )
203
- end
204
-
205
- it "adds spring to binstubs" do
206
- expect(File).to exist("#{project_path}/bin/spring")
207
-
208
- bin_stubs = %w(rake rails rspec)
209
- bin_stubs.each do |bin_stub|
210
- expect(IO.read("#{project_path}/bin/#{bin_stub}")).to match(/spring/)
211
- end
212
- end
213
-
214
- it "removes comments and extra newlines from config files" do
215
- config_files = [
216
- IO.read("#{project_path}/config/application.rb"),
217
- IO.read("#{project_path}/config/environment.rb"),
218
- development_config,
219
- test_config,
220
- production_config,
221
- ]
222
-
223
- config_files.each do |file|
224
- expect(file).not_to match(%r{.*#.*})
225
- expect(file).not_to eq(file.strip)
226
- expect(file).not_to match(%r{^$\n\n})
227
- end
228
- end
229
-
230
- it "copies factories.rb" do
231
- expect(File).to exist("#{project_path}/spec/factories.rb")
232
- end
233
-
234
- it "creates review apps setup script" do
235
- bin_setup_path = "#{project_path}/bin/setup_review_app"
236
- bin_setup = IO.read(bin_setup_path)
237
-
238
- expect(bin_setup).to include("PARENT_APP_NAME=#{app_name.dasherize}-staging")
239
- expect(bin_setup).to include("APP_NAME=#{app_name.dasherize}-staging-pr-$1")
240
- expect(bin_setup).to include("heroku ps:scale worker=1 --app $APP_NAME")
241
- expect(bin_setup).to include("heroku restart --app $APP_NAME")
242
-
243
- expect("bin/setup_review_app").to be_executable
244
- end
245
-
246
- it "creates deploy script" do
247
- bin_deploy_path = "#{project_path}/bin/deploy"
248
- bin_deploy = IO.read(bin_deploy_path)
249
-
250
- expect(bin_deploy).to include("git push")
251
- expect("bin/deploy").to be_executable
252
- end
253
-
254
- it "creates heroku application manifest file with application name in it" do
255
- app_json_file = IO.read("#{project_path}/app.json")
256
-
257
- expect(app_json_file).to match(/"name":\s*"#{app_name.dasherize}"/)
258
- end
259
-
260
- def app_name
261
- SuspendersTestHelpers::APP_NAME
262
- end
263
-
264
- it "adds high_voltage" do
265
- gemfile = IO.read("#{project_path}/Gemfile")
266
- expect(gemfile).to match(/high_voltage/)
267
- end
268
-
269
- it "adds sassc-rails" do
270
- gemfile = read_project_file("Gemfile")
271
-
272
- expect(gemfile).to match(/sassc-rails/)
273
- end
274
-
275
- it "adds and configures bourbon" do
276
- gemfile = read_project_file("Gemfile")
277
-
278
- expect(gemfile).to match(/bourbon/)
279
- end
280
-
281
- it "configures bourbon, and bitters" do
282
- app_css = read_project_file(%w(app assets stylesheets application.scss))
283
- expect(app_css).to match(
284
- /normalize\.css\/normalize.*bourbon.*base/m,
285
- )
286
- end
287
-
288
- it "doesn't use turbolinks" do
289
- app_js = read_project_file(%w(app javascript packs application.js))
290
- expect(app_js).not_to match(/turbolinks/)
291
- end
292
-
293
- it "configures Timecop safe mode" do
294
- spec_helper = read_project_file(%w(spec spec_helper.rb))
295
- expect(spec_helper).to match(/Timecop.safe_mode = true/)
296
- end
297
-
298
- def development_config
299
- @_development_config ||=
300
- read_project_file %w(config environments development.rb)
301
- end
302
-
303
- def test_config
304
- @_test_config ||= read_project_file %w(config environments test.rb)
305
- end
306
-
307
- def production_config
308
- @_production_config ||=
309
- read_project_file %w(config environments production.rb)
310
- end
311
-
312
- def analytics_partial
313
- IO.read("#{project_path}/app/views/application/_analytics.html.erb")
314
- end
315
-
316
- def read_project_file(path)
317
- IO.read(File.join(project_path, *path))
318
- end
319
- end
@@ -1,25 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "suspenders:preloader", type: :generator do
4
- it "adds binstubs for Spring" do
5
- with_app { generate("suspenders:preloader") }
6
-
7
- expect("bin/rails").to match_contents(/spring/)
8
- expect("config/spring.rb").to exist_as_a_file
9
- expect("config/environments/test.rb").to \
10
- match_contents(/config.cache_classes = false/)
11
- expect("Gemfile").to match_contents(/spring/)
12
- expect("Gemfile").to match_contents(/spring-watcher-listen/)
13
- end
14
-
15
- it "removes Spring binstubs" do
16
- with_app { destroy("suspenders:preloader") }
17
-
18
- expect("config/environments/test.rb").to \
19
- match_contents(/config.cache_classes = true/)
20
- expect("config/spring.rb").not_to exist_as_a_file
21
- expect("bin/rails").not_to match_contents(/spring/)
22
- expect("Gemfile").not_to match_contents(/spring-watcher-listen/)
23
- expect("Gemfile").not_to match_contents(/spring/)
24
- end
25
- end
@@ -1,23 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "suspenders:production:compression", type: :generator do
4
- context "generate" do
5
- it "adds Rack::Deflater to the middleware" do
6
- with_app { generate("suspenders:production:compression") }
7
-
8
- expect("config/environments/production.rb").to match_contents(
9
- %r{config.middleware.use Rack::Deflater},
10
- )
11
- end
12
- end
13
-
14
- context "destroy" do
15
- it "removes Rack::Deflater to the middleware" do
16
- with_app { destroy("suspenders:production:compression") }
17
-
18
- expect("config/environments/production.rb").not_to match_contents(
19
- %r{Rack::Deflater},
20
- )
21
- end
22
- end
23
- end
@@ -1,22 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "suspenders:production:deployment", type: :generator do
4
- it "generates the configuration for a production deployment" do
5
- rm "bin/deploy"
6
-
7
- with_app { generate("suspenders:production:deployment") }
8
-
9
- expect("bin/deploy").to exist_as_a_file
10
- expect("bin/deploy").to be_executable
11
- expect("README.md").to match_contents(%r{bin/deploy})
12
- end
13
-
14
- it "destroys the configuration for a production deployment" do
15
- touch "bin/deploy"
16
-
17
- with_app { destroy("suspenders:production:deployment") }
18
-
19
- expect("bin/deploy").not_to exist_as_a_file
20
- expect("README.md").not_to match_contents(%r{bin/deploy})
21
- end
22
- end
@@ -1,47 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "suspenders:production:email", type: :generator do
4
- it "generates the configuration for a production email deployment" do
5
- with_app { generate("suspenders:production:email") }
6
-
7
- expect("config/smtp.rb").to match_contents(%r{SMTP_SETTINGS\s*=})
8
-
9
- expect("config/environments/production.rb").to \
10
- match_contents(%r{require.+config/smtp})
11
- expect("config/environments/production.rb").to \
12
- match_contents(%r{action_mailer.delivery_method\s*=\s*:smtp})
13
- expect("config/environments/production.rb").to \
14
- match_contents(%r{action_mailer.smtp_settings\s*=\s*SMTP_SETTINGS})
15
-
16
- expect("app.json").to contain_json(
17
- env: {
18
- SMTP_ADDRESS: { required: true },
19
- SMTP_DOMAIN: { required: true },
20
- SMTP_PASSWORD: { required: true },
21
- SMTP_USERNAME: { required: true },
22
- },
23
- )
24
- end
25
-
26
- it "destroys the configuration for a production email deployment" do
27
- with_app { destroy("suspenders:production:email") }
28
-
29
- expect("config/smtp.rb").not_to exist_as_a_file
30
-
31
- expect("config/environments/production.rb").not_to \
32
- match_contents(%r{require.+config/smtp})
33
- expect("config/environments/production.rb").not_to \
34
- match_contents(%r{action_mailer.delivery_method\s*=\s*:smtp})
35
- expect("config/environments/production.rb").not_to \
36
- match_contents(%r{action_mailer.smtp_settings\s*=\s*SMTP_SETTINGS})
37
-
38
- expect("app.json").not_to contain_json(
39
- env: {
40
- SMTP_ADDRESS: { required: true },
41
- SMTP_DOMAIN: { required: true },
42
- SMTP_PASSWORD: { required: true },
43
- SMTP_USERNAME: { required: true },
44
- },
45
- )
46
- end
47
- end
@@ -1,37 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "suspenders:production:manifest", type: :generator do
4
- it "generates the manifest for a production build" do
5
- with_app { generate("suspenders:production:manifest") }
6
-
7
- expect("app.json").to contain_json(
8
- name: SuspendersTestHelpers::APP_NAME.dasherize,
9
- env: {
10
- APPLICATION_HOST: { required: true },
11
- AUTO_MIGRATE_DB: { value: true },
12
- EMAIL_RECIPIENTS: { required: true },
13
- HEROKU_APP_NAME: { required: true },
14
- HEROKU_PARENT_APP_NAME: { required: true },
15
- RACK_ENV: { required: true },
16
- SECRET_KEY_BASE: { generator: "secret" },
17
- },
18
- )
19
- end
20
-
21
- it "destroys the manifest for a production build" do
22
- with_app { destroy("suspenders:production:manifest") }
23
-
24
- expect("app.json").not_to contain_json(
25
- name: SuspendersTestHelpers::APP_NAME.dasherize,
26
- env: {
27
- APPLICATION_HOST: { required: true },
28
- AUTO_MIGRATE_DB: { value: true },
29
- EMAIL_RECIPIENTS: { required: true },
30
- HEROKU_APP_NAME: { required: true },
31
- HEROKU_PARENT_APP_NAME: { required: true },
32
- RACK_ENV: { required: true },
33
- SECRET_KEY_BASE: { generator: "secret" },
34
- },
35
- )
36
- end
37
- end
@@ -1,25 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "suspenders:production:single_redirect", type: :generator do
4
- context "generate" do
5
- it "adds Rack::CanonicalHost to the production middleware" do
6
- with_app { generate("suspenders:production:single_redirect") }
7
- middleware_canonical_host = %r{config.middleware.use Rack::CanonicalHost, ENV.fetch\("APPLICATION_HOST"\)}
8
-
9
- expect("config/environments/production.rb").to match_contents(
10
- middleware_canonical_host,
11
- )
12
- end
13
- end
14
-
15
- context "destroy" do
16
- it "removes Rack::CanonicalHost from the production middleware" do
17
- with_app { destroy("suspenders:production:single_redirect") }
18
- middleware_canonical_host = %r{config.middleware.use Rack::CanonicalHost, ENV.fetch\("APPLICATION_HOST"\)}
19
-
20
- expect("config/environments/production.rb").not_to match_contents(
21
- middleware_canonical_host,
22
- )
23
- end
24
- end
25
- end
@@ -1,20 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "suspenders:profiler", type: :generator do
4
- it "sets up rack-min-profiler" do
5
- with_app { generate("suspenders:profiler") }
6
-
7
- expect("config/initializers/rack_mini_profiler.rb").to \
8
- match_contents(/Rack::MiniProfilerRails.initialize/)
9
- expect("Gemfile").to match_contents(/rack-mini-profiler/)
10
- expect(".env").to match_contents(/RACK_MINI_PROFILER=0/)
11
- end
12
-
13
- it "removes rack-min-profiler" do
14
- with_app { destroy("suspenders:profiler") }
15
-
16
- expect("config/initializers/rack_mini_profiler.rb").not_to exist_as_a_file
17
- expect("Gemfile").not_to match_contents(/rack-mini-profiler/)
18
- expect(".env").not_to exist_as_a_file
19
- end
20
- end
@@ -1,30 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "suspenders:runner", type: :generator do
4
- it "configures the app for running" do
5
- with_app { generate("suspenders:runner") }
6
-
7
- expect("Procfile").to exist_as_a_file
8
- expect(".sample.env").to exist_as_a_file
9
- expect("bin/setup").to match_contents(/\.sample\.env/)
10
- expect("README.md").to match_contents(/\.sample\.env/)
11
- end
12
-
13
- it "removes custom app running configuration" do
14
- with_app { destroy("suspenders:runner") }
15
-
16
- expect("README.md").not_to match_contents(/\.sample\.env/)
17
- expect("bin/setup").not_to match_contents(/\.sample\.env/)
18
- expect(".sample.env").not_to exist_as_a_file
19
- expect("Procfile").not_to exist_as_a_file
20
- end
21
-
22
- it "configures the app with a shell script bin/setup" do
23
- with_app do
24
- copy_file "bin_setup", "bin/setup"
25
- generate("suspenders:runner")
26
- end
27
-
28
- expect("bin/setup").to match_contents(/\.sample\.env/)
29
- end
30
- end
@@ -1,22 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "suspenders:staging:pull_requests", type: :generator do
4
- it "generates the configuration for Heroku pipeline review apps" do
5
- with_app { generate("suspenders:staging:pull_requests") }
6
-
7
- expect("config/environments/production.rb").to \
8
- match_contents(%r{HEROKU_APP_NAME})
9
-
10
- expect("bin/setup_review_app").to \
11
- match_contents(%r{APP_NAME=dummy-app-staging-pr-\$1})
12
- end
13
-
14
- it "destroys the configuration for Heroku pipeline review apps" do
15
- with_app { destroy("suspenders:staging:pull_requests") }
16
-
17
- expect("config/environments/production.rb").not_to \
18
- match_contents(%r{APP_NAME=dummy-app-staging-pr-\$1})
19
-
20
- expect("bin/setup_review_app").not_to exist_as_a_file
21
- end
22
- end
@@ -1,17 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "suspenders:static", type: :generator do
4
- it "adds the gem and pages directory" do
5
- with_app { generate("suspenders:static") }
6
-
7
- expect("Gemfile").to match_contents(/high_voltage/)
8
- expect("app/views/pages/.keep").to exist_as_a_file
9
- end
10
-
11
- it "removes the gem and pages directory" do
12
- with_app { destroy("suspenders:static") }
13
-
14
- expect("app/views/pages/.keep").not_to exist_as_a_file
15
- expect("Gemfile").not_to match_contents(/high_voltage/)
16
- end
17
- end
@@ -1,60 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe "suspenders:stylelint", type: :generator do
4
- context "generate" do
5
- it "creates .stylelintrc.json" do
6
- with_app { generate("suspenders:stylelint") }
7
-
8
- expect(".stylelintrc.json").
9
- to match_contents(%r{"extends": "@thoughtbot/stylelint-config"})
10
- end
11
-
12
- it "adds stylelint and @thoughtbot/stylelint-config to the package.json" do
13
- with_app { generate("suspenders:stylelint") }
14
-
15
- expect("package.json").to match_contents(/devDependencies/)
16
- expect("package.json").to match_contents(/stylelint/)
17
- expect("package.json").to match_contents(%r{@thoughtbot/stylelint-config})
18
- end
19
-
20
- it "uncomments the hound config_file option" do
21
- with_app { generate("suspenders:stylelint") }
22
-
23
- expect(".hound.yml").to(
24
- match_contents(/^ config_file: \.stylelintrc\.json/),
25
- )
26
- end
27
- end
28
-
29
- context "destroy" do
30
- it "removes .stylelintrc.json" do
31
- with_app do
32
- generate("suspenders:stylelint")
33
- destroy("suspenders:stylelint")
34
- end
35
-
36
- expect(".stylelintrc.json").not_to exist_as_a_file
37
- end
38
-
39
- it "removes stylelint and @thoughtbot/stylelint-config from package.json" do
40
- with_app do
41
- generate("suspenders:stylelint")
42
- destroy("suspenders:stylelint")
43
- end
44
-
45
- expect("package.json").not_to match_contents(/stylelint/)
46
- expect("package.json").
47
- not_to match_contents(%r{@thoughtbot/stylelint-config})
48
- end
49
-
50
- it "comments in the hound config_file option" do
51
- with_app do
52
- generate("suspenders:stylelint")
53
- destroy("suspenders:stylelint")
54
- end
55
-
56
- expect(".hound.yml").
57
- to match_contents(/^ # config_file: \.stylelintrc\.json/)
58
- end
59
- end
60
- end
data/spec/spec_helper.rb DELETED
@@ -1,21 +0,0 @@
1
- require 'bundler/setup'
2
-
3
- Bundler.require(:default, :test)
4
-
5
- require (Pathname.new(__FILE__).dirname + '../lib/suspenders').expand_path
6
-
7
- Dir['./spec/support/**/*.rb'].each { |file| require file }
8
-
9
- RSpec.configure do |config|
10
- config.include SuspendersTestHelpers
11
- config.include ProjectFiles
12
-
13
- config.before(:all) do
14
- add_fakes_to_path
15
- create_tmp_directory
16
- end
17
-
18
- config.before(:each) do
19
- FakeGithub.clear!
20
- end
21
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec::Matchers.define :be_executable do
4
- match do |filename|
5
- File.stat(File.join(project_path, filename)).executable?
6
- end
7
- end