suspenders 1.52.0 → 1.55.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.standard.yml +2 -0
- data/.travis.yml +6 -3
- data/CONTRIBUTING.md +15 -15
- data/GOALS.md +65 -0
- data/Gemfile +1 -1
- data/NEWS.md +52 -0
- data/README.md +6 -5
- data/Rakefile +6 -5
- data/docs/heroku_deploy.md +19 -0
- data/lib/suspenders.rb +7 -0
- data/lib/suspenders/actions.rb +2 -2
- data/lib/suspenders/adapters/heroku.rb +27 -14
- data/lib/suspenders/app_builder.rb +42 -111
- data/lib/suspenders/generators/advisories_generator.rb +15 -0
- data/lib/suspenders/generators/analytics_generator.rb +1 -1
- data/lib/suspenders/generators/app_generator.rb +36 -58
- data/lib/suspenders/generators/base.rb +40 -1
- data/lib/suspenders/generators/ci_generator.rb +19 -9
- data/lib/suspenders/generators/db_optimizations_generator.rb +5 -17
- data/lib/suspenders/generators/factories_generator.rb +2 -2
- data/lib/suspenders/generators/forms_generator.rb +1 -1
- data/lib/suspenders/generators/inline_svg_generator.rb +14 -0
- data/lib/suspenders/generators/jobs_generator.rb +4 -4
- data/lib/suspenders/generators/js_driver_generator.rb +7 -4
- data/lib/suspenders/generators/json_generator.rb +1 -1
- data/lib/suspenders/generators/lint_generator.rb +5 -0
- data/lib/suspenders/generators/preloader_generator.rb +122 -0
- data/lib/suspenders/generators/production/compression_generator.rb +14 -0
- data/lib/suspenders/generators/production/deployment_generator.rb +1 -12
- data/lib/suspenders/generators/production/email_generator.rb +9 -12
- data/lib/suspenders/generators/production/manifest_generator.rb +8 -7
- data/lib/suspenders/generators/production/single_redirect.rb +15 -0
- data/lib/suspenders/generators/production/timeout_generator.rb +3 -2
- data/lib/suspenders/generators/profiler_generator.rb +35 -0
- data/lib/suspenders/generators/runner_generator.rb +48 -0
- data/lib/suspenders/generators/staging/pull_requests_generator.rb +4 -12
- data/lib/suspenders/generators/static_generator.rb +5 -1
- data/lib/suspenders/generators/stylelint_generator.rb +2 -1
- data/lib/suspenders/generators/stylesheet_base_generator.rb +7 -8
- data/lib/suspenders/generators/testing_generator.rb +3 -14
- data/lib/suspenders/version.rb +6 -6
- data/spec/adapters/heroku_spec.rb +36 -10
- data/spec/expand_json_spec.rb +89 -0
- data/spec/fakes/bin/heroku +1 -1
- data/spec/fakes/bin/hub +1 -1
- data/spec/features/advisories_spec.rb +24 -0
- data/spec/features/api_spec.rb +1 -1
- data/spec/features/ci_spec.rb +31 -0
- data/spec/features/cli_help_spec.rb +4 -4
- data/spec/features/db_optimizations_spec.rb +19 -0
- data/spec/features/heroku_spec.rb +9 -16
- data/spec/features/inline_svg_spec.rb +10 -0
- data/spec/features/lint_spec.rb +26 -0
- data/spec/features/new_project_spec.rb +40 -60
- data/spec/features/preloader_spec.rb +25 -0
- data/spec/features/production/compression_spec.rb +23 -0
- data/spec/features/production/email_spec.rb +10 -10
- data/spec/features/production/manifest_spec.rb +16 -14
- data/spec/features/production/single_redirect_spec.rb +25 -0
- data/spec/features/profiler_spec.rb +20 -0
- data/spec/features/runner_spec.rb +30 -0
- data/spec/features/staging/pull_requests_spec.rb +1 -1
- data/spec/features/static_spec.rb +17 -0
- data/spec/features/stylelint_spec.rb +7 -7
- data/spec/spec_helper.rb +3 -3
- data/spec/support/contain_json_matcher.rb +16 -10
- data/spec/support/fake_github.rb +3 -3
- data/spec/support/fake_heroku.rb +8 -8
- data/spec/support/project_files.rb +12 -0
- data/spec/support/rails_template.rb +1 -0
- data/spec/support/suspenders.rb +21 -19
- data/suspenders.gemspec +20 -20
- data/templates/Gemfile.erb +2 -10
- data/templates/_javascript.html.erb +1 -1
- data/templates/application.scss +0 -1
- data/templates/bin_auto_migrate +5 -0
- data/templates/bin_deploy +0 -2
- data/templates/bin_setup +2 -2
- data/templates/bin_setup_review_app.erb +0 -1
- data/templates/capybara_silence_puma.rb +1 -0
- data/templates/chromedriver.rb +14 -4
- data/templates/descriptions/advisories.md +5 -0
- data/templates/descriptions/analytics.md +4 -0
- data/templates/descriptions/ci.md +4 -0
- data/templates/descriptions/compression.md +4 -0
- data/templates/descriptions/db_optimizations.md +2 -0
- data/templates/descriptions/deployment.md +5 -0
- data/templates/descriptions/email.md +9 -0
- data/templates/descriptions/factories.md +12 -0
- data/templates/descriptions/force_tls.md +1 -0
- data/templates/descriptions/forms.md +1 -0
- data/templates/descriptions/inline_svg.md +2 -0
- data/templates/descriptions/jobs.md +3 -0
- data/templates/descriptions/js_driver.md +4 -0
- data/templates/descriptions/json.md +1 -0
- data/templates/descriptions/lint.md +3 -0
- data/templates/descriptions/manifest.md +2 -0
- data/templates/descriptions/preloader.md +3 -0
- data/templates/descriptions/profiler.md +7 -0
- data/templates/descriptions/pull_requests.md +4 -0
- data/templates/descriptions/runner.md +10 -0
- data/templates/descriptions/single_redirect.md +1 -0
- data/templates/descriptions/static.md +5 -0
- data/templates/descriptions/stylelint.md +3 -0
- data/templates/descriptions/stylesheet_base.md +4 -0
- data/templates/descriptions/testing.md +9 -0
- data/templates/descriptions/timeout.md +4 -0
- data/templates/descriptions/views.md +8 -0
- data/templates/errors.rb +3 -3
- data/templates/hound.yml +1 -2
- data/templates/inline_svg.rb +3 -0
- data/templates/partials/ci_simplecov.rb +14 -0
- data/templates/partials/db_optimizations_configuration.rb +7 -0
- data/templates/partials/deployment_readme.md +8 -0
- data/templates/partials/email_smtp.rb +2 -0
- data/templates/partials/profiler_readme.md +8 -0
- data/templates/partials/pull_requests_config.rb +4 -0
- data/templates/partials/runner_readme.md +31 -0
- data/templates/partials/runner_setup.rb +2 -0
- data/templates/rack_mini_profiler.rb +2 -0
- data/templates/rails_helper.rb +4 -1
- data/templates/{dotfiles/.env → sample_env} +0 -2
- data/templates/spec_helper.rb +4 -7
- data/templates/spring.rb +6 -0
- data/templates/suspenders_gitignore +1 -1
- metadata +103 -17
- data/templates/browserslist +0 -3
- data/templates/dotfiles/.ctags +0 -2
- data/templates/puma.rb +0 -28
@@ -0,0 +1,24 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe "suspenders:advisories", type: :generator do
|
4
|
+
it "configures bundler-audit" do
|
5
|
+
with_app { generate("suspenders:advisories") }
|
6
|
+
|
7
|
+
run_in_project do
|
8
|
+
expect(`rake -T`).to include("rake bundle:audit")
|
9
|
+
end
|
10
|
+
expect("lib/tasks/bundler_audit.rake").to \
|
11
|
+
match_contents(/Bundler::Audit::Task.new/)
|
12
|
+
expect("Gemfile").to match_contents(/bundler-audit/)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "removes bundler-audit" do
|
16
|
+
with_app { destroy("suspenders:advisories") }
|
17
|
+
|
18
|
+
expect("Gemfile").not_to match_contents(/bundler-audit/)
|
19
|
+
expect("lib/tasks/bundler_audit.rake").not_to exist_as_a_file
|
20
|
+
run_in_project do
|
21
|
+
expect(`rake -T`).not_to include("rake bundle:audit")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/spec/features/api_spec.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe "suspenders:ci", type: :generator do
|
4
|
+
it "configures Circle with SimpleCov" do
|
5
|
+
with_app { generate("suspenders:ci") }
|
6
|
+
|
7
|
+
expect("Gemfile").to match_contents(/simplecov/)
|
8
|
+
expect("test/test_helper.rb").to match_contents(/SimpleCov.coverage_dir/)
|
9
|
+
expect("test/test_helper.rb").to match_contents(/SimpleCov.start/)
|
10
|
+
expect("circle.yml").to exist_as_a_file
|
11
|
+
end
|
12
|
+
|
13
|
+
it "removes Circle and SimpleCov" do
|
14
|
+
with_app { destroy("suspenders:ci") }
|
15
|
+
|
16
|
+
expect("circle.yml").not_to exist_as_a_file
|
17
|
+
expect("test/test_helper.rb").not_to match_contents(/SimpleCov/)
|
18
|
+
expect("Gemfile").not_to match_contents(/simplecov/)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "configures RSpec" do
|
22
|
+
with_app do
|
23
|
+
copy_file "spec_helper.rb", "spec/spec_helper.rb"
|
24
|
+
|
25
|
+
generate("suspenders:ci")
|
26
|
+
end
|
27
|
+
|
28
|
+
expect("spec/spec_helper.rb").to match_contents(/SimpleCov.coverage_dir/)
|
29
|
+
expect("spec/spec_helper.rb").to match_contents(/SimpleCov.start/)
|
30
|
+
end
|
31
|
+
end
|
@@ -20,10 +20,10 @@ RSpec.describe "Command line help output" do
|
|
20
20
|
|
21
21
|
it "provides help and version usage within the suspenders group" do
|
22
22
|
expect(help_text).to include <<~EOH
|
23
|
-
Suspenders options:
|
24
|
-
|
25
|
-
|
26
|
-
EOH
|
23
|
+
Suspenders options:
|
24
|
+
-h, [--help], [--no-help] # Show this help message and quit
|
25
|
+
-v, [--version], [--no-version] # Show Suspenders version number and quit
|
26
|
+
EOH
|
27
27
|
end
|
28
28
|
|
29
29
|
it "does not show the default extended rails help section" do
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe "suspenders:db_optimizations", type: :generator do
|
4
|
+
it "configures bullet" do
|
5
|
+
with_app { generate("suspenders:db_optimizations") }
|
6
|
+
|
7
|
+
expect("Gemfile").to match_contents(/bullet/)
|
8
|
+
expect("config/environments/development.rb").to \
|
9
|
+
match_contents(/Bullet.enable/)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "removes bullet" do
|
13
|
+
with_app { destroy("suspenders:db_optimizations") }
|
14
|
+
|
15
|
+
expect("Gemfile").not_to match_contents(/bullet/)
|
16
|
+
expect("config/environments/development.rb").not_to \
|
17
|
+
match_contents(/Bullet.enable/)
|
18
|
+
end
|
19
|
+
end
|
@@ -16,9 +16,9 @@ RSpec.describe "Heroku" do
|
|
16
16
|
expect(FakeHeroku).to have_configured_vars("staging", "SECRET_KEY_BASE")
|
17
17
|
expect(FakeHeroku).to have_configured_vars(
|
18
18
|
"production",
|
19
|
-
"SECRET_KEY_BASE"
|
19
|
+
"SECRET_KEY_BASE"
|
20
20
|
)
|
21
|
-
%w
|
21
|
+
%w[staging production].each do |env|
|
22
22
|
expect(FakeHeroku).to have_configured_vars(env, "APPLICATION_HOST")
|
23
23
|
expect(FakeHeroku).to have_configured_vars(env, "HONEYBADGER_ENV")
|
24
24
|
end
|
@@ -27,8 +27,8 @@ RSpec.describe "Heroku" do
|
|
27
27
|
bin_setup_path = "#{project_path}/bin/setup"
|
28
28
|
bin_setup = IO.read(bin_setup_path)
|
29
29
|
|
30
|
-
expect(bin_setup).to
|
31
|
-
expect(bin_setup).to
|
30
|
+
expect(bin_setup).to assert_access_to_heroku_app("#{app_name}-production")
|
31
|
+
expect(bin_setup).to assert_access_to_heroku_app("#{app_name}-staging")
|
32
32
|
expect(bin_setup).to match(/^git config heroku.remote staging/)
|
33
33
|
expect("bin/setup").to be_executable
|
34
34
|
|
@@ -36,24 +36,13 @@ RSpec.describe "Heroku" do
|
|
36
36
|
|
37
37
|
expect(readme).to include("./bin/deploy staging")
|
38
38
|
expect(readme).to include("./bin/deploy production")
|
39
|
-
|
40
|
-
circle_yml_path = "#{project_path}/circle.yml"
|
41
|
-
circle_yml = IO.read(circle_yml_path)
|
42
|
-
|
43
|
-
expect(circle_yml).to include <<-YML.strip_heredoc
|
44
|
-
deployment:
|
45
|
-
staging:
|
46
|
-
branch: master
|
47
|
-
commands:
|
48
|
-
- bin/deploy staging
|
49
|
-
YML
|
50
39
|
end
|
51
40
|
end
|
52
41
|
|
53
42
|
context "--heroku with region flag" do
|
54
43
|
before(:all) do
|
55
44
|
clean_up
|
56
|
-
run_suspenders(%
|
45
|
+
run_suspenders(%(--heroku=true --heroku-flags="--region eu"))
|
57
46
|
setup_app_dependencies
|
58
47
|
end
|
59
48
|
|
@@ -63,6 +52,10 @@ RSpec.describe "Heroku" do
|
|
63
52
|
end
|
64
53
|
end
|
65
54
|
|
55
|
+
def assert_access_to_heroku_app(app_name)
|
56
|
+
match(/^if heroku apps:info --app #{app_name}/)
|
57
|
+
end
|
58
|
+
|
66
59
|
def clean_up
|
67
60
|
drop_dummy_database
|
68
61
|
remove_project_directory
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe "suspenders:inline_svg", type: :generator do
|
4
|
+
it "generates the configuration for inline_svg" do
|
5
|
+
with_app { generate("suspenders:inline_svg") }
|
6
|
+
|
7
|
+
expect("config/initializers/inline_svg.rb").to match_contents(/InlineSvg/)
|
8
|
+
expect("Gemfile").to match_contents(/inline_svg/)
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe "suspenders:lint", type: :generator do
|
4
|
+
it "sets up standard" do
|
5
|
+
with_app { generate("suspenders:lint") }
|
6
|
+
|
7
|
+
expect("Gemfile").to match_contents(/standard/)
|
8
|
+
|
9
|
+
run_in_project do
|
10
|
+
expect(`rake -T`).to include("rake standard")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
it "removes standard" do
|
15
|
+
with_app do
|
16
|
+
generate("suspenders:lint")
|
17
|
+
destroy("suspenders:lint")
|
18
|
+
end
|
19
|
+
|
20
|
+
expect("Gemfile").not_to match_contents(/standard/)
|
21
|
+
|
22
|
+
run_in_project do
|
23
|
+
expect(`rake -T`).not_to include("rake standard")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -11,27 +11,27 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
11
11
|
it "uses custom Gemfile" do
|
12
12
|
gemfile_file = IO.read("#{project_path}/Gemfile")
|
13
13
|
expect(gemfile_file).to match(
|
14
|
-
/^ruby "#{Suspenders::RUBY_VERSION}"
|
14
|
+
/^ruby "#{Suspenders::RUBY_VERSION}"$/
|
15
15
|
)
|
16
16
|
expect(gemfile_file).to match(
|
17
|
-
/^gem "autoprefixer-rails"
|
17
|
+
/^gem "autoprefixer-rails"$/
|
18
18
|
)
|
19
19
|
expect(gemfile_file).to match(
|
20
|
-
/^gem "rails", "#{Suspenders::RAILS_VERSION}"
|
20
|
+
/^gem "rails", "#{Suspenders::RAILS_VERSION}"$/
|
21
21
|
)
|
22
22
|
end
|
23
23
|
|
24
24
|
it "ensures project specs pass" do
|
25
25
|
Dir.chdir(project_path) do
|
26
|
-
Bundler.
|
27
|
-
expect(`rake`).to include(
|
26
|
+
Bundler.with_unbundled_env do
|
27
|
+
expect(`rake`).to include("0 failures")
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
it "includes the bundle:audit task" do
|
33
33
|
Dir.chdir(project_path) do
|
34
|
-
Bundler.
|
34
|
+
Bundler.with_unbundled_env do
|
35
35
|
expect(`rails -T`).to include("rails bundle:audit")
|
36
36
|
end
|
37
37
|
end
|
@@ -44,9 +44,7 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
44
44
|
end
|
45
45
|
|
46
46
|
it "copies dotfiles" do
|
47
|
-
|
48
|
-
expect(File).to exist("#{project_path}/#{dotfile}")
|
49
|
-
end
|
47
|
+
expect(File).to exist("#{project_path}/.sample.env")
|
50
48
|
end
|
51
49
|
|
52
50
|
it "doesn't generate test directory" do
|
@@ -56,8 +54,8 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
56
54
|
it "loads secret_key_base from env" do
|
57
55
|
secrets_file = IO.read("#{project_path}/config/secrets.yml")
|
58
56
|
|
59
|
-
expect(secrets_file)
|
60
|
-
to match(/secret_key_base: <%= ENV\["SECRET_KEY_BASE"\] %>/)
|
57
|
+
expect(secrets_file)
|
58
|
+
.to match(/secret_key_base: <%= ENV\["SECRET_KEY_BASE"\] %>/)
|
61
59
|
end
|
62
60
|
|
63
61
|
it "adds bin/setup file" do
|
@@ -86,33 +84,16 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
86
84
|
expect(hound_config_file).to include "enabled: true"
|
87
85
|
end
|
88
86
|
|
89
|
-
it "ensures Gemfile contains `rack-mini-profiler`" do
|
90
|
-
gemfile = IO.read("#{project_path}/Gemfile")
|
91
|
-
|
92
|
-
expect(gemfile).to include %{gem "rack-mini-profiler", require: false}
|
93
|
-
end
|
94
|
-
|
95
|
-
it "ensures .sample.env defaults to RACK_MINI_PROFILER=0" do
|
96
|
-
env = IO.read("#{project_path}/.env")
|
97
|
-
|
98
|
-
expect(env).to include "RACK_MINI_PROFILER=0"
|
99
|
-
end
|
100
|
-
|
101
87
|
it "initializes ActiveJob to avoid memory bloat" do
|
102
|
-
expect(File)
|
103
|
-
to exist("#{project_path}/config/initializers/active_job.rb")
|
104
|
-
end
|
105
|
-
|
106
|
-
it "creates a rack-mini-profiler initializer" do
|
107
|
-
expect(File).
|
108
|
-
to exist("#{project_path}/config/initializers/rack_mini_profiler.rb")
|
88
|
+
expect(File)
|
89
|
+
.to exist("#{project_path}/config/initializers/active_job.rb")
|
109
90
|
end
|
110
91
|
|
111
92
|
it "records pageviews through Segment if ENV variable set" do
|
112
|
-
expect(analytics_partial)
|
113
|
-
to include(%
|
114
|
-
expect(analytics_partial)
|
115
|
-
to include(%{analytics.load("<%= ENV["SEGMENT_KEY"] %>");})
|
93
|
+
expect(analytics_partial)
|
94
|
+
.to include(%(<% if ENV["SEGMENT_KEY"] %>))
|
95
|
+
expect(analytics_partial)
|
96
|
+
.to include(%{analytics.load("<%= ENV["SEGMENT_KEY"] %>");})
|
116
97
|
end
|
117
98
|
|
118
99
|
it "raises on unpermitted parameters in all environments" do
|
@@ -131,13 +112,13 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
131
112
|
|
132
113
|
it "configures public_file_server.headers in production" do
|
133
114
|
expect(production_config).to match(
|
134
|
-
/^ +config.public_file_server.headers = {\n +"Cache-Control" => "public
|
115
|
+
/^ +config.public_file_server.headers = {\n +"Cache-Control" => "public,/
|
135
116
|
)
|
136
117
|
end
|
137
118
|
|
138
119
|
it "configures production environment to enforce SSL" do
|
139
120
|
expect(production_config).to match(
|
140
|
-
/^ +config.force_ssl = true
|
121
|
+
/^ +config.force_ssl = true/
|
141
122
|
)
|
142
123
|
end
|
143
124
|
|
@@ -160,8 +141,8 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
160
141
|
end
|
161
142
|
|
162
143
|
it "configs :test email delivery method for development" do
|
163
|
-
expect(development_config)
|
164
|
-
to match(/^ +config.action_mailer.delivery_method = :file$/)
|
144
|
+
expect(development_config)
|
145
|
+
.to match(/^ +config.action_mailer.delivery_method = :file$/)
|
165
146
|
end
|
166
147
|
|
167
148
|
it "sets action mailer default host and asset host" do
|
@@ -180,8 +161,8 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
180
161
|
email_file = File.join(project_path, "config", "initializers", "email.rb")
|
181
162
|
email_config = IO.read(email_file)
|
182
163
|
|
183
|
-
expect(email_config)
|
184
|
-
to include(%{RecipientInterceptor.new(ENV["EMAIL_RECIPIENTS"])})
|
164
|
+
expect(email_config)
|
165
|
+
.to include(%{RecipientInterceptor.new(ENV["EMAIL_RECIPIENTS"])})
|
185
166
|
end
|
186
167
|
|
187
168
|
it "configures language in html element" do
|
@@ -205,26 +186,28 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
205
186
|
delayed_job = IO.read("#{project_path}/bin/delayed_job")
|
206
187
|
|
207
188
|
expect(delayed_job).to match(
|
208
|
-
/^require 'delayed\/command'
|
189
|
+
/^require 'delayed\/command'$/
|
209
190
|
)
|
210
191
|
end
|
211
192
|
|
212
193
|
it "configs bullet gem in development" do
|
213
|
-
expect(development_config).to match
|
214
|
-
expect(development_config).to match
|
215
|
-
expect(development_config).to match
|
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
|
+
# prevent broken result of standard removing whitespaces
|
198
|
+
expect(development_config).to_not match(/trueconfig/)
|
216
199
|
end
|
217
200
|
|
218
201
|
it "configs missing assets to raise in test" do
|
219
202
|
expect(test_config).to match(
|
220
|
-
/^ +config.assets.raise_runtime_errors = true
|
203
|
+
/^ +config.assets.raise_runtime_errors = true$/
|
221
204
|
)
|
222
205
|
end
|
223
206
|
|
224
207
|
it "adds spring to binstubs" do
|
225
208
|
expect(File).to exist("#{project_path}/bin/spring")
|
226
209
|
|
227
|
-
bin_stubs = %w
|
210
|
+
bin_stubs = %w[rake rails rspec]
|
228
211
|
bin_stubs.each do |bin_stub|
|
229
212
|
expect(IO.read("#{project_path}/bin/#{bin_stub}")).to match(/spring/)
|
230
213
|
end
|
@@ -236,7 +219,7 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
236
219
|
IO.read("#{project_path}/config/environment.rb"),
|
237
220
|
development_config,
|
238
221
|
test_config,
|
239
|
-
production_config
|
222
|
+
production_config
|
240
223
|
]
|
241
224
|
|
242
225
|
config_files.each do |file|
|
@@ -256,8 +239,6 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
256
239
|
|
257
240
|
expect(bin_setup).to include("PARENT_APP_NAME=#{app_name.dasherize}-staging")
|
258
241
|
expect(bin_setup).to include("APP_NAME=#{app_name.dasherize}-staging-pr-$1")
|
259
|
-
expect(bin_setup).
|
260
|
-
to include("heroku run rails db:migrate --exit-code --app $APP_NAME")
|
261
242
|
expect(bin_setup).to include("heroku ps:scale worker=1 --app $APP_NAME")
|
262
243
|
expect(bin_setup).to include("heroku restart --app $APP_NAME")
|
263
244
|
|
@@ -268,7 +249,7 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
268
249
|
bin_deploy_path = "#{project_path}/bin/deploy"
|
269
250
|
bin_deploy = IO.read(bin_deploy_path)
|
270
251
|
|
271
|
-
expect(bin_deploy).to include("
|
252
|
+
expect(bin_deploy).to include("git push")
|
272
253
|
expect("bin/deploy").to be_executable
|
273
254
|
end
|
274
255
|
|
@@ -293,42 +274,41 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
293
274
|
expect(gemfile).to match(/sassc-rails/)
|
294
275
|
end
|
295
276
|
|
296
|
-
it "adds and configures bourbon
|
277
|
+
it "adds and configures bourbon" do
|
297
278
|
gemfile = read_project_file("Gemfile")
|
298
279
|
|
299
280
|
expect(gemfile).to match(/bourbon/)
|
300
|
-
expect(gemfile).to match(/neat/)
|
301
281
|
end
|
302
282
|
|
303
|
-
it "configures bourbon,
|
304
|
-
app_css = read_project_file(%w
|
283
|
+
it "configures bourbon, and bitters" do
|
284
|
+
app_css = read_project_file(%w[app assets stylesheets application.scss])
|
305
285
|
expect(app_css).to match(
|
306
|
-
/normalize\.css\/normalize.*bourbon.*
|
286
|
+
/normalize\.css\/normalize.*bourbon.*base/m
|
307
287
|
)
|
308
288
|
end
|
309
289
|
|
310
290
|
it "doesn't use turbolinks" do
|
311
|
-
app_js = read_project_file(%w
|
291
|
+
app_js = read_project_file(%w[app javascript packs application.js])
|
312
292
|
expect(app_js).not_to match(/turbolinks/)
|
313
293
|
end
|
314
294
|
|
315
295
|
it "configures Timecop safe mode" do
|
316
|
-
spec_helper = read_project_file(%w
|
296
|
+
spec_helper = read_project_file(%w[spec spec_helper.rb])
|
317
297
|
expect(spec_helper).to match(/Timecop.safe_mode = true/)
|
318
298
|
end
|
319
299
|
|
320
300
|
def development_config
|
321
301
|
@_development_config ||=
|
322
|
-
read_project_file %w
|
302
|
+
read_project_file %w[config environments development.rb]
|
323
303
|
end
|
324
304
|
|
325
305
|
def test_config
|
326
|
-
@_test_config ||= read_project_file %w
|
306
|
+
@_test_config ||= read_project_file %w[config environments test.rb]
|
327
307
|
end
|
328
308
|
|
329
309
|
def production_config
|
330
310
|
@_production_config ||=
|
331
|
-
read_project_file %w
|
311
|
+
read_project_file %w[config environments production.rb]
|
332
312
|
end
|
333
313
|
|
334
314
|
def analytics_partial
|
@@ -0,0 +1,25 @@
|
|
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
|