hitfox-suspenders 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.ruby-version +1 -0
- data/CONTRIBUTING.md +48 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +139 -0
- data/LICENSE +21 -0
- data/NEWS.md +373 -0
- data/README.md +43 -0
- data/Rakefile +8 -0
- data/bin/hitfox-suspenders +18 -0
- data/bin/rake +16 -0
- data/bin/rspec +16 -0
- data/bin/setup +13 -0
- data/lib/suspenders/actions.rb +33 -0
- data/lib/suspenders/app_builder.rb +342 -0
- data/lib/suspenders/generators/app_generator.rb +196 -0
- data/lib/suspenders/version.rb +5 -0
- data/lib/suspenders.rb +4 -0
- data/spec/fakes/bin/hub +5 -0
- data/spec/features/github_spec.rb +10 -0
- data/spec/features/new_project_spec.rb +108 -0
- data/spec/spec_helper.rb +23 -0
- data/spec/support/fake_github.rb +21 -0
- data/spec/support/suspenders.rb +49 -0
- data/suspenders.gemspec +36 -0
- data/templates/Gemfile.erb +48 -0
- data/templates/README.md.erb +42 -0
- data/templates/_flashes.html.erb +7 -0
- data/templates/_javascript.html.erb +12 -0
- data/templates/action_mailer.rb +5 -0
- data/templates/application.css.scss +8 -0
- data/templates/bin_setup.erb +36 -0
- data/templates/bundler_audit.rake +12 -0
- data/templates/circle.yml +3 -0
- data/templates/config_i18n_tasks.yml +13 -0
- data/templates/config_locales_en.yml.erb +19 -0
- data/templates/database_cleaner_rspec.rb +21 -0
- data/templates/development_seeds.rb +12 -0
- data/templates/disable_xml_params.rb +3 -0
- data/templates/errors.rb +34 -0
- data/templates/factory_girl_rspec.rb +3 -0
- data/templates/flashes_helper.rb +5 -0
- data/templates/i18n.rb +3 -0
- data/templates/json_encoding.rb +1 -0
- data/templates/mandrill.rb +3 -0
- data/templates/postgresql_database.yml.erb +11 -0
- data/templates/rails_helper.rb +23 -0
- data/templates/sample.env +3 -0
- data/templates/secrets.yml +14 -0
- data/templates/spec_helper.rb +22 -0
- data/templates/staging.rb +5 -0
- data/templates/suspenders_gitignore +14 -0
- data/templates/suspenders_layout.html.erb.erb +21 -0
- data/templates/travis.yml.erb +21 -0
- metadata +187 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
feature 'Suspend a new project with default configuration' do
|
|
4
|
+
scenario 'specs pass' do
|
|
5
|
+
run_suspenders
|
|
6
|
+
|
|
7
|
+
Dir.chdir(project_path) do
|
|
8
|
+
Bundler.with_clean_env do
|
|
9
|
+
expect(`rake`).to include('0 failures')
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
scenario 'staging config is inherited from production' do
|
|
15
|
+
run_suspenders
|
|
16
|
+
|
|
17
|
+
staging_file = IO.read("#{project_path}/config/environments/staging.rb")
|
|
18
|
+
config_stub = "Rails.application.configure do"
|
|
19
|
+
|
|
20
|
+
expect(staging_file).to match(/^require_relative "production"/)
|
|
21
|
+
expect(staging_file).to match(/#{config_stub}/), staging_file
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
scenario 'generated .ruby-version is pulled from Suspenders .ruby-version' do
|
|
25
|
+
run_suspenders
|
|
26
|
+
|
|
27
|
+
ruby_version_file = IO.read("#{project_path}/.ruby-version")
|
|
28
|
+
|
|
29
|
+
expect(ruby_version_file).to eq "#{RUBY_VERSION}\n"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
scenario 'secrets.yml reads secret from env' do
|
|
33
|
+
run_suspenders
|
|
34
|
+
|
|
35
|
+
secrets_file = IO.read("#{project_path}/config/secrets.yml")
|
|
36
|
+
|
|
37
|
+
expect(secrets_file).to match(/secret_key_base: <%= ENV\["SECRET_KEY_BASE"\] %>/)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
scenario 'action mailer support file is added' do
|
|
41
|
+
run_suspenders
|
|
42
|
+
|
|
43
|
+
expect(File).to exist("#{project_path}/spec/support/action_mailer.rb")
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
scenario "i18n support file is added" do
|
|
47
|
+
run_suspenders
|
|
48
|
+
|
|
49
|
+
expect(File).to exist("#{project_path}/spec/support/i18n.rb")
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
scenario "raises on unpermitted parameters in all environments" do
|
|
53
|
+
run_suspenders
|
|
54
|
+
|
|
55
|
+
result = IO.read("#{project_path}/config/application.rb")
|
|
56
|
+
|
|
57
|
+
expect(result).to match(
|
|
58
|
+
/^ +config.action_controller.action_on_unpermitted_parameters = :raise$/
|
|
59
|
+
)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
scenario "raises on missing translations in development and test" do
|
|
63
|
+
run_suspenders
|
|
64
|
+
|
|
65
|
+
%w[development test].each do |environment|
|
|
66
|
+
environment_file =
|
|
67
|
+
IO.read("#{project_path}/config/environments/#{environment}.rb")
|
|
68
|
+
expect(environment_file).to match(
|
|
69
|
+
/^ +config.action_view.raise_on_missing_translations = true$/
|
|
70
|
+
)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
scenario "specs for missing or unused translations" do
|
|
75
|
+
run_suspenders
|
|
76
|
+
|
|
77
|
+
expect(File).to exist("#{project_path}/spec/i18n_spec.rb")
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
scenario "config file for i18n tasks" do
|
|
81
|
+
run_suspenders
|
|
82
|
+
|
|
83
|
+
expect(File).to exist("#{project_path}/config/i18n-tasks.yml")
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
scenario "generated en.yml is evaluated" do
|
|
87
|
+
run_suspenders
|
|
88
|
+
|
|
89
|
+
locales_en_file = IO.read("#{project_path}/config/locales/en.yml")
|
|
90
|
+
app_name = SuspendersTestHelpers::APP_NAME
|
|
91
|
+
|
|
92
|
+
expect(locales_en_file).to match(/application: #{app_name.humanize}/)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
scenario "config simple_form" do
|
|
96
|
+
run_suspenders
|
|
97
|
+
|
|
98
|
+
expect(File).to exist("#{project_path}/config/initializers/simple_form.rb")
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
scenario "config :test email delivery method for development" do
|
|
102
|
+
run_suspenders
|
|
103
|
+
|
|
104
|
+
dev_env_file = IO.read("#{project_path}/config/environments/development.rb")
|
|
105
|
+
expect(dev_env_file).
|
|
106
|
+
to match(/^ +config.action_mailer.delivery_method = :test$/)
|
|
107
|
+
end
|
|
108
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'capybara/rspec'
|
|
2
|
+
require 'bundler/setup'
|
|
3
|
+
|
|
4
|
+
Bundler.require(:default, :test)
|
|
5
|
+
|
|
6
|
+
require (Pathname.new(__FILE__).dirname + '../lib/suspenders').expand_path
|
|
7
|
+
|
|
8
|
+
Dir['./spec/support/**/*.rb'].each { |file| require file }
|
|
9
|
+
|
|
10
|
+
RSpec.configure do |config|
|
|
11
|
+
config.include SuspendersTestHelpers
|
|
12
|
+
|
|
13
|
+
config.before(:all) do
|
|
14
|
+
create_tmp_directory
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
config.before(:each) do
|
|
18
|
+
drop_dummy_database
|
|
19
|
+
remove_project_directory
|
|
20
|
+
|
|
21
|
+
FakeGithub.clear!
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
class FakeGithub
|
|
2
|
+
RECORDER = File.expand_path(File.join('..', '..', 'tmp', 'hub_commands'), File.dirname(__FILE__))
|
|
3
|
+
|
|
4
|
+
def initialize(args)
|
|
5
|
+
@args = args
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def run!
|
|
9
|
+
File.open(RECORDER, 'a') do |file|
|
|
10
|
+
file.write @args.join(' ')
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.clear!
|
|
15
|
+
FileUtils.rm_rf RECORDER
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.has_created_repo?(repo_name)
|
|
19
|
+
File.read(RECORDER) == "create #{repo_name}"
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
module SuspendersTestHelpers
|
|
2
|
+
APP_NAME = "dummy_app"
|
|
3
|
+
|
|
4
|
+
def remove_project_directory
|
|
5
|
+
FileUtils.rm_rf(project_path)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def create_tmp_directory
|
|
9
|
+
FileUtils.mkdir_p(tmp_path)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def run_suspenders(arguments = nil)
|
|
13
|
+
Dir.chdir(tmp_path) do
|
|
14
|
+
Bundler.with_clean_env do
|
|
15
|
+
ENV['TESTING'] = '1'
|
|
16
|
+
|
|
17
|
+
%x(#{suspenders_bin} #{APP_NAME} #{arguments})
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def drop_dummy_database
|
|
23
|
+
if File.exist?(project_path)
|
|
24
|
+
Dir.chdir(project_path) do
|
|
25
|
+
Bundler.with_clean_env do
|
|
26
|
+
`rake db:drop`
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def project_path
|
|
33
|
+
@project_path ||= Pathname.new("#{tmp_path}/#{APP_NAME}")
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
private
|
|
37
|
+
|
|
38
|
+
def tmp_path
|
|
39
|
+
@tmp_path ||= Pathname.new("#{root_path}/tmp")
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def suspenders_bin
|
|
43
|
+
File.join(root_path, 'bin', 'hitfox-suspenders')
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def root_path
|
|
47
|
+
File.expand_path('../../../', __FILE__)
|
|
48
|
+
end
|
|
49
|
+
end
|
data/suspenders.gemspec
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
|
3
|
+
require 'suspenders/version'
|
|
4
|
+
require 'date'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |s|
|
|
7
|
+
s.required_ruby_version = ">= #{Suspenders::RUBY_VERSION}"
|
|
8
|
+
s.authors = ['thoughtbot', 'hitfox']
|
|
9
|
+
s.date = Date.today.strftime('%Y-%m-%d')
|
|
10
|
+
|
|
11
|
+
s.description = <<-HERE
|
|
12
|
+
Suspenders is a base Rails project that includes the gems we like to
|
|
13
|
+
use at Hitfox. This is our fork of the Thoughtbot's original suspenders
|
|
14
|
+
gem.
|
|
15
|
+
HERE
|
|
16
|
+
|
|
17
|
+
s.email = 'demitry.toumilovich@hitfoxgroup.com'
|
|
18
|
+
s.executables = ['hitfox-suspenders']
|
|
19
|
+
s.extra_rdoc_files = %w[README.md LICENSE]
|
|
20
|
+
s.files = `git ls-files`.split("\n")
|
|
21
|
+
s.homepage = 'https://github.com/HitFox/hitfox-suspenders'
|
|
22
|
+
s.license = 'MIT'
|
|
23
|
+
s.name = 'hitfox-suspenders'
|
|
24
|
+
s.rdoc_options = ['--charset=UTF-8']
|
|
25
|
+
s.require_paths = ['lib']
|
|
26
|
+
s.summary = "Generate a Rails app using Hitfox's best practices."
|
|
27
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
28
|
+
s.version = Suspenders::VERSION
|
|
29
|
+
|
|
30
|
+
s.add_dependency 'bitters', '~> 1.0.0'
|
|
31
|
+
s.add_dependency 'bundler', '~> 1.3'
|
|
32
|
+
s.add_dependency 'rails', Suspenders::RAILS_VERSION
|
|
33
|
+
|
|
34
|
+
s.add_development_dependency 'rspec', '~> 2.0'
|
|
35
|
+
s.add_development_dependency 'capybara', '~> 2.2', '>= 2.2.0'
|
|
36
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
source "https://rubygems.org"
|
|
2
|
+
|
|
3
|
+
ruby "<%= Suspenders::RUBY_VERSION %>"
|
|
4
|
+
|
|
5
|
+
gem 'honeybadger', '~> 2.0'
|
|
6
|
+
gem "coffee-rails", "~> 4.1.0"
|
|
7
|
+
gem "email_validator"
|
|
8
|
+
gem "high_voltage"
|
|
9
|
+
gem "i18n-tasks"
|
|
10
|
+
gem "jquery-rails"
|
|
11
|
+
gem "pg"
|
|
12
|
+
gem "rails", "<%= Suspenders::RAILS_VERSION %>"
|
|
13
|
+
gem "sass-rails", "~> 5.0"
|
|
14
|
+
gem "simple_form", "~> 3.0.3"
|
|
15
|
+
gem "title"
|
|
16
|
+
gem "uglifier"
|
|
17
|
+
gem 'mandrill_dm', '1.1.0'
|
|
18
|
+
|
|
19
|
+
group :development do
|
|
20
|
+
gem "spring"
|
|
21
|
+
gem "spring-commands-rspec"
|
|
22
|
+
gem "web-console"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
group :development, :test do
|
|
26
|
+
gem "awesome_print"
|
|
27
|
+
gem "bundler-audit", require: false
|
|
28
|
+
gem "byebug"
|
|
29
|
+
gem "dotenv-rails"
|
|
30
|
+
gem "faker"
|
|
31
|
+
gem "factory_girl_rails"
|
|
32
|
+
gem "pry-rails"
|
|
33
|
+
gem "rspec-rails", "~> 3.1.0"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
group :test do
|
|
37
|
+
gem "capybara-webkit", ">= 1.2.0"
|
|
38
|
+
gem "database_cleaner"
|
|
39
|
+
gem "launchy"
|
|
40
|
+
gem "shoulda-matchers", require: false
|
|
41
|
+
gem "simplecov", require: false
|
|
42
|
+
gem "timecop"
|
|
43
|
+
gem "webmock"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
group :staging, :production do
|
|
47
|
+
gem "rack-timeout"
|
|
48
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# <%= app_name.humanize %>
|
|
2
|
+
|
|
3
|
+
## Getting Started
|
|
4
|
+
|
|
5
|
+
After you have cloned this repo, run this setup script to set up your machine
|
|
6
|
+
with the necessary dependencies to run and test this app:
|
|
7
|
+
|
|
8
|
+
% ./bin/setup
|
|
9
|
+
|
|
10
|
+
It assumes you have a machine equipped with Ruby, Postgres, etc. If not, set up
|
|
11
|
+
your machine with [this script].
|
|
12
|
+
|
|
13
|
+
[this script]: https://github.com/thoughtbot/laptop
|
|
14
|
+
|
|
15
|
+
After setting up, you can run the application using [foreman]:
|
|
16
|
+
|
|
17
|
+
% foreman start
|
|
18
|
+
|
|
19
|
+
If you don't have `foreman`, see [Foreman's install instructions][foreman]. It
|
|
20
|
+
is [purposefully excluded from the project's `Gemfile`][exclude].
|
|
21
|
+
|
|
22
|
+
[foreman]: https://github.com/ddollar/foreman
|
|
23
|
+
[exclude]: https://github.com/ddollar/foreman/pull/437#issuecomment-41110407
|
|
24
|
+
|
|
25
|
+
## Assumptions
|
|
26
|
+
* [Mandrill](https://mandrill.com/) is used for email delivery on production
|
|
27
|
+
* MANDRILL_API_KEY must be set as an ENV variable on the server
|
|
28
|
+
* [Honeybadger](https://www.honeybadger.io/) is used for Exception monitoring
|
|
29
|
+
* Remember to run `bundle exec honeybadger install API_KEY` with your API key on the staging and production servers.
|
|
30
|
+
* [Rspec](https://github.com/rspec/rspec-rails) is used as the testing library
|
|
31
|
+
* Postgres is the database in use
|
|
32
|
+
* [Simple form](https://github.com/plataformatec/simple_form) is used for building forms
|
|
33
|
+
* [High voltage](https://github.com/thoughtbot/high_voltage) gem is used for creating static pages
|
|
34
|
+
|
|
35
|
+
## Guidelines
|
|
36
|
+
|
|
37
|
+
Use the following Thoughtbot guides for getting things done, programming well, and
|
|
38
|
+
programming in style.
|
|
39
|
+
|
|
40
|
+
* [Protocol](http://github.com/thoughtbot/guides/blob/master/protocol)
|
|
41
|
+
* [Best Practices](http://github.com/thoughtbot/guides/blob/master/best-practices)
|
|
42
|
+
* [Style](http://github.com/thoughtbot/guides/blob/master/style)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
|
|
3
|
+
# Set up Rails app. Run this script immediately after cloning the codebase.
|
|
4
|
+
# https://github.com/thoughtbot/guides/tree/master/protocol
|
|
5
|
+
|
|
6
|
+
# Exit if any subcommand fails
|
|
7
|
+
set -e
|
|
8
|
+
|
|
9
|
+
# Set up Ruby dependencies via Bundler
|
|
10
|
+
gem install bundler --conservative
|
|
11
|
+
bundle check || bundle install
|
|
12
|
+
|
|
13
|
+
# Set up configurable environment variables
|
|
14
|
+
if [ ! -f .env ]; then
|
|
15
|
+
cp .sample.env .env
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
# Set up database and add any development seed data
|
|
19
|
+
bundle exec rake db:setup dev:prime
|
|
20
|
+
|
|
21
|
+
# Add binstubs to PATH via export PATH=".git/safe/../../bin:$PATH" in ~/.zshenv
|
|
22
|
+
mkdir -p .git/safe
|
|
23
|
+
|
|
24
|
+
# Pick a port for Foreman
|
|
25
|
+
if ! grep --quiet --no-messages --fixed-strings 'port' .foreman; then
|
|
26
|
+
printf 'port: <%= config[:port_number] %>\n' >> .foreman
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
if ! command -v foreman > /dev/null; then
|
|
30
|
+
printf 'Foreman is not installed.\n'
|
|
31
|
+
printf 'See https://github.com/ddollar/foreman for install instructions.\n'
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
# Only if this isn't CI
|
|
35
|
+
# if [ -z "$CI" ]; then
|
|
36
|
+
# fi
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
if Rails.env.development? || Rails.env.test?
|
|
2
|
+
require "bundler/audit/cli"
|
|
3
|
+
|
|
4
|
+
namespace :bundler do
|
|
5
|
+
desc "Updates the ruby-advisory-db and runs audit"
|
|
6
|
+
task :audit do
|
|
7
|
+
%w(update check).each do |command|
|
|
8
|
+
Bundler::Audit::CLI.start [command]
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
RSpec.configure do |config|
|
|
2
|
+
config.before(:suite) do
|
|
3
|
+
DatabaseCleaner.clean_with(:deletion)
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
config.before(:each) do
|
|
7
|
+
DatabaseCleaner.strategy = :transaction
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
config.before(:each, js: true) do
|
|
11
|
+
DatabaseCleaner.strategy = :deletion
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
config.before(:each) do
|
|
15
|
+
DatabaseCleaner.start
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
config.after(:each) do
|
|
19
|
+
DatabaseCleaner.clean
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
if Rails.env.development? || Rails.env.test?
|
|
2
|
+
require "factory_girl"
|
|
3
|
+
|
|
4
|
+
namespace :dev do
|
|
5
|
+
desc "Seed data for development environment"
|
|
6
|
+
task prime: "db:setup" do
|
|
7
|
+
include FactoryGirl::Syntax::Methods
|
|
8
|
+
|
|
9
|
+
# create(:user, email: "user@example.com", password: "password")
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
data/templates/errors.rb
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require "net/http"
|
|
2
|
+
require "net/smtp"
|
|
3
|
+
|
|
4
|
+
# Example:
|
|
5
|
+
# begin
|
|
6
|
+
# some http call
|
|
7
|
+
# rescue *HTTP_ERRORS => error
|
|
8
|
+
# notify_hoptoad error
|
|
9
|
+
# end
|
|
10
|
+
|
|
11
|
+
HTTP_ERRORS = [
|
|
12
|
+
EOFError,
|
|
13
|
+
Errno::ECONNRESET,
|
|
14
|
+
Errno::EINVAL,
|
|
15
|
+
Net::HTTPBadResponse,
|
|
16
|
+
Net::HTTPHeaderSyntaxError,
|
|
17
|
+
Net::ProtocolError,
|
|
18
|
+
Timeout::Error
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
SMTP_SERVER_ERRORS = [
|
|
22
|
+
IOError,
|
|
23
|
+
Net::SMTPAuthenticationError,
|
|
24
|
+
Net::SMTPServerBusy,
|
|
25
|
+
Net::SMTPUnknownError,
|
|
26
|
+
TimeoutError
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
SMTP_CLIENT_ERRORS = [
|
|
30
|
+
Net::SMTPFatalError,
|
|
31
|
+
Net::SMTPSyntaxError
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
SMTP_ERRORS = SMTP_SERVER_ERRORS + SMTP_CLIENT_ERRORS
|
data/templates/i18n.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ActiveSupport::JSON::Encoding.time_precision = 0
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
|
2
|
+
|
|
3
|
+
require File.expand_path("../../config/environment", __FILE__)
|
|
4
|
+
|
|
5
|
+
require "rspec/rails"
|
|
6
|
+
require "shoulda/matchers"
|
|
7
|
+
|
|
8
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each { |file| require file }
|
|
9
|
+
|
|
10
|
+
module Features
|
|
11
|
+
# Extend this module in spec/support/features/*.rb
|
|
12
|
+
include Formulaic::Dsl
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
RSpec.configure do |config|
|
|
16
|
+
config.include Features, type: :feature
|
|
17
|
+
config.infer_base_class_for_anonymous_controllers = false
|
|
18
|
+
config.infer_spec_type_from_file_location!
|
|
19
|
+
config.use_transactional_fixtures = false
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
ActiveRecord::Migration.maintain_test_schema!
|
|
23
|
+
Capybara.javascript_driver = :webkit
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
if ENV.fetch("COVERAGE", false)
|
|
2
|
+
require "simplecov"
|
|
3
|
+
SimpleCov.start "rails"
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
require "webmock/rspec"
|
|
7
|
+
|
|
8
|
+
# http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
|
9
|
+
RSpec.configure do |config|
|
|
10
|
+
config.expect_with :rspec do |expectations|
|
|
11
|
+
expectations.syntax = :expect
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
config.mock_with :rspec do |mocks|
|
|
15
|
+
mocks.syntax = :expect
|
|
16
|
+
mocks.verify_partial_doubles = true
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
config.order = :random
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
WebMock.disable_net_connect!(allow_localhost: true)
|