draper 4.0.4 → 4.0.5
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +3 -6
- data/lib/draper/collection_decorator.rb +0 -6
- data/lib/draper/compatibility/broadcastable.rb +24 -0
- data/lib/draper/compatibility/global_id.rb +9 -5
- data/lib/draper/decoratable.rb +5 -0
- data/lib/draper/decorator.rb +2 -18
- data/lib/draper/railtie.rb +6 -1
- data/lib/draper/version.rb +1 -1
- metadata +4 -232
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -24
- data/.github/workflows/ci.yml +0 -71
- data/.gitignore +0 -18
- data/Gemfile +0 -46
- data/bin/bundle +0 -114
- data/bin/rake +0 -29
- data/draper.gemspec +0 -34
- data/spec/draper/collection_decorator_spec.rb +0 -291
- data/spec/draper/configuration_spec.rb +0 -49
- data/spec/draper/decoratable/equality_spec.rb +0 -10
- data/spec/draper/decoratable_spec.rb +0 -235
- data/spec/draper/decorated_association_spec.rb +0 -82
- data/spec/draper/decorates_assigned_spec.rb +0 -71
- data/spec/draper/decorator_spec.rb +0 -872
- data/spec/draper/draper_spec.rb +0 -25
- data/spec/draper/factory_spec.rb +0 -247
- data/spec/draper/finders_spec.rb +0 -166
- data/spec/draper/helper_proxy_spec.rb +0 -61
- data/spec/draper/lazy_helpers_spec.rb +0 -21
- data/spec/draper/query_methods/load_strategy_spec.rb +0 -26
- data/spec/draper/query_methods_spec.rb +0 -80
- data/spec/draper/undecorate_chain_spec.rb +0 -20
- data/spec/draper/undecorate_spec.rb +0 -19
- data/spec/draper/view_context/build_strategy_spec.rb +0 -115
- data/spec/draper/view_context_spec.rb +0 -182
- data/spec/draper/view_helpers_spec.rb +0 -8
- data/spec/dummy/.rspec +0 -1
- data/spec/dummy/Rakefile +0 -7
- data/spec/dummy/app/assets/config/manifest.js +0 -3
- data/spec/dummy/app/controllers/application_controller.rb +0 -2
- data/spec/dummy/app/controllers/base_controller.rb +0 -4
- data/spec/dummy/app/controllers/localized_urls.rb +0 -5
- data/spec/dummy/app/controllers/posts_controller.rb +0 -20
- data/spec/dummy/app/decorators/comment_decorator.rb +0 -13
- data/spec/dummy/app/decorators/mongoid_post_decorator.rb +0 -2
- data/spec/dummy/app/decorators/post_decorator.rb +0 -60
- data/spec/dummy/app/helpers/application_helper.rb +0 -5
- data/spec/dummy/app/jobs/publish_post_job.rb +0 -7
- data/spec/dummy/app/mailers/application_mailer.rb +0 -3
- data/spec/dummy/app/mailers/post_mailer.rb +0 -19
- data/spec/dummy/app/models/admin.rb +0 -3
- data/spec/dummy/app/models/application_record.rb +0 -3
- data/spec/dummy/app/models/comment.rb +0 -3
- data/spec/dummy/app/models/mongoid_post.rb +0 -3
- data/spec/dummy/app/models/post.rb +0 -7
- data/spec/dummy/app/models/user.rb +0 -3
- data/spec/dummy/app/views/layouts/application.html.erb +0 -11
- data/spec/dummy/app/views/post_mailer/decorated_email.html.erb +0 -1
- data/spec/dummy/app/views/posts/_post.html.erb +0 -42
- data/spec/dummy/app/views/posts/show.html.erb +0 -1
- data/spec/dummy/bin/rails +0 -4
- data/spec/dummy/config/application.rb +0 -39
- data/spec/dummy/config/boot.rb +0 -5
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -78
- data/spec/dummy/config/environments/production.rb +0 -102
- data/spec/dummy/config/environments/test.rb +0 -69
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/draper.rb +0 -5
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/dummy/config/initializers/inflections.rb +0 -15
- data/spec/dummy/config/initializers/mime_types.rb +0 -5
- data/spec/dummy/config/initializers/secret_token.rb +0 -8
- data/spec/dummy/config/initializers/session_store.rb +0 -8
- data/spec/dummy/config/locales/en.yml +0 -5
- data/spec/dummy/config/mongoid.yml +0 -142
- data/spec/dummy/config/routes.rb +0 -9
- data/spec/dummy/config/storage.yml +0 -7
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/db/migrate/20121019115657_create_posts.rb +0 -8
- data/spec/dummy/db/migrate/20240907041839_create_comments.rb +0 -9
- data/spec/dummy/db/schema.rb +0 -28
- data/spec/dummy/db/seeds.rb +0 -2
- data/spec/dummy/fast_spec/post_decorator_spec.rb +0 -37
- data/spec/dummy/lib/tasks/test.rake +0 -16
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +0 -26
- data/spec/dummy/public/422.html +0 -26
- data/spec/dummy/public/500.html +0 -25
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +0 -6
- data/spec/dummy/spec/decorators/active_model_serializers_spec.rb +0 -12
- data/spec/dummy/spec/decorators/devise_spec.rb +0 -55
- data/spec/dummy/spec/decorators/helpers_spec.rb +0 -21
- data/spec/dummy/spec/decorators/post_decorator_spec.rb +0 -64
- data/spec/dummy/spec/decorators/spec_type_spec.rb +0 -7
- data/spec/dummy/spec/decorators/view_context_spec.rb +0 -22
- data/spec/dummy/spec/jobs/publish_post_job_spec.rb +0 -11
- data/spec/dummy/spec/mailers/post_mailer_spec.rb +0 -25
- data/spec/dummy/spec/models/application_spec.rb +0 -7
- data/spec/dummy/spec/models/mongoid_post_spec.rb +0 -8
- data/spec/dummy/spec/models/post_spec.rb +0 -51
- data/spec/dummy/spec/rails_helper.rb +0 -69
- data/spec/dummy/spec/shared_examples/decoratable.rb +0 -22
- data/spec/dummy/spec/spec_helper.rb +0 -93
- data/spec/dummy/test/decorators/minitest/devise_test.rb +0 -55
- data/spec/dummy/test/decorators/minitest/helpers_test.rb +0 -21
- data/spec/dummy/test/decorators/minitest/spec_type_test.rb +0 -52
- data/spec/dummy/test/decorators/minitest/view_context_test.rb +0 -24
- data/spec/dummy/test/decorators/test_unit/devise_test.rb +0 -55
- data/spec/dummy/test/decorators/test_unit/helpers_test.rb +0 -21
- data/spec/dummy/test/decorators/test_unit/view_context_test.rb +0 -24
- data/spec/dummy/test/minitest_helper.rb +0 -2
- data/spec/dummy/test/test_helper.rb +0 -3
- data/spec/generators/controller/controller_generator_spec.rb +0 -23
- data/spec/generators/decorator/decorator_generator_spec.rb +0 -93
- data/spec/generators/install/install_generator_spec.rb +0 -19
- data/spec/integration/integration_spec.rb +0 -70
- data/spec/performance/active_record.rb +0 -4
- data/spec/performance/benchmark.rb +0 -55
- data/spec/performance/decorators.rb +0 -45
- data/spec/performance/models.rb +0 -20
- data/spec/spec_helper.rb +0 -50
- data/spec/support/dummy_app.rb +0 -85
- data/spec/support/matchers/have_text.rb +0 -50
- data/spec/support/shared_examples/decoratable_equality.rb +0 -40
- data/spec/support/shared_examples/view_helpers.rb +0 -39
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
require "active_support/core_ext/integer/time"
|
|
2
|
-
|
|
3
|
-
Rails.application.configure do
|
|
4
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
|
5
|
-
|
|
6
|
-
# In the development environment your application's code is reloaded any time
|
|
7
|
-
# it changes. This slows down response time but is perfect for development
|
|
8
|
-
# since you don't have to restart the web server when you make code changes.
|
|
9
|
-
config.enable_reloading = true
|
|
10
|
-
|
|
11
|
-
# Do not eager load code on boot.
|
|
12
|
-
config.eager_load = false
|
|
13
|
-
|
|
14
|
-
# Show full error reports.
|
|
15
|
-
config.consider_all_requests_local = true
|
|
16
|
-
|
|
17
|
-
# Enable server timing.
|
|
18
|
-
config.server_timing = true
|
|
19
|
-
|
|
20
|
-
# Enable/disable caching. By default caching is disabled.
|
|
21
|
-
# Run rails dev:cache to toggle caching.
|
|
22
|
-
if Rails.root.join("tmp/caching-dev.txt").exist?
|
|
23
|
-
config.action_controller.perform_caching = true
|
|
24
|
-
config.action_controller.enable_fragment_cache_logging = true
|
|
25
|
-
|
|
26
|
-
config.cache_store = :memory_store
|
|
27
|
-
config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{2.days.to_i}" }
|
|
28
|
-
else
|
|
29
|
-
config.action_controller.perform_caching = false
|
|
30
|
-
|
|
31
|
-
config.cache_store = :null_store
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# Store uploaded files on the local file system (see config/storage.yml for options).
|
|
35
|
-
config.active_storage.service = :local
|
|
36
|
-
|
|
37
|
-
# Don't care if the mailer can't send.
|
|
38
|
-
config.action_mailer.raise_delivery_errors = false
|
|
39
|
-
|
|
40
|
-
# Disable caching for Action Mailer templates even if Action Controller
|
|
41
|
-
# caching is enabled.
|
|
42
|
-
config.action_mailer.perform_caching = false
|
|
43
|
-
|
|
44
|
-
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
|
|
45
|
-
|
|
46
|
-
# Print deprecation notices to the Rails logger.
|
|
47
|
-
config.active_support.deprecation = :log
|
|
48
|
-
|
|
49
|
-
# Raise exceptions for disallowed deprecations.
|
|
50
|
-
config.active_support.disallowed_deprecation = :raise
|
|
51
|
-
|
|
52
|
-
# Tell Active Support which deprecation messages to disallow.
|
|
53
|
-
config.active_support.disallowed_deprecation_warnings = []
|
|
54
|
-
|
|
55
|
-
# Raise an error on page load if there are pending migrations.
|
|
56
|
-
config.active_record.migration_error = :page_load
|
|
57
|
-
|
|
58
|
-
# Highlight code that triggered database queries in logs.
|
|
59
|
-
config.active_record.verbose_query_logs = true
|
|
60
|
-
|
|
61
|
-
# Highlight code that enqueued background job in logs.
|
|
62
|
-
# config.active_job.verbose_enqueue_logs = true
|
|
63
|
-
|
|
64
|
-
# Suppress logger output for asset requests.
|
|
65
|
-
# config.assets.quiet = true
|
|
66
|
-
|
|
67
|
-
# Raises error for missing translations.
|
|
68
|
-
# config.i18n.raise_on_missing_translations = true
|
|
69
|
-
|
|
70
|
-
# Annotate rendered view with file names.
|
|
71
|
-
# config.action_view.annotate_rendered_view_with_filenames = true
|
|
72
|
-
|
|
73
|
-
# Uncomment if you wish to allow Action Cable access from any origin.
|
|
74
|
-
# config.action_cable.disable_request_forgery_protection = true
|
|
75
|
-
|
|
76
|
-
# Raise error when a before_action's only/except options reference missing actions.
|
|
77
|
-
# config.action_controller.raise_on_missing_callback_actions = true
|
|
78
|
-
end
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
require "active_support/core_ext/integer/time"
|
|
2
|
-
|
|
3
|
-
Rails.application.configure do
|
|
4
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
|
5
|
-
|
|
6
|
-
# Code is not reloaded between requests.
|
|
7
|
-
config.enable_reloading = false
|
|
8
|
-
|
|
9
|
-
# Eager load code on boot. This eager loads most of Rails and
|
|
10
|
-
# your application in memory, allowing both threaded web servers
|
|
11
|
-
# and those relying on copy on write to perform better.
|
|
12
|
-
# Rake tasks automatically ignore this option for performance.
|
|
13
|
-
config.eager_load = true
|
|
14
|
-
|
|
15
|
-
# Full error reports are disabled and caching is turned on.
|
|
16
|
-
config.consider_all_requests_local = false
|
|
17
|
-
config.action_controller.perform_caching = true
|
|
18
|
-
|
|
19
|
-
# Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
|
|
20
|
-
# key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
|
|
21
|
-
# config.require_master_key = true
|
|
22
|
-
|
|
23
|
-
# Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
|
|
24
|
-
# config.public_file_server.enabled = false
|
|
25
|
-
|
|
26
|
-
# Compress CSS using a preprocessor.
|
|
27
|
-
# config.assets.css_compressor = :sass
|
|
28
|
-
|
|
29
|
-
# Do not fall back to assets pipeline if a precompiled asset is missed.
|
|
30
|
-
# config.assets.compile = false
|
|
31
|
-
|
|
32
|
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
|
33
|
-
# config.asset_host = "http://assets.example.com"
|
|
34
|
-
|
|
35
|
-
# Specifies the header that your server uses for sending files.
|
|
36
|
-
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
|
|
37
|
-
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
|
|
38
|
-
|
|
39
|
-
# Store uploaded files on the local file system (see config/storage.yml for options).
|
|
40
|
-
config.active_storage.service = :local
|
|
41
|
-
|
|
42
|
-
# Mount Action Cable outside main process or domain.
|
|
43
|
-
# config.action_cable.mount_path = nil
|
|
44
|
-
# config.action_cable.url = "wss://example.com/cable"
|
|
45
|
-
# config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
|
|
46
|
-
|
|
47
|
-
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
|
|
48
|
-
# Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
|
|
49
|
-
# config.assume_ssl = true
|
|
50
|
-
|
|
51
|
-
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
|
52
|
-
# config.force_ssl = true
|
|
53
|
-
|
|
54
|
-
# Skip http-to-https redirect for the default health check endpoint.
|
|
55
|
-
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
|
|
56
|
-
|
|
57
|
-
# Log to STDOUT by default
|
|
58
|
-
config.logger = ActiveSupport::Logger.new(STDOUT)
|
|
59
|
-
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
|
|
60
|
-
.tap { |logger| break ActiveSupport::TaggedLogging.new logger }
|
|
61
|
-
|
|
62
|
-
# Prepend all log lines with the following tags.
|
|
63
|
-
config.log_tags = [:request_id]
|
|
64
|
-
|
|
65
|
-
# "info" includes generic and useful information about system operation, but avoids logging too much
|
|
66
|
-
# information to avoid inadvertent exposure of personally identifiable information (PII). If you
|
|
67
|
-
# want to log everything, set the level to "debug".
|
|
68
|
-
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
|
|
69
|
-
|
|
70
|
-
# Use a different cache store in production.
|
|
71
|
-
# config.cache_store = :mem_cache_store
|
|
72
|
-
|
|
73
|
-
# Use a real queuing backend for Active Job (and separate queues per environment).
|
|
74
|
-
# config.active_job.queue_adapter = :resque
|
|
75
|
-
# config.active_job.queue_name_prefix = "dummy_production"
|
|
76
|
-
|
|
77
|
-
# Disable caching for Action Mailer templates even if Action Controller
|
|
78
|
-
# caching is enabled.
|
|
79
|
-
config.action_mailer.perform_caching = false
|
|
80
|
-
|
|
81
|
-
# Ignore bad email addresses and do not raise email delivery errors.
|
|
82
|
-
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
|
83
|
-
# config.action_mailer.raise_delivery_errors = false
|
|
84
|
-
|
|
85
|
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
|
86
|
-
# the I18n.default_locale when a translation cannot be found).
|
|
87
|
-
config.i18n.fallbacks = true
|
|
88
|
-
|
|
89
|
-
# Don't log any deprecations.
|
|
90
|
-
config.active_support.report_deprecations = false
|
|
91
|
-
|
|
92
|
-
# Do not dump schema after migrations.
|
|
93
|
-
config.active_record.dump_schema_after_migration = false
|
|
94
|
-
|
|
95
|
-
# Enable DNS rebinding protection and other `Host` header attacks.
|
|
96
|
-
# config.hosts = [
|
|
97
|
-
# "example.com", # Allow requests from example.com
|
|
98
|
-
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
|
|
99
|
-
# ]
|
|
100
|
-
# Skip DNS rebinding protection for the default health check endpoint.
|
|
101
|
-
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
|
|
102
|
-
end
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
require "active_support/core_ext/integer/time"
|
|
2
|
-
|
|
3
|
-
# The test environment is used exclusively to run your application's
|
|
4
|
-
# test suite. You never need to work with it otherwise. Remember that
|
|
5
|
-
# your test database is "scratch space" for the test suite and is wiped
|
|
6
|
-
# and recreated between test runs. Don't rely on the data there!
|
|
7
|
-
|
|
8
|
-
Rails.application.configure do
|
|
9
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
|
10
|
-
|
|
11
|
-
# While tests run files are not watched, reloading is not necessary.
|
|
12
|
-
config.enable_reloading = false
|
|
13
|
-
|
|
14
|
-
# Eager loading loads your entire application. When running a single test locally,
|
|
15
|
-
# this is usually not necessary, and can slow down your test suite. However, it's
|
|
16
|
-
# recommended that you enable it in continuous integration systems to ensure eager
|
|
17
|
-
# loading is working properly before deploying your code.
|
|
18
|
-
config.eager_load = ENV["CI"].present?
|
|
19
|
-
|
|
20
|
-
# Configure public file server for tests with Cache-Control for performance.
|
|
21
|
-
config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{1.hour.to_i}" }
|
|
22
|
-
|
|
23
|
-
# Show full error reports and disable caching.
|
|
24
|
-
config.consider_all_requests_local = true
|
|
25
|
-
config.action_controller.perform_caching = false
|
|
26
|
-
config.cache_store = :null_store
|
|
27
|
-
|
|
28
|
-
# Render exception templates for rescuable exceptions and raise for other exceptions.
|
|
29
|
-
config.action_dispatch.show_exceptions = :rescuable
|
|
30
|
-
|
|
31
|
-
# Disable request forgery protection in test environment.
|
|
32
|
-
config.action_controller.allow_forgery_protection = false
|
|
33
|
-
|
|
34
|
-
# Store uploaded files on the local file system in a temporary directory.
|
|
35
|
-
config.active_storage.service = :test
|
|
36
|
-
|
|
37
|
-
config.active_job.queue_adapter = :test # TODO: remove alongside support for Rails below 7.2
|
|
38
|
-
|
|
39
|
-
# Disable caching for Action Mailer templates even if Action Controller
|
|
40
|
-
# caching is enabled.
|
|
41
|
-
config.action_mailer.perform_caching = false
|
|
42
|
-
|
|
43
|
-
# Tell Action Mailer not to deliver emails to the real world.
|
|
44
|
-
# The :test delivery method accumulates sent emails in the
|
|
45
|
-
# ActionMailer::Base.deliveries array.
|
|
46
|
-
config.action_mailer.delivery_method = :test
|
|
47
|
-
|
|
48
|
-
# Unlike controllers, the mailer instance doesn't have any context about the
|
|
49
|
-
# incoming request so you'll need to provide the :host parameter yourself.
|
|
50
|
-
config.action_mailer.default_url_options = { host: "www.example.com" }
|
|
51
|
-
|
|
52
|
-
# Print deprecation notices to the stderr.
|
|
53
|
-
config.active_support.deprecation = :stderr
|
|
54
|
-
|
|
55
|
-
# Raise exceptions for disallowed deprecations.
|
|
56
|
-
config.active_support.disallowed_deprecation = :raise
|
|
57
|
-
|
|
58
|
-
# Tell Active Support which deprecation messages to disallow.
|
|
59
|
-
config.active_support.disallowed_deprecation_warnings = []
|
|
60
|
-
|
|
61
|
-
# Raises error for missing translations.
|
|
62
|
-
# config.i18n.raise_on_missing_translations = true
|
|
63
|
-
|
|
64
|
-
# Annotate rendered view with file names.
|
|
65
|
-
# config.action_view.annotate_rendered_view_with_filenames = true
|
|
66
|
-
|
|
67
|
-
# Raise error when a before_action's only/except options reference missing actions.
|
|
68
|
-
# config.action_controller.raise_on_missing_callback_actions = true
|
|
69
|
-
end
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
|
2
|
-
|
|
3
|
-
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
|
4
|
-
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
|
5
|
-
|
|
6
|
-
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
|
7
|
-
# Rails.backtrace_cleaner.remove_silencers!
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
|
2
|
-
|
|
3
|
-
# Add new inflection rules using the following format
|
|
4
|
-
# (all these examples are active by default):
|
|
5
|
-
# ActiveSupport::Inflector.inflections do |inflect|
|
|
6
|
-
# inflect.plural /^(ox)$/i, '\1en'
|
|
7
|
-
# inflect.singular /^(ox)en/i, '\1'
|
|
8
|
-
# inflect.irregular 'person', 'people'
|
|
9
|
-
# inflect.uncountable %w( fish sheep )
|
|
10
|
-
# end
|
|
11
|
-
#
|
|
12
|
-
# These inflection rules are supported but not enabled by default:
|
|
13
|
-
# ActiveSupport::Inflector.inflections do |inflect|
|
|
14
|
-
# inflect.acronym 'RESTful'
|
|
15
|
-
# end
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
|
2
|
-
|
|
3
|
-
# Your secret key for verifying the integrity of signed cookies.
|
|
4
|
-
# If you change this key, all old signed cookies will become invalid!
|
|
5
|
-
# Make sure the secret is at least 30 characters and all random,
|
|
6
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
|
7
|
-
Dummy::Application.config.secret_key_base = 'c2e3474d3816f60bf6dd0f3b983e7283c7ff5373e11a96935340b544a31964dbe5ee077136165ee2975e0005f5e80207c0059e6d5589699031242ba5a06dcb87'
|
|
8
|
-
Dummy::Application.config.secret_token = 'c2e3474d3816f60bf6dd0f3b983e7283c7ff5373e11a96935340b544a31964dbe5ee077136165ee2975e0005f5e80207c0059e6d5589699031242ba5a06dcb87'
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
|
2
|
-
|
|
3
|
-
Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
|
|
4
|
-
|
|
5
|
-
# Use the database for sessions instead of the cookie-based default,
|
|
6
|
-
# which shouldn't be used to store highly confidential information
|
|
7
|
-
# (create the session table with "rails generate session_migration")
|
|
8
|
-
# Dummy::Application.config.session_store :active_record_store
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
development:
|
|
2
|
-
# Configure available database clients. (required)
|
|
3
|
-
clients:
|
|
4
|
-
# Defines the default client. (required)
|
|
5
|
-
default:
|
|
6
|
-
# Defines the name of the default database that Mongoid can connect to.
|
|
7
|
-
# (required).
|
|
8
|
-
database: dummy_development
|
|
9
|
-
# Provides the hosts the default client can connect to. Must be an array
|
|
10
|
-
# of host:port pairs. (required)
|
|
11
|
-
hosts:
|
|
12
|
-
- localhost:27017
|
|
13
|
-
options:
|
|
14
|
-
# Change the default write concern. (default = { w: 1 })
|
|
15
|
-
# write:
|
|
16
|
-
# w: 1
|
|
17
|
-
|
|
18
|
-
# Change the default read preference. Valid options for mode are: :secondary,
|
|
19
|
-
# :secondary_preferred, :primary, :primary_preferred, :nearest
|
|
20
|
-
# (default: primary)
|
|
21
|
-
# read:
|
|
22
|
-
# mode: :secondary_preferred
|
|
23
|
-
# tag_sets:
|
|
24
|
-
# - use: web
|
|
25
|
-
|
|
26
|
-
# The name of the user for authentication.
|
|
27
|
-
# user: 'user'
|
|
28
|
-
|
|
29
|
-
# The password of the user for authentication.
|
|
30
|
-
# password: 'password'
|
|
31
|
-
|
|
32
|
-
# The user's database roles.
|
|
33
|
-
# roles:
|
|
34
|
-
# - 'dbOwner'
|
|
35
|
-
|
|
36
|
-
# Change the default authentication mechanism. Valid options are: :scram,
|
|
37
|
-
# :mongodb_cr, :mongodb_x509, and :plain. (default on 3.0 is :scram, default
|
|
38
|
-
# on 2.4 and 2.6 is :plain)
|
|
39
|
-
# auth_mech: :scram
|
|
40
|
-
|
|
41
|
-
# The database or source to authenticate the user against. (default: admin)
|
|
42
|
-
# auth_source: admin
|
|
43
|
-
|
|
44
|
-
# Force a the driver cluster to behave in a certain manner instead of auto-
|
|
45
|
-
# discovering. Can be one of: :direct, :replica_set, :sharded. Set to :direct
|
|
46
|
-
# when connecting to hidden members of a replica set.
|
|
47
|
-
# connect: :direct
|
|
48
|
-
|
|
49
|
-
# Changes the default time in seconds the server monitors refresh their status
|
|
50
|
-
# via ismaster commands. (default: 10)
|
|
51
|
-
# heartbeat_frequency: 10
|
|
52
|
-
|
|
53
|
-
# The time in seconds for selecting servers for a near read preference. (default: 5)
|
|
54
|
-
# local_threshold: 5
|
|
55
|
-
|
|
56
|
-
# The timeout in seconds for selecting a server for an operation. (default: 30)
|
|
57
|
-
# server_selection_timeout: 30
|
|
58
|
-
|
|
59
|
-
# The maximum number of connections in the connection pool. (default: 5)
|
|
60
|
-
# max_pool_size: 5
|
|
61
|
-
|
|
62
|
-
# The minimum number of connections in the connection pool. (default: 1)
|
|
63
|
-
# min_pool_size: 1
|
|
64
|
-
|
|
65
|
-
# The time to wait, in seconds, in the connection pool for a connection
|
|
66
|
-
# to be checked in before timing out. (default: 5)
|
|
67
|
-
# wait_queue_timeout: 5
|
|
68
|
-
|
|
69
|
-
# The time to wait to establish a connection before timing out, in seconds.
|
|
70
|
-
# (default: 5)
|
|
71
|
-
# connect_timeout: 5
|
|
72
|
-
|
|
73
|
-
# The timeout to wait to execute operations on a socket before raising an error.
|
|
74
|
-
# (default: 5)
|
|
75
|
-
# socket_timeout: 5
|
|
76
|
-
|
|
77
|
-
# The name of the replica set to connect to. Servers provided as seeds that do
|
|
78
|
-
# not belong to this replica set will be ignored.
|
|
79
|
-
# replica_set: name
|
|
80
|
-
|
|
81
|
-
# Whether to connect to the servers via ssl. (default: false)
|
|
82
|
-
# ssl: true
|
|
83
|
-
|
|
84
|
-
# The certificate file used to identify the connection against MongoDB.
|
|
85
|
-
# ssl_cert: /path/to/my.cert
|
|
86
|
-
|
|
87
|
-
# The private keyfile used to identify the connection against MongoDB.
|
|
88
|
-
# Note that even if the key is stored in the same file as the certificate,
|
|
89
|
-
# both need to be explicitly specified.
|
|
90
|
-
# ssl_key: /path/to/my.key
|
|
91
|
-
|
|
92
|
-
# A passphrase for the private key.
|
|
93
|
-
# ssl_key_pass_phrase: password
|
|
94
|
-
|
|
95
|
-
# Whether or not to do peer certification validation. (default: true)
|
|
96
|
-
# ssl_verify: true
|
|
97
|
-
|
|
98
|
-
# The file containing a set of concatenated certification authority certifications
|
|
99
|
-
# used to validate certs passed from the other end of the connection.
|
|
100
|
-
# ssl_ca_cert: /path/to/ca.cert
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
# Configure Mongoid specific options. (optional)
|
|
104
|
-
options:
|
|
105
|
-
# Includes the root model name in json serialization. (default: false)
|
|
106
|
-
# include_root_in_json: false
|
|
107
|
-
|
|
108
|
-
# Include the _type field in serialization. (default: false)
|
|
109
|
-
# include_type_for_serialization: false
|
|
110
|
-
|
|
111
|
-
# Preload all models in development, needed when models use
|
|
112
|
-
# inheritance. (default: false)
|
|
113
|
-
# preload_models: false
|
|
114
|
-
|
|
115
|
-
# Raise an error when performing a #find and the document is not found.
|
|
116
|
-
# (default: true)
|
|
117
|
-
# raise_not_found_error: true
|
|
118
|
-
|
|
119
|
-
# Raise an error when defining a scope with the same name as an
|
|
120
|
-
# existing method. (default: false)
|
|
121
|
-
# scope_overwrite_exception: false
|
|
122
|
-
|
|
123
|
-
# Use Active Support's time zone in conversions. (default: true)
|
|
124
|
-
# use_activesupport_time_zone: true
|
|
125
|
-
|
|
126
|
-
# Ensure all times are UTC in the app side. (default: false)
|
|
127
|
-
# use_utc: false
|
|
128
|
-
|
|
129
|
-
# Set the Mongoid and Ruby driver log levels when not in a Rails
|
|
130
|
-
# environment. The Mongoid logger will be set to the Rails logger
|
|
131
|
-
# otherwise.(default: :info)
|
|
132
|
-
# log_level: :info
|
|
133
|
-
test:
|
|
134
|
-
clients:
|
|
135
|
-
default:
|
|
136
|
-
database: dummy_test
|
|
137
|
-
hosts:
|
|
138
|
-
- localhost:27017
|
|
139
|
-
options:
|
|
140
|
-
read:
|
|
141
|
-
mode: :primary
|
|
142
|
-
max_pool_size: 1
|
data/spec/dummy/config/routes.rb
DELETED
data/spec/dummy/config.ru
DELETED
data/spec/dummy/db/schema.rb
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# This file is auto-generated from the current state of the database. Instead
|
|
2
|
-
# of editing this file, please use the migrations feature of Active Record to
|
|
3
|
-
# incrementally modify your database, and then regenerate this schema definition.
|
|
4
|
-
#
|
|
5
|
-
# This file is the source Rails uses to define your schema when running `bin/rails
|
|
6
|
-
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
|
7
|
-
# be faster and is potentially less error prone than running all of your
|
|
8
|
-
# migrations from scratch. Old migrations may fail to apply correctly if those
|
|
9
|
-
# migrations use external dependencies or application code.
|
|
10
|
-
#
|
|
11
|
-
# It's strongly recommended that you check this file into your version control system.
|
|
12
|
-
|
|
13
|
-
ActiveRecord::Schema.define(version: 2024_09_07_041839) do
|
|
14
|
-
|
|
15
|
-
create_table "comments", force: :cascade do |t|
|
|
16
|
-
t.integer "post_id"
|
|
17
|
-
t.datetime "created_at", precision: 6, null: false
|
|
18
|
-
t.datetime "updated_at", precision: 6, null: false
|
|
19
|
-
t.index ["post_id"], name: "index_comments_on_post_id"
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
create_table "posts", force: :cascade do |t|
|
|
23
|
-
t.datetime "created_at", null: false
|
|
24
|
-
t.datetime "updated_at", null: false
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
add_foreign_key "comments", "posts"
|
|
28
|
-
end
|
data/spec/dummy/db/seeds.rb
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
require 'draper'
|
|
2
|
-
|
|
3
|
-
require 'active_model/naming'
|
|
4
|
-
require_relative '../app/decorators/post_decorator'
|
|
5
|
-
|
|
6
|
-
Draper::ViewContext.test_strategy :fast
|
|
7
|
-
|
|
8
|
-
Post = Struct.new(:id) { extend ActiveModel::Naming }
|
|
9
|
-
|
|
10
|
-
describe PostDecorator do
|
|
11
|
-
let(:decorator) { PostDecorator.new(object) }
|
|
12
|
-
let(:object) { Post.new(42) }
|
|
13
|
-
|
|
14
|
-
it "can use built-in helpers" do
|
|
15
|
-
expect(decorator.truncated).to eq "Once upon a..."
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it "can use built-in private helpers" do
|
|
19
|
-
expect(decorator.html_escaped).to eq "<script>danger</script>"
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
it "can't use user-defined helpers from app/helpers" do
|
|
23
|
-
expect{decorator.hello_world}.to raise_error NoMethodError, /hello_world/
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it "can't use path helpers" do
|
|
27
|
-
expect{decorator.path_with_model}.to raise_error NoMethodError, /post_path/
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it "can't use url helpers" do
|
|
31
|
-
expect{decorator.url_with_model}.to raise_error NoMethodError, /post_url/
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
it "can't be passed implicitly to url_for" do
|
|
35
|
-
expect{decorator.link}.to raise_error ArgumentError
|
|
36
|
-
end
|
|
37
|
-
end
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
require 'rake/testtask'
|
|
2
|
-
require 'rspec/core/rake_task'
|
|
3
|
-
|
|
4
|
-
Rake::Task[:test].clear
|
|
5
|
-
Rake::TestTask.new :test do |t|
|
|
6
|
-
t.libs << "test"
|
|
7
|
-
t.pattern = "test/**/*_test.rb"
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
RSpec::Core::RakeTask.new :spec
|
|
11
|
-
|
|
12
|
-
RSpec::Core::RakeTask.new :fast_spec do |t|
|
|
13
|
-
t.pattern = "fast_spec/**/*_spec.rb"
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
task default: [:test, :spec, :fast_spec]
|
data/spec/dummy/log/.gitkeep
DELETED
|
File without changes
|
data/spec/dummy/public/404.html
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
|
5
|
-
<style type="text/css">
|
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
|
7
|
-
div.dialog {
|
|
8
|
-
width: 25em;
|
|
9
|
-
padding: 0 4em;
|
|
10
|
-
margin: 4em auto 0 auto;
|
|
11
|
-
border: 1px solid #ccc;
|
|
12
|
-
border-right-color: #999;
|
|
13
|
-
border-bottom-color: #999;
|
|
14
|
-
}
|
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
|
16
|
-
</style>
|
|
17
|
-
</head>
|
|
18
|
-
|
|
19
|
-
<body>
|
|
20
|
-
<!-- This file lives in public/404.html -->
|
|
21
|
-
<div class="dialog">
|
|
22
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
|
23
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
|
24
|
-
</div>
|
|
25
|
-
</body>
|
|
26
|
-
</html>
|
data/spec/dummy/public/422.html
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
|
5
|
-
<style type="text/css">
|
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
|
7
|
-
div.dialog {
|
|
8
|
-
width: 25em;
|
|
9
|
-
padding: 0 4em;
|
|
10
|
-
margin: 4em auto 0 auto;
|
|
11
|
-
border: 1px solid #ccc;
|
|
12
|
-
border-right-color: #999;
|
|
13
|
-
border-bottom-color: #999;
|
|
14
|
-
}
|
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
|
16
|
-
</style>
|
|
17
|
-
</head>
|
|
18
|
-
|
|
19
|
-
<body>
|
|
20
|
-
<!-- This file lives in public/422.html -->
|
|
21
|
-
<div class="dialog">
|
|
22
|
-
<h1>The change you wanted was rejected.</h1>
|
|
23
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
|
24
|
-
</div>
|
|
25
|
-
</body>
|
|
26
|
-
</html>
|