spec/features/new_project_spec.rb in slining-1.1.0 vs spec/features/new_project_spec.rb in slining-1.2.0
- old
+ new
@@ -27,20 +27,28 @@
ruby_version_file = IO.read("#{project_path}/.ruby-version")
expect(ruby_version_file).to eq "#{RUBY_VERSION}\n"
end
+ it "copies dotfiles" do
+ expect(File).to exist("#{project_path}/.ctags")
+ end
+
it "loads secret_key_base from env" do
secrets_file = IO.read("#{project_path}/config/secrets.yml")
expect(secrets_file).to match(/secret_key_base: <%= ENV\["SECRET_KEY_BASE"\] %>/)
end
it "adds support file for action mailer" do
expect(File).to exist("#{project_path}/spec/support/action_mailer.rb")
end
+ it "configures capybara-webkit" do
+ expect(File).to exist("#{project_path}/spec/support/capybara_webkit.rb")
+ end
+
it "adds support file for i18n" do
expect(File).to exist("#{project_path}/spec/support/i18n.rb")
end
it "creates good default .hound.yml" do
@@ -70,10 +78,18 @@
expect(result).to match(
/^ +config.action_controller.action_on_unpermitted_parameters = :raise$/
)
end
+ it "adds explicit quiet_assets configuration" do
+ result = IO.read("#{project_path}/config/application.rb")
+
+ expect(result).to match(
+ /^ +config.quiet_assets = true$/
+ )
+ end
+
it "raises on missing translations in development and test" do
%w[development test].each do |environment|
environment_file =
IO.read("#{project_path}/config/environments/#{environment}.rb")
expect(environment_file).to match(
@@ -105,10 +121,16 @@
dev_env_file = IO.read("#{project_path}/config/environments/development.rb")
expect(dev_env_file).
to match(/^ +config.action_mailer.delivery_method = :test$/)
end
+ it "uses APPLICATION_HOST, not HOST in the production config" do
+ prod_env_file = IO.read("#{project_path}/config/environments/production.rb")
+ expect(prod_env_file).to match(/"APPLICATION_HOST"/)
+ expect(prod_env_file).not_to match(/"HOST"/)
+ end
+
it "configs active job queue adapter" do
application_config = IO.read("#{project_path}/config/application.rb")
test_config = IO.read("#{project_path}/config/environments/test.rb")
expect(application_config).to match(
@@ -117,17 +139,57 @@
expect(test_config).to match(
/^ +config.active_job.queue_adapter = :inline$/
)
end
+ it "configs bullet gem in development" do
+ test_config = IO.read("#{project_path}/config/environments/development.rb")
+
+ expect(test_config).to match /^ +Bullet.enable = true$/
+ expect(test_config).to match /^ +Bullet.bullet_logger = true$/
+ expect(test_config).to match /^ +Bullet.rails_logger = true$/
+ end
+
+ it "configs missing assets to raise in test" do
+ test_config = IO.read("#{project_path}/config/environments/test.rb")
+ expect(test_config).to match /^ +config.assets.raise_runtime_errors = true$/
+ end
+
it "adds spring to binstubs" do
expect(File).to exist("#{project_path}/bin/spring")
- spring_line = /^ +load File.expand_path\("\.\.\/spring", __FILE__\)$/
- bin_stubs = %w(rake rails rspec)
- bin_stubs.each do |bin_stub|
- expect(IO.read("#{project_path}/bin/#{bin_stub}")).to match(spring_line)
+ bin_stub_files = [
+ IO.read("#{project_path}/bin/rails"),
+ IO.read("#{project_path}/bin/rake"),
+ IO.read("#{project_path}/bin/rspec"),
+ ]
+
+ spring_line1 = /^ +spring_bin_path = File.expand_path\('\.\.\/spring', __FILE__\)$/
+ spring_line2 = /^ +load spring_bin_path$/
+
+ bin_stub_files.each do |file|
+ expect(file).to match(spring_line1)
+ expect(file).to match(spring_line2)
end
+ end
+
+ it "removes comments and extra newlines from config files" do
+ config_files = [
+ IO.read("#{project_path}/config/application.rb"),
+ IO.read("#{project_path}/config/environment.rb"),
+ IO.read("#{project_path}/config/environments/development.rb"),
+ IO.read("#{project_path}/config/environments/production.rb"),
+ IO.read("#{project_path}/config/environments/test.rb"),
+ ]
+
+ config_files.each do |file|
+ expect(file).not_to match(/.*#.*/)
+ expect(file).not_to match(/^$\n/)
+ end
+ end
+
+ it "copies factories.rb" do
+ expect(File).to exist("#{project_path}/spec/factories.rb")
end
def analytics_partial
IO.read("#{project_path}/app/views/application/_analytics.html.erb")
end