suspenders 1.50.0 → 1.54.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/.travis.yml +6 -4
- data/CONTRIBUTING.md +15 -15
- data/GOALS.md +65 -0
- data/NEWS.md +55 -0
- data/README.md +7 -4
- data/docs/heroku_deploy.md +19 -0
- data/lib/suspenders.rb +10 -0
- data/lib/suspenders/actions.rb +2 -2
- data/lib/suspenders/adapters/heroku.rb +14 -5
- data/lib/suspenders/app_builder.rb +3 -91
- data/lib/suspenders/generators/advisories_generator.rb +15 -0
- data/lib/suspenders/generators/analytics_generator.rb +2 -7
- data/lib/suspenders/generators/app_generator.rb +14 -41
- data/lib/suspenders/generators/base.rb +59 -0
- data/lib/suspenders/generators/ci_generator.rb +20 -14
- data/lib/suspenders/generators/db_optimizations_generator.rb +6 -18
- data/lib/suspenders/generators/factories_generator.rb +3 -8
- data/lib/suspenders/generators/forms_generator.rb +3 -3
- data/lib/suspenders/generators/inline_svg_generator.rb +14 -0
- data/lib/suspenders/generators/jobs_generator.rb +3 -13
- data/lib/suspenders/generators/js_driver_generator.rb +9 -11
- data/lib/suspenders/generators/json_generator.rb +3 -3
- data/lib/suspenders/generators/lint_generator.rb +2 -7
- 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 +16 -0
- data/lib/suspenders/generators/production/email_generator.rb +7 -18
- data/lib/suspenders/generators/production/force_tls_generator.rb +2 -5
- data/lib/suspenders/generators/production/manifest_generator.rb +25 -0
- 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 -26
- data/lib/suspenders/generators/static_generator.rb +7 -3
- data/lib/suspenders/generators/stylelint_generator.rb +70 -0
- data/lib/suspenders/generators/stylesheet_base_generator.rb +8 -13
- data/lib/suspenders/generators/testing_generator.rb +6 -22
- data/lib/suspenders/generators/views_generator.rb +2 -7
- data/lib/suspenders/version.rb +2 -2
- data/spec/adapters/heroku_spec.rb +28 -2
- data/spec/expand_json_spec.rb +89 -0
- 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/db_optimizations_spec.rb +19 -0
- data/spec/features/heroku_spec.rb +7 -14
- data/spec/features/inline_svg_spec.rb +10 -0
- data/spec/features/json_spec.rb +1 -1
- data/spec/features/new_project_spec.rb +17 -35
- data/spec/features/preloader_spec.rb +25 -0
- data/spec/features/production/compression_spec.rb +23 -0
- data/spec/features/production/deployment_spec.rb +22 -0
- data/spec/features/production/email_spec.rb +1 -1
- data/spec/features/production/manifest_spec.rb +37 -0
- 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 +60 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/support/be_executable_matcher.rb +7 -0
- data/spec/support/contain_json_matcher.rb +16 -10
- data/spec/support/generators.rb +5 -0
- data/spec/support/project_files.rb +25 -0
- data/spec/support/rails_template.rb +1 -0
- data/spec/support/suspenders.rb +18 -15
- data/suspenders.gemspec +1 -1
- data/templates/Gemfile.erb +5 -11
- 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/hound.yml +3 -1
- data/templates/inline_svg.rb +3 -0
- data/templates/partials/ci_simplecov.rb +16 -0
- data/templates/partials/db_optimizations_configuration.rb +7 -0
- data/templates/partials/deployment_readme.md +8 -0
- data/templates/partials/email_smtp.rb +3 -0
- data/templates/partials/profiler_readme.md +8 -0
- data/templates/partials/pull_requests_config.rb +5 -0
- data/templates/partials/runner_readme.md +31 -0
- data/templates/partials/runner_setup.rb +3 -0
- data/templates/rack_mini_profiler.rb +2 -0
- data/templates/rails_helper.rb +7 -4
- data/templates/{dotfiles/.env → sample_env} +0 -2
- data/templates/spec_helper.rb +4 -7
- data/templates/spring.rb +6 -0
- data/templates/stylelintrc.json +3 -0
- data/templates/suspenders_gitignore +1 -1
- metadata +119 -17
- data/templates/app.json.erb +0 -27
- data/templates/browserslist +0 -3
- data/templates/dotfiles/.ctags +0 -2
- data/templates/puma.rb +0 -28
@@ -1,12 +1,7 @@
|
|
1
|
-
|
1
|
+
require_relative "base"
|
2
2
|
|
3
3
|
module Suspenders
|
4
|
-
class ViewsGenerator <
|
5
|
-
source_root File.expand_path(
|
6
|
-
File.join("..", "..", "..", "templates"),
|
7
|
-
File.dirname(__FILE__),
|
8
|
-
)
|
9
|
-
|
4
|
+
class ViewsGenerator < Generators::Base
|
10
5
|
def create_partials_directory
|
11
6
|
empty_directory "app/views/application"
|
12
7
|
end
|
data/lib/suspenders/version.rb
CHANGED
@@ -11,9 +11,9 @@ module Suspenders
|
|
11
11
|
Heroku.new(app_builder).set_heroku_remotes
|
12
12
|
|
13
13
|
expect(app_builder).to have_received(:append_file).
|
14
|
-
with(setup_file, /heroku
|
14
|
+
with(setup_file, /heroku apps:info --app #{app_name.dasherize}-production/)
|
15
15
|
expect(app_builder).to have_received(:append_file).
|
16
|
-
with(setup_file, /heroku
|
16
|
+
with(setup_file, /heroku apps:info --app #{app_name.dasherize}-staging/)
|
17
17
|
end
|
18
18
|
|
19
19
|
it "sets the heroku rails secrets" do
|
@@ -55,6 +55,26 @@ module Suspenders
|
|
55
55
|
)
|
56
56
|
end
|
57
57
|
|
58
|
+
it "configures nodejs and ruby packs" do
|
59
|
+
app_builder = double(app_name: app_name)
|
60
|
+
allow(app_builder).to receive(:run)
|
61
|
+
|
62
|
+
Heroku.new(app_builder).set_heroku_buildpacks
|
63
|
+
|
64
|
+
%w(staging production).each do |remote|
|
65
|
+
expect(app_builder).to(
|
66
|
+
have_configured_buildpack(
|
67
|
+
remote_name: remote, index: 1, packname: "heroku/nodejs",
|
68
|
+
),
|
69
|
+
)
|
70
|
+
expect(app_builder).to(
|
71
|
+
have_configured_buildpack(
|
72
|
+
remote_name: remote, index: 2, packname: "heroku/ruby",
|
73
|
+
),
|
74
|
+
)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
58
78
|
def app_name
|
59
79
|
SuspendersTestHelpers::APP_NAME
|
60
80
|
end
|
@@ -67,6 +87,12 @@ module Suspenders
|
|
67
87
|
def have_configured_var(remote_name, var)
|
68
88
|
have_received(:run).with(/config:add #{var}=.+ --remote #{remote_name}/)
|
69
89
|
end
|
90
|
+
|
91
|
+
def have_configured_buildpack(remote_name:, index:, packname:)
|
92
|
+
have_received(:run).with(
|
93
|
+
/buildpacks:add --index #{index} #{packname} --remote #{remote_name}/,
|
94
|
+
)
|
95
|
+
end
|
70
96
|
end
|
71
97
|
end
|
72
98
|
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Suspenders::Actions::ExpandJson do
|
4
|
+
let(:destination_root) { File.join(root_path, "tmp") }
|
5
|
+
let(:destination_file_name) { "app.json" }
|
6
|
+
let(:destination_path) { File.join(destination_root, destination_file_name) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
FileUtils.rm destination_path if File.exist?(destination_path)
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "#invoke!" do
|
13
|
+
context "when calling multiple times with the same root key" do
|
14
|
+
before do
|
15
|
+
described_class.new(
|
16
|
+
destination_root,
|
17
|
+
destination_file_name,
|
18
|
+
env: {
|
19
|
+
SMTP_ADDRESS: { required: true },
|
20
|
+
},
|
21
|
+
).invoke!
|
22
|
+
end
|
23
|
+
|
24
|
+
it "deep merges the hash" do
|
25
|
+
described_class.new(
|
26
|
+
destination_root,
|
27
|
+
destination_file_name,
|
28
|
+
env: {
|
29
|
+
HEROKU_APP_NAME: { required: true },
|
30
|
+
},
|
31
|
+
).invoke!
|
32
|
+
|
33
|
+
expected = <<~JSON
|
34
|
+
{
|
35
|
+
"env": {
|
36
|
+
"SMTP_ADDRESS": {
|
37
|
+
"required": true
|
38
|
+
},
|
39
|
+
"HEROKU_APP_NAME": {
|
40
|
+
"required": true
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
JSON
|
45
|
+
expect(existing_json).to eq(expected.chomp)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "#revoke!" do
|
51
|
+
before do
|
52
|
+
described_class.new(
|
53
|
+
destination_root,
|
54
|
+
destination_file_name,
|
55
|
+
env: {
|
56
|
+
foo: { required: true },
|
57
|
+
bar: { required: true },
|
58
|
+
},
|
59
|
+
).invoke!
|
60
|
+
end
|
61
|
+
|
62
|
+
it "removes data from the JSON" do
|
63
|
+
described_class.new(
|
64
|
+
destination_root,
|
65
|
+
destination_file_name,
|
66
|
+
env: {
|
67
|
+
foo: { required: true },
|
68
|
+
},
|
69
|
+
).revoke!
|
70
|
+
|
71
|
+
expected = <<~JSON
|
72
|
+
{
|
73
|
+
"env": {
|
74
|
+
"bar": {
|
75
|
+
"required": true
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
JSON
|
80
|
+
expect(existing_json).to eq(expected.chomp)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
private
|
85
|
+
|
86
|
+
def existing_json
|
87
|
+
IO.read(destination_path)
|
88
|
+
end
|
89
|
+
end
|
@@ -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
|
@@ -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
|
@@ -27,26 +27,15 @@ 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
|
-
expect(
|
33
|
+
expect("bin/setup").to be_executable
|
34
34
|
|
35
35
|
readme = IO.read("#{project_path}/README.md")
|
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
|
|
@@ -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
|
data/spec/features/json_spec.rb
CHANGED
@@ -23,7 +23,7 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
23
23
|
|
24
24
|
it "ensures project specs pass" do
|
25
25
|
Dir.chdir(project_path) do
|
26
|
-
Bundler.
|
26
|
+
Bundler.with_unbundled_env do
|
27
27
|
expect(`rake`).to include('0 failures')
|
28
28
|
end
|
29
29
|
end
|
@@ -31,7 +31,7 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
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}/.env")
|
50
48
|
end
|
51
49
|
|
52
50
|
it "doesn't generate test directory" do
|
@@ -65,9 +63,7 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
65
63
|
end
|
66
64
|
|
67
65
|
it "makes bin/setup executable" do
|
68
|
-
|
69
|
-
|
70
|
-
expect(File.stat(bin_setup_path)).to be_executable
|
66
|
+
expect("bin/setup").to be_executable
|
71
67
|
end
|
72
68
|
|
73
69
|
it "adds support file for action mailer" do
|
@@ -88,28 +84,11 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
88
84
|
expect(hound_config_file).to include "enabled: true"
|
89
85
|
end
|
90
86
|
|
91
|
-
it "ensures Gemfile contains `rack-mini-profiler`" do
|
92
|
-
gemfile = IO.read("#{project_path}/Gemfile")
|
93
|
-
|
94
|
-
expect(gemfile).to include %{gem "rack-mini-profiler", require: false}
|
95
|
-
end
|
96
|
-
|
97
|
-
it "ensures .sample.env defaults to RACK_MINI_PROFILER=0" do
|
98
|
-
env = IO.read("#{project_path}/.env")
|
99
|
-
|
100
|
-
expect(env).to include "RACK_MINI_PROFILER=0"
|
101
|
-
end
|
102
|
-
|
103
87
|
it "initializes ActiveJob to avoid memory bloat" do
|
104
88
|
expect(File).
|
105
89
|
to exist("#{project_path}/config/initializers/active_job.rb")
|
106
90
|
end
|
107
91
|
|
108
|
-
it "creates a rack-mini-profiler initializer" do
|
109
|
-
expect(File).
|
110
|
-
to exist("#{project_path}/config/initializers/rack_mini_profiler.rb")
|
111
|
-
end
|
112
|
-
|
113
92
|
it "records pageviews through Segment if ENV variable set" do
|
114
93
|
expect(analytics_partial).
|
115
94
|
to include(%{<% if ENV["SEGMENT_KEY"] %>})
|
@@ -258,20 +237,18 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
258
237
|
|
259
238
|
expect(bin_setup).to include("PARENT_APP_NAME=#{app_name.dasherize}-staging")
|
260
239
|
expect(bin_setup).to include("APP_NAME=#{app_name.dasherize}-staging-pr-$1")
|
261
|
-
expect(bin_setup).
|
262
|
-
to include("heroku run rails db:migrate --exit-code --app $APP_NAME")
|
263
240
|
expect(bin_setup).to include("heroku ps:scale worker=1 --app $APP_NAME")
|
264
241
|
expect(bin_setup).to include("heroku restart --app $APP_NAME")
|
265
242
|
|
266
|
-
expect(
|
243
|
+
expect("bin/setup_review_app").to be_executable
|
267
244
|
end
|
268
245
|
|
269
246
|
it "creates deploy script" do
|
270
247
|
bin_deploy_path = "#{project_path}/bin/deploy"
|
271
248
|
bin_deploy = IO.read(bin_deploy_path)
|
272
249
|
|
273
|
-
expect(bin_deploy).to include("
|
274
|
-
expect(
|
250
|
+
expect(bin_deploy).to include("git push")
|
251
|
+
expect("bin/deploy").to be_executable
|
275
252
|
end
|
276
253
|
|
277
254
|
it "creates heroku application manifest file with application name in it" do
|
@@ -289,22 +266,27 @@ RSpec.describe "Suspend a new project with default configuration" do
|
|
289
266
|
expect(gemfile).to match(/high_voltage/)
|
290
267
|
end
|
291
268
|
|
292
|
-
it "adds
|
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
|
293
276
|
gemfile = read_project_file("Gemfile")
|
294
277
|
|
295
278
|
expect(gemfile).to match(/bourbon/)
|
296
|
-
expect(gemfile).to match(/neat/)
|
297
279
|
end
|
298
280
|
|
299
|
-
it "configures bourbon,
|
281
|
+
it "configures bourbon, and bitters" do
|
300
282
|
app_css = read_project_file(%w(app assets stylesheets application.scss))
|
301
283
|
expect(app_css).to match(
|
302
|
-
/normalize\.css\/normalize.*bourbon.*
|
284
|
+
/normalize\.css\/normalize.*bourbon.*base/m,
|
303
285
|
)
|
304
286
|
end
|
305
287
|
|
306
288
|
it "doesn't use turbolinks" do
|
307
|
-
app_js = read_project_file(%w(app
|
289
|
+
app_js = read_project_file(%w(app javascript packs application.js))
|
308
290
|
expect(app_js).not_to match(/turbolinks/)
|
309
291
|
end
|
310
292
|
|
@@ -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
|