hanami 0.0.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +214 -0
- data/FEATURES.md +156 -0
- data/LICENSE.md +22 -0
- data/README.md +80 -15
- data/bin/hanami +5 -0
- data/hanami.gemspec +27 -12
- data/lib/hanami.rb +78 -2
- data/lib/hanami/action/csrf_protection.rb +167 -0
- data/lib/hanami/action/routing_helpers.rb +40 -0
- data/lib/hanami/application.rb +244 -0
- data/lib/hanami/application_name.rb +101 -0
- data/lib/hanami/cli.rb +119 -0
- data/lib/hanami/cli_sub_commands/assets.rb +29 -0
- data/lib/hanami/cli_sub_commands/db.rb +124 -0
- data/lib/hanami/cli_sub_commands/destroy.rb +102 -0
- data/lib/hanami/cli_sub_commands/generate.rb +127 -0
- data/lib/hanami/commands/assets/precompile.rb +35 -0
- data/lib/hanami/commands/console.rb +90 -0
- data/lib/hanami/commands/db/abstract.rb +19 -0
- data/lib/hanami/commands/db/apply.rb +14 -0
- data/lib/hanami/commands/db/console.rb +50 -0
- data/lib/hanami/commands/db/create.rb +14 -0
- data/lib/hanami/commands/db/drop.rb +14 -0
- data/lib/hanami/commands/db/migrate.rb +19 -0
- data/lib/hanami/commands/db/prepare.rb +14 -0
- data/lib/hanami/commands/db/version.rb +14 -0
- data/lib/hanami/commands/generate/abstract.rb +63 -0
- data/lib/hanami/commands/generate/action.rb +262 -0
- data/lib/hanami/commands/generate/app.rb +116 -0
- data/lib/hanami/commands/generate/mailer.rb +118 -0
- data/lib/hanami/commands/generate/migration.rb +63 -0
- data/lib/hanami/commands/generate/model.rb +96 -0
- data/lib/hanami/commands/new/abstract.rb +128 -0
- data/lib/hanami/commands/new/app.rb +116 -0
- data/lib/hanami/commands/new/container.rb +102 -0
- data/lib/hanami/commands/routes.rb +41 -0
- data/lib/hanami/commands/server.rb +79 -0
- data/lib/hanami/config/configure.rb +17 -0
- data/lib/hanami/config/cookies.rb +68 -0
- data/lib/hanami/config/framework_configuration.rb +42 -0
- data/lib/hanami/config/load_paths.rb +27 -0
- data/lib/hanami/config/mapper.rb +36 -0
- data/lib/hanami/config/mapping.rb +12 -0
- data/lib/hanami/config/routes.rb +16 -0
- data/lib/hanami/config/security.rb +58 -0
- data/lib/hanami/config/sessions.rb +97 -0
- data/lib/hanami/configuration.rb +1728 -0
- data/lib/hanami/container.rb +59 -0
- data/lib/hanami/environment.rb +485 -0
- data/lib/hanami/frameworks.rb +14 -0
- data/lib/hanami/generators/action/action.rb.tt +8 -0
- data/lib/hanami/generators/action/action_spec.minitest.tt +12 -0
- data/lib/hanami/generators/action/action_spec.rspec.tt +11 -0
- data/lib/hanami/generators/action/action_without_view.rb.tt +9 -0
- data/lib/hanami/generators/action/template.tt +0 -0
- data/lib/hanami/generators/action/view.rb.tt +5 -0
- data/lib/hanami/generators/action/view_spec.minitest.tt +13 -0
- data/lib/hanami/generators/action/view_spec.rspec.tt +12 -0
- data/lib/hanami/generators/app/.gitkeep.tt +1 -0
- data/lib/hanami/generators/app/application.rb.tt +273 -0
- data/lib/hanami/generators/app/config/initializers/.gitkeep +0 -0
- data/lib/hanami/generators/app/config/routes.rb.tt +2 -0
- data/lib/hanami/generators/app/favicon.ico +0 -0
- data/lib/hanami/generators/app/templates/application.html.erb.tt +10 -0
- data/lib/hanami/generators/app/views/application_layout.rb.tt +7 -0
- data/lib/hanami/generators/application/app/.env.development.tt +4 -0
- data/lib/hanami/generators/application/app/.env.test.tt +4 -0
- data/lib/hanami/generators/application/app/.env.tt +1 -0
- data/lib/hanami/generators/application/app/.gitignore +0 -0
- data/lib/hanami/generators/application/app/.gitkeep +1 -0
- data/lib/hanami/generators/application/app/Gemfile.tt +37 -0
- data/lib/hanami/generators/application/app/Rakefile.minitest.tt +11 -0
- data/lib/hanami/generators/application/app/Rakefile.rspec.tt +6 -0
- data/lib/hanami/generators/application/app/apps/.gitkeep.tt +1 -0
- data/lib/hanami/generators/application/app/capybara.rb.rspec.tt +8 -0
- data/lib/hanami/generators/application/app/config.ru.tt +3 -0
- data/lib/hanami/generators/application/app/config/application.rb.tt +270 -0
- data/lib/hanami/generators/application/app/config/environment.rb.tt +5 -0
- data/lib/hanami/generators/application/app/config/initializers/.gitkeep +0 -0
- data/lib/hanami/generators/application/app/config/routes.rb.tt +2 -0
- data/lib/hanami/generators/application/app/db/.gitkeep +1 -0
- data/lib/hanami/generators/application/app/favicon.ico +0 -0
- data/lib/hanami/generators/application/app/features_helper.rb.minitest.tt +11 -0
- data/lib/hanami/generators/application/app/features_helper.rb.rspec.tt +12 -0
- data/lib/hanami/generators/application/app/gitignore.tt +2 -0
- data/lib/hanami/generators/application/app/gitignore_with_db.tt +4 -0
- data/lib/hanami/generators/application/app/hanamirc.tt +3 -0
- data/lib/hanami/generators/application/app/lib/app_name.rb.tt +59 -0
- data/lib/hanami/generators/application/app/lib/chirp/entities/.gitkeep +1 -0
- data/lib/hanami/generators/application/app/lib/chirp/repositories/.gitkeep +1 -0
- data/lib/hanami/generators/application/app/lib/config/mapping.rb.tt +7 -0
- data/lib/hanami/generators/application/app/rspec.rspec.tt +2 -0
- data/lib/hanami/generators/application/app/schema.sql.tt +0 -0
- data/lib/hanami/generators/application/app/spec_helper.rb.minitest.tt +7 -0
- data/lib/hanami/generators/application/app/spec_helper.rb.rspec.tt +104 -0
- data/lib/hanami/generators/application/app/templates/application.html.erb.tt +10 -0
- data/lib/hanami/generators/application/app/views/application_layout.rb.tt +7 -0
- data/lib/hanami/generators/application/container/.env.development.tt +3 -0
- data/lib/hanami/generators/application/container/.env.test.tt +3 -0
- data/lib/hanami/generators/application/container/.env.tt +1 -0
- data/lib/hanami/generators/application/container/.gitignore +0 -0
- data/lib/hanami/generators/application/container/.gitkeep +1 -0
- data/lib/hanami/generators/application/container/Gemfile.tt +36 -0
- data/lib/hanami/generators/application/container/Rakefile.minitest.tt +11 -0
- data/lib/hanami/generators/application/container/Rakefile.rspec.tt +6 -0
- data/lib/hanami/generators/application/container/capybara.rb.rspec.tt +8 -0
- data/lib/hanami/generators/application/container/config.ru.tt +3 -0
- data/lib/hanami/generators/application/container/config/environment.rb.tt +7 -0
- data/lib/hanami/generators/application/container/config/initializers/.gitkeep +0 -0
- data/lib/hanami/generators/application/container/db/.gitkeep +1 -0
- data/lib/hanami/generators/application/container/features_helper.rb.minitest.tt +11 -0
- data/lib/hanami/generators/application/container/features_helper.rb.rspec.tt +12 -0
- data/lib/hanami/generators/application/container/gitignore.tt +2 -0
- data/lib/hanami/generators/application/container/gitignore_with_db.tt +4 -0
- data/lib/hanami/generators/application/container/hanamirc.tt +3 -0
- data/lib/hanami/generators/application/container/lib/app_name.rb.tt +60 -0
- data/lib/hanami/generators/application/container/lib/chirp/entities/.gitkeep +1 -0
- data/lib/hanami/generators/application/container/lib/chirp/mailers/.gitkeep +0 -0
- data/lib/hanami/generators/application/container/lib/chirp/mailers/templates/.gitkeep +0 -0
- data/lib/hanami/generators/application/container/lib/chirp/repositories/.gitkeep +1 -0
- data/lib/hanami/generators/application/container/lib/config/mapping.rb.tt +7 -0
- data/lib/hanami/generators/application/container/rspec.rspec.tt +2 -0
- data/lib/hanami/generators/application/container/schema.sql.tt +0 -0
- data/lib/hanami/generators/application/container/spec_helper.rb.minitest.tt +7 -0
- data/lib/hanami/generators/application/container/spec_helper.rb.rspec.tt +104 -0
- data/lib/hanami/generators/database_config.rb +99 -0
- data/lib/hanami/generators/generatable.rb +51 -0
- data/lib/hanami/generators/generator.rb +35 -0
- data/lib/hanami/generators/mailer/mailer.rb.tt +7 -0
- data/lib/hanami/generators/mailer/mailer_spec.rb.tt +7 -0
- data/lib/hanami/generators/mailer/template.html.tt +0 -0
- data/lib/hanami/generators/mailer/template.txt.tt +0 -0
- data/lib/hanami/generators/migration/migration.rb.tt +4 -0
- data/lib/hanami/generators/model/entity.rb.tt +3 -0
- data/lib/hanami/generators/model/entity_spec.minitest.tt +5 -0
- data/lib/hanami/generators/model/entity_spec.rspec.tt +3 -0
- data/lib/hanami/generators/model/repository.rb.tt +3 -0
- data/lib/hanami/generators/model/repository_spec.minitest.tt +5 -0
- data/lib/hanami/generators/model/repository_spec.rspec.tt +3 -0
- data/lib/hanami/generators/test_framework.rb +42 -0
- data/lib/hanami/hanamirc.rb +152 -0
- data/lib/hanami/loader.rb +258 -0
- data/lib/hanami/mailer/glue.rb +68 -0
- data/lib/hanami/middleware.rb +143 -0
- data/lib/hanami/rake_helper.rb +68 -0
- data/lib/hanami/rake_tasks.rb +2 -0
- data/lib/hanami/rendering_policy.rb +77 -0
- data/lib/hanami/repositories/car_repository.rb +3 -0
- data/lib/hanami/repositories/name_repository.rb +3 -0
- data/lib/hanami/root.rb +7 -0
- data/lib/hanami/routes.rb +151 -0
- data/lib/hanami/routing/default.rb +25 -0
- data/lib/hanami/setup.rb +3 -0
- data/lib/hanami/static.rb +77 -0
- data/lib/hanami/templates/default.html.erb +9 -0
- data/lib/hanami/templates/welcome.html.erb +52 -0
- data/lib/hanami/version.rb +4 -1
- data/lib/hanami/views/default.rb +34 -0
- data/lib/hanami/views/default_template_finder.rb +20 -0
- data/lib/hanami/views/null_view.rb +17 -0
- data/lib/hanami/welcome.rb +40 -0
- metadata +357 -16
- data/.gitignore +0 -9
- data/Gemfile +0 -4
- data/Rakefile +0 -2
- data/bin/console +0 -14
- data/bin/setup +0 -8
@@ -0,0 +1,104 @@
|
|
1
|
+
# Require this file for unit tests
|
2
|
+
ENV['HANAMI_ENV'] ||= 'test'
|
3
|
+
|
4
|
+
require_relative '../config/environment'
|
5
|
+
Hanami::Application.preload!
|
6
|
+
|
7
|
+
Dir[__dir__ + '/support/**/*.rb'].each { |f| require f }
|
8
|
+
|
9
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
10
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
11
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
12
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
13
|
+
# files.
|
14
|
+
#
|
15
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
16
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
17
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
18
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
19
|
+
# a separate helper file that requires the additional dependencies and performs
|
20
|
+
# the additional setup, and require it from the spec files that actually need
|
21
|
+
# it.
|
22
|
+
#
|
23
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
24
|
+
# users commonly want.
|
25
|
+
#
|
26
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
27
|
+
RSpec.configure do |config|
|
28
|
+
# rspec-expectations config goes here. You can use an alternate
|
29
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
30
|
+
# assertions if you prefer.
|
31
|
+
config.expect_with :rspec do |expectations|
|
32
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
33
|
+
# and `failure_message` of custom matchers include text for helper methods
|
34
|
+
# defined using `chain`, e.g.:
|
35
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
36
|
+
# # => "be bigger than 2 and smaller than 4"
|
37
|
+
# ...rather than:
|
38
|
+
# # => "be bigger than 2"
|
39
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
40
|
+
end
|
41
|
+
|
42
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
43
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
44
|
+
config.mock_with :rspec do |mocks|
|
45
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
46
|
+
# a real object. This is generally recommended, and will default to
|
47
|
+
# `true` in RSpec 4.
|
48
|
+
mocks.verify_partial_doubles = true
|
49
|
+
end
|
50
|
+
|
51
|
+
# The settings below are suggested to provide a good initial experience
|
52
|
+
# with RSpec, but feel free to customize to your heart's content.
|
53
|
+
=begin
|
54
|
+
# These two settings work together to allow you to limit a spec run
|
55
|
+
# to individual examples or groups you care about by tagging them with
|
56
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
57
|
+
# get run.
|
58
|
+
config.filter_run :focus
|
59
|
+
config.run_all_when_everything_filtered = true
|
60
|
+
|
61
|
+
# Allows RSpec to persist some state between runs in order to support
|
62
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
63
|
+
# you configure your source control system to ignore this file.
|
64
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
65
|
+
|
66
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
67
|
+
# recommended. For more details, see:
|
68
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
69
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
70
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
71
|
+
config.disable_monkey_patching!
|
72
|
+
|
73
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
74
|
+
# be too noisy due to issues in dependencies.
|
75
|
+
config.warnings = true
|
76
|
+
|
77
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
78
|
+
# file, and it's useful to allow more verbose output when running an
|
79
|
+
# individual spec file.
|
80
|
+
if config.files_to_run.one?
|
81
|
+
# Use the documentation formatter for detailed output,
|
82
|
+
# unless a formatter has already been configured
|
83
|
+
# (e.g. via a command-line flag).
|
84
|
+
config.default_formatter = 'doc'
|
85
|
+
end
|
86
|
+
|
87
|
+
# Print the 10 slowest examples and example groups at the
|
88
|
+
# end of the spec run, to help surface which specs are running
|
89
|
+
# particularly slow.
|
90
|
+
config.profile_examples = 10
|
91
|
+
|
92
|
+
# Run specs in random order to surface order dependencies. If you find an
|
93
|
+
# order dependency and want to debug it, you can fix the order by providing
|
94
|
+
# the seed, which is printed after each run.
|
95
|
+
# --seed 1234
|
96
|
+
config.order = :random
|
97
|
+
|
98
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
99
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
100
|
+
# test failures related to randomization by passing the same `--seed` value
|
101
|
+
# as the one that triggered the failure.
|
102
|
+
Kernel.srand config.seed
|
103
|
+
=end
|
104
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
# Define ENV variables
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
#
|
@@ -0,0 +1,36 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'bundler'
|
4
|
+
gem 'rake'
|
5
|
+
<%- if config[:hanami_head] -%>
|
6
|
+
gem 'hanami-utils', require: false, github: 'hanami/utils'
|
7
|
+
gem 'hanami-router', require: false, github: 'hanami/router'
|
8
|
+
gem 'hanami-validations', require: false, github: 'hanami/validations'
|
9
|
+
gem 'hanami-helpers', require: false, github: 'hanami/helpers'
|
10
|
+
gem 'hanami-controller', require: false, github: 'hanami/controller'
|
11
|
+
gem 'hanami-view', require: false, github: 'hanami/view'
|
12
|
+
gem 'hanami-model', require: false, github: 'hanami/model'
|
13
|
+
gem 'hanami-mailer', require: false, github: 'hanami/mailer'
|
14
|
+
gem 'hanami-assets', require: false, github: 'hanami/assets'
|
15
|
+
gem 'hanami', github: 'hanami/hanami'
|
16
|
+
<%- else -%>
|
17
|
+
gem 'hanami', '<%= Hanami::VERSION %>'
|
18
|
+
gem 'hanami-model', '<%= config[:hanami_model_version] %>'
|
19
|
+
<%- end -%>
|
20
|
+
|
21
|
+
<%- if config[:database_config][:gem] %>
|
22
|
+
gem '<%= config[:database_config][:gem] %>'
|
23
|
+
<%- end -%>
|
24
|
+
|
25
|
+
group :test do
|
26
|
+
<%- if config[:test] == 'rspec' -%>
|
27
|
+
gem 'rspec'
|
28
|
+
<%- else -%>
|
29
|
+
gem 'minitest'
|
30
|
+
<%- end -%>
|
31
|
+
gem 'capybara'
|
32
|
+
end
|
33
|
+
|
34
|
+
group :production do
|
35
|
+
# gem 'puma'
|
36
|
+
end
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
#
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Require this file for feature tests
|
2
|
+
require_relative './spec_helper'
|
3
|
+
|
4
|
+
require 'capybara'
|
5
|
+
require 'capybara/rspec'
|
6
|
+
|
7
|
+
RSpec.configure do |config|
|
8
|
+
config.include RSpec::FeatureExampleGroup
|
9
|
+
|
10
|
+
config.include Capybara::DSL, feature: true
|
11
|
+
config.include Capybara::RSpecMatchers, feature: true
|
12
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'hanami/model'
|
2
|
+
require 'hanami/mailer'
|
3
|
+
Dir["#{ __dir__ }/<%= config[:app_name] %>/**/*.rb"].each { |file| require_relative file }
|
4
|
+
|
5
|
+
Hanami::Model.configure do
|
6
|
+
##
|
7
|
+
# Database adapter
|
8
|
+
#
|
9
|
+
# Available options:
|
10
|
+
#
|
11
|
+
# * Memory adapter
|
12
|
+
# adapter type: :memory, uri: 'memory://localhost/<%= config[:app_name] %>_development'
|
13
|
+
#
|
14
|
+
# * SQL adapter
|
15
|
+
# adapter type: :sql, uri: 'sqlite://db/<%= config[:app_name] %>_development.sqlite3'
|
16
|
+
# adapter type: :sql, uri: 'postgres://localhost/<%= config[:app_name] %>_development'
|
17
|
+
# adapter type: :sql, uri: 'mysql://localhost/<%= config[:app_name] %>_development'
|
18
|
+
#
|
19
|
+
adapter type: :<%= config[:database_config][:type] %>, uri: ENV['<%= config[:app_name].to_env_s %>_DATABASE_URL']
|
20
|
+
|
21
|
+
<%- if config[:database_config][:type] == :sql -%>
|
22
|
+
##
|
23
|
+
# Migrations
|
24
|
+
#
|
25
|
+
migrations 'db/migrations'
|
26
|
+
schema 'db/schema.sql'
|
27
|
+
|
28
|
+
<%- end -%>
|
29
|
+
##
|
30
|
+
# Database mapping
|
31
|
+
#
|
32
|
+
# Intended for specifying application wide mappings.
|
33
|
+
#
|
34
|
+
# You can specify mapping file to load with:
|
35
|
+
#
|
36
|
+
# mapping "#{__dir__}/config/mapping"
|
37
|
+
#
|
38
|
+
# Alternatively, you can use a block syntax like the following:
|
39
|
+
#
|
40
|
+
mapping do
|
41
|
+
# collection :users do
|
42
|
+
# entity User
|
43
|
+
# repository UserRepository
|
44
|
+
#
|
45
|
+
# attribute :id, Integer
|
46
|
+
# attribute :name, String
|
47
|
+
# end
|
48
|
+
end
|
49
|
+
end.load!
|
50
|
+
|
51
|
+
Hanami::Mailer.configure do
|
52
|
+
root "#{ __dir__ }/<%= config[:app_name] %>/mailers"
|
53
|
+
|
54
|
+
# See http://hanamirb.org/guides/mailers/delivery
|
55
|
+
delivery do
|
56
|
+
development :test
|
57
|
+
test :test
|
58
|
+
# production :stmp, address: ENV['SMTP_PORT'], port: 1025
|
59
|
+
end
|
60
|
+
end.load!
|
@@ -0,0 +1 @@
|
|
1
|
+
#
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
#
|
File without changes
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# Require this file for unit tests
|
2
|
+
ENV['HANAMI_ENV'] ||= 'test'
|
3
|
+
|
4
|
+
require_relative '../config/environment'
|
5
|
+
Hanami::Application.preload!
|
6
|
+
|
7
|
+
Dir[__dir__ + '/support/**/*.rb'].each { |f| require f }
|
8
|
+
|
9
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
10
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
11
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
12
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
13
|
+
# files.
|
14
|
+
#
|
15
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
16
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
17
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
18
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
19
|
+
# a separate helper file that requires the additional dependencies and performs
|
20
|
+
# the additional setup, and require it from the spec files that actually need
|
21
|
+
# it.
|
22
|
+
#
|
23
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
24
|
+
# users commonly want.
|
25
|
+
#
|
26
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
27
|
+
RSpec.configure do |config|
|
28
|
+
# rspec-expectations config goes here. You can use an alternate
|
29
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
30
|
+
# assertions if you prefer.
|
31
|
+
config.expect_with :rspec do |expectations|
|
32
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
33
|
+
# and `failure_message` of custom matchers include text for helper methods
|
34
|
+
# defined using `chain`, e.g.:
|
35
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
36
|
+
# # => "be bigger than 2 and smaller than 4"
|
37
|
+
# ...rather than:
|
38
|
+
# # => "be bigger than 2"
|
39
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
40
|
+
end
|
41
|
+
|
42
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
43
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
44
|
+
config.mock_with :rspec do |mocks|
|
45
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
46
|
+
# a real object. This is generally recommended, and will default to
|
47
|
+
# `true` in RSpec 4.
|
48
|
+
mocks.verify_partial_doubles = true
|
49
|
+
end
|
50
|
+
|
51
|
+
# The settings below are suggested to provide a good initial experience
|
52
|
+
# with RSpec, but feel free to customize to your heart's content.
|
53
|
+
=begin
|
54
|
+
# These two settings work together to allow you to limit a spec run
|
55
|
+
# to individual examples or groups you care about by tagging them with
|
56
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
57
|
+
# get run.
|
58
|
+
config.filter_run :focus
|
59
|
+
config.run_all_when_everything_filtered = true
|
60
|
+
|
61
|
+
# Allows RSpec to persist some state between runs in order to support
|
62
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
63
|
+
# you configure your source control system to ignore this file.
|
64
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
65
|
+
|
66
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
67
|
+
# recommended. For more details, see:
|
68
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
69
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
70
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
71
|
+
config.disable_monkey_patching!
|
72
|
+
|
73
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
74
|
+
# be too noisy due to issues in dependencies.
|
75
|
+
config.warnings = true
|
76
|
+
|
77
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
78
|
+
# file, and it's useful to allow more verbose output when running an
|
79
|
+
# individual spec file.
|
80
|
+
if config.files_to_run.one?
|
81
|
+
# Use the documentation formatter for detailed output,
|
82
|
+
# unless a formatter has already been configured
|
83
|
+
# (e.g. via a command-line flag).
|
84
|
+
config.default_formatter = 'doc'
|
85
|
+
end
|
86
|
+
|
87
|
+
# Print the 10 slowest examples and example groups at the
|
88
|
+
# end of the spec run, to help surface which specs are running
|
89
|
+
# particularly slow.
|
90
|
+
config.profile_examples = 10
|
91
|
+
|
92
|
+
# Run specs in random order to surface order dependencies. If you find an
|
93
|
+
# order dependency and want to debug it, you can fix the order by providing
|
94
|
+
# the seed, which is printed after each run.
|
95
|
+
# --seed 1234
|
96
|
+
config.order = :random
|
97
|
+
|
98
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
99
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
100
|
+
# test failures related to randomization by passing the same `--seed` value
|
101
|
+
# as the one that triggered the failure.
|
102
|
+
Kernel.srand config.seed
|
103
|
+
=end
|
104
|
+
end
|