s3_relay 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/app/controllers/s3_relay/uploads_controller.rb +8 -2
- data/app/models/s3_relay/upload.rb +1 -1
- data/lib/s3_relay/private_url.rb +1 -1
- data/lib/s3_relay/version.rb +1 -1
- data/test/controllers/s3_relay/uploads_controller_test.rb +17 -11
- data/test/dummy/{README.rdoc → README.md} +1 -5
- data/test/dummy/Rakefile +1 -1
- data/test/dummy/app/assets/config/manifest.js +3 -0
- data/test/dummy/app/assets/javascripts/application.js +6 -4
- data/test/dummy/app/assets/javascripts/cable.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +5 -5
- data/test/dummy/app/channels/application_cable/channel.rb +4 -0
- data/test/dummy/app/channels/application_cable/connection.rb +4 -0
- data/test/dummy/app/controllers/application_controller.rb +0 -2
- data/test/dummy/app/jobs/application_job.rb +2 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/application_record.rb +3 -0
- data/test/dummy/app/models/product.rb +1 -1
- data/test/dummy/app/views/layouts/application.html.erb +9 -9
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/bin/rails +6 -1
- data/test/dummy/bin/rake +5 -0
- data/test/dummy/bin/setup +38 -0
- data/test/dummy/bin/spring +17 -0
- data/test/dummy/bin/update +29 -0
- data/test/dummy/bin/yarn +11 -0
- data/test/dummy/config/application.rb +7 -11
- data/test/dummy/config/boot.rb +2 -4
- data/test/dummy/config/cable.yml +10 -0
- data/test/dummy/config/environment.rb +1 -1
- data/test/dummy/config/environments/development.rb +24 -7
- data/test/dummy/config/environments/production.rb +35 -22
- data/test/dummy/config/environments/test.rb +6 -3
- data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/test/dummy/config/initializers/assets.rb +8 -2
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -1
- data/test/dummy/config/initializers/wrap_parameters.rb +2 -2
- data/test/dummy/config/locales/en.yml +10 -0
- data/test/dummy/config/puma.rb +56 -0
- data/test/dummy/config/secrets.yml +15 -5
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/config.ru +2 -1
- data/test/dummy/db/seeds.rb +7 -0
- data/test/dummy/package.json +5 -0
- data/test/dummy/public/404.html +6 -6
- data/test/dummy/public/422.html +6 -6
- data/test/dummy/public/500.html +6 -6
- data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/test/dummy/public/apple-touch-icon.png +0 -0
- data/test/dummy/public/robots.txt +1 -0
- data/test/dummy/test/application_system_test_case.rb +5 -0
- data/test/dummy/test/test_helper.rb +9 -0
- data/test/factories/uploads.rb +10 -3
- data/test/helpers/s3_relay/uploads_helper_test.rb +3 -3
- data/test/models/s3_relay/upload_test.rb +6 -5
- data/test/test_helper.rb +1 -0
- metadata +89 -33
- data/test/dummy/config/initializers/session_store.rb +0 -3
- data/test/dummy/log/development.log +0 -26
- data/test/dummy/log/test.log +0 -988
@@ -14,13 +14,14 @@ Rails.application.configure do
|
|
14
14
|
config.consider_all_requests_local = false
|
15
15
|
config.action_controller.perform_caching = true
|
16
16
|
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
|
17
|
+
# Attempt to read encrypted secrets from `config/secrets.yml.enc`.
|
18
|
+
# Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or
|
19
|
+
# `config/secrets.yml.key`.
|
20
|
+
config.read_encrypted_secrets = true
|
21
21
|
|
22
|
-
# Disable
|
23
|
-
|
22
|
+
# Disable serving static files from the `/public` folder by default since
|
23
|
+
# Apache or NGINX already handles this.
|
24
|
+
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
24
25
|
|
25
26
|
# Compress JavaScripts and CSS.
|
26
27
|
config.assets.js_compressor = :uglifier
|
@@ -29,32 +30,37 @@ Rails.application.configure do
|
|
29
30
|
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
30
31
|
config.assets.compile = false
|
31
32
|
|
32
|
-
# Generate digests for assets URLs.
|
33
|
-
config.assets.digest = true
|
34
|
-
|
35
33
|
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
36
34
|
|
35
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
36
|
+
# config.action_controller.asset_host = 'http://assets.example.com'
|
37
|
+
|
37
38
|
# Specifies the header that your server uses for sending files.
|
38
|
-
# config.action_dispatch.x_sendfile_header =
|
39
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for
|
39
|
+
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
40
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
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.*/ ]
|
40
46
|
|
41
47
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
42
48
|
# config.force_ssl = true
|
43
49
|
|
44
|
-
#
|
45
|
-
|
50
|
+
# Use the lowest log level to ensure availability of diagnostic information
|
51
|
+
# when problems arise.
|
52
|
+
config.log_level = :debug
|
46
53
|
|
47
54
|
# Prepend all log lines with the following tags.
|
48
|
-
|
49
|
-
|
50
|
-
# Use a different logger for distributed setups.
|
51
|
-
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
55
|
+
config.log_tags = [ :request_id ]
|
52
56
|
|
53
57
|
# Use a different cache store in production.
|
54
58
|
# config.cache_store = :mem_cache_store
|
55
59
|
|
56
|
-
#
|
57
|
-
# config.
|
60
|
+
# Use a real queuing backend for Active Job (and separate queues per environment)
|
61
|
+
# config.active_job.queue_adapter = :resque
|
62
|
+
# config.active_job.queue_name_prefix = "dummy_#{Rails.env}"
|
63
|
+
config.action_mailer.perform_caching = false
|
58
64
|
|
59
65
|
# Ignore bad email addresses and do not raise email delivery errors.
|
60
66
|
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
@@ -67,12 +73,19 @@ Rails.application.configure do
|
|
67
73
|
# Send deprecation notices to registered listeners.
|
68
74
|
config.active_support.deprecation = :notify
|
69
75
|
|
70
|
-
# Disable automatic flushing of the log to improve performance.
|
71
|
-
# config.autoflush_log = false
|
72
|
-
|
73
76
|
# Use default logging formatter so that PID and timestamp are not suppressed.
|
74
77
|
config.log_formatter = ::Logger::Formatter.new
|
75
78
|
|
79
|
+
# Use a different logger for distributed setups.
|
80
|
+
# require 'syslog/logger'
|
81
|
+
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
82
|
+
|
83
|
+
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
84
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
85
|
+
logger.formatter = config.log_formatter
|
86
|
+
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
87
|
+
end
|
88
|
+
|
76
89
|
# Do not dump schema after migrations.
|
77
90
|
config.active_record.dump_schema_after_migration = false
|
78
91
|
end
|
@@ -12,9 +12,11 @@ Rails.application.configure do
|
|
12
12
|
# preloads Rails for running tests, you may have to set it to true.
|
13
13
|
config.eager_load = false
|
14
14
|
|
15
|
-
# Configure
|
16
|
-
config.
|
17
|
-
config.
|
15
|
+
# Configure public file server for tests with Cache-Control for performance.
|
16
|
+
config.public_file_server.enabled = true
|
17
|
+
config.public_file_server.headers = {
|
18
|
+
'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
|
19
|
+
}
|
18
20
|
|
19
21
|
# Show full error reports and disable caching.
|
20
22
|
config.consider_all_requests_local = true
|
@@ -25,6 +27,7 @@ Rails.application.configure do
|
|
25
27
|
|
26
28
|
# Disable request forgery protection in test environment.
|
27
29
|
config.action_controller.allow_forgery_protection = false
|
30
|
+
config.action_mailer.perform_caching = false
|
28
31
|
|
29
32
|
# Tell Action Mailer not to deliver emails to the real world.
|
30
33
|
# The :test delivery method accumulates sent emails in the
|
@@ -3,6 +3,12 @@
|
|
3
3
|
# Version of your assets, change this if you want to expire all your assets.
|
4
4
|
Rails.application.config.assets.version = '1.0'
|
5
5
|
|
6
|
+
# Add additional assets to the asset load path.
|
7
|
+
# Rails.application.config.assets.paths << Emoji.images_path
|
8
|
+
# Add Yarn node_modules folder to the asset load path.
|
9
|
+
Rails.application.config.assets.paths << Rails.root.join('node_modules')
|
10
|
+
|
6
11
|
# Precompile additional assets.
|
7
|
-
# application.js, application.css, and all non-JS/CSS in app/assets
|
8
|
-
#
|
12
|
+
# application.js, application.css, and all non-JS/CSS in the app/assets
|
13
|
+
# folder are already added.
|
14
|
+
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
|
@@ -1,3 +1,5 @@
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
2
2
|
|
3
|
-
|
3
|
+
# Specify a serializer for the signed and encrypted cookie jars.
|
4
|
+
# Valid options are :json, :marshal, and :hybrid.
|
5
|
+
Rails.application.config.action_dispatch.cookies_serializer = :json
|
@@ -5,10 +5,10 @@
|
|
5
5
|
|
6
6
|
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
7
|
ActiveSupport.on_load(:action_controller) do
|
8
|
-
wrap_parameters format: [:json]
|
8
|
+
wrap_parameters format: [:json]
|
9
9
|
end
|
10
10
|
|
11
11
|
# To enable root element in JSON for ActiveRecord objects.
|
12
12
|
# ActiveSupport.on_load(:active_record) do
|
13
|
-
#
|
13
|
+
# self.include_root_in_json = true
|
14
14
|
# end
|
@@ -16,6 +16,16 @@
|
|
16
16
|
#
|
17
17
|
# This would use the information in config/locales/es.yml.
|
18
18
|
#
|
19
|
+
# The following keys must be escaped otherwise they will not be retrieved by
|
20
|
+
# the default I18n backend:
|
21
|
+
#
|
22
|
+
# true, false, on, off, yes, no
|
23
|
+
#
|
24
|
+
# Instead, surround them with single quotes.
|
25
|
+
#
|
26
|
+
# en:
|
27
|
+
# 'true': 'foo'
|
28
|
+
#
|
19
29
|
# To learn more, please read the Rails Internationalization guide
|
20
30
|
# available at http://guides.rubyonrails.org/i18n.html.
|
21
31
|
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# Puma can serve each request in a thread from an internal thread pool.
|
2
|
+
# The `threads` method setting takes two numbers: a minimum and maximum.
|
3
|
+
# Any libraries that use thread pools should be configured to match
|
4
|
+
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
5
|
+
# and maximum; this matches the default thread size of Active Record.
|
6
|
+
#
|
7
|
+
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
|
8
|
+
threads threads_count, threads_count
|
9
|
+
|
10
|
+
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
11
|
+
#
|
12
|
+
port ENV.fetch("PORT") { 3000 }
|
13
|
+
|
14
|
+
# Specifies the `environment` that Puma will run in.
|
15
|
+
#
|
16
|
+
environment ENV.fetch("RAILS_ENV") { "development" }
|
17
|
+
|
18
|
+
# Specifies the number of `workers` to boot in clustered mode.
|
19
|
+
# Workers are forked webserver processes. If using threads and workers together
|
20
|
+
# the concurrency of the application would be max `threads` * `workers`.
|
21
|
+
# Workers do not work on JRuby or Windows (both of which do not support
|
22
|
+
# processes).
|
23
|
+
#
|
24
|
+
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
|
25
|
+
|
26
|
+
# Use the `preload_app!` method when specifying a `workers` number.
|
27
|
+
# This directive tells Puma to first boot the application and load code
|
28
|
+
# before forking the application. This takes advantage of Copy On Write
|
29
|
+
# process behavior so workers use less memory. If you use this option
|
30
|
+
# you need to make sure to reconnect any threads in the `on_worker_boot`
|
31
|
+
# block.
|
32
|
+
#
|
33
|
+
# preload_app!
|
34
|
+
|
35
|
+
# If you are preloading your application and using Active Record, it's
|
36
|
+
# recommended that you close any connections to the database before workers
|
37
|
+
# are forked to prevent connection leakage.
|
38
|
+
#
|
39
|
+
# before_fork do
|
40
|
+
# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
|
41
|
+
# end
|
42
|
+
|
43
|
+
# The code in the `on_worker_boot` will be called if you are using
|
44
|
+
# clustered mode by specifying a number of `workers`. After each worker
|
45
|
+
# process is booted, this block will be run. If you are using the `preload_app!`
|
46
|
+
# option, you will want to use this block to reconnect to any threads
|
47
|
+
# or connections that may have been created at application boot, as Ruby
|
48
|
+
# cannot share connections between processes.
|
49
|
+
#
|
50
|
+
# on_worker_boot do
|
51
|
+
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
|
55
|
+
# Allow puma to be restarted by `rails restart` command.
|
56
|
+
plugin :tmp_restart
|
@@ -5,18 +5,28 @@
|
|
5
5
|
|
6
6
|
# Make sure the secret is at least 30 characters and all random,
|
7
7
|
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
-
# You can use `
|
8
|
+
# You can use `rails secret` to generate a secure secret key.
|
9
9
|
|
10
10
|
# Make sure the secrets in this file are kept private
|
11
11
|
# if you're sharing your code publicly.
|
12
12
|
|
13
|
+
# Shared secrets are available across all environments.
|
14
|
+
|
15
|
+
# shared:
|
16
|
+
# api_key: a1B2c3D4e5F6
|
17
|
+
|
18
|
+
# Environmental secrets are only available for that specific environment.
|
19
|
+
|
13
20
|
development:
|
14
|
-
secret_key_base:
|
21
|
+
secret_key_base: 19e610b06a453d05b6e62ef4ed269ed3d02714be49111f3003bb3a0afcb0bf4876765658e31d6e9a8ca3b7317c5455ef36c1c19f57342c3865f63cb8a04737b8
|
15
22
|
|
16
23
|
test:
|
17
|
-
secret_key_base:
|
24
|
+
secret_key_base: dd79062a967665de1536193b1e40f9816ba53ca659dd8227f0aa96675e1fbd951b519d6b431147102b9aca9df6ee335463617f57c9d58434071b4f9e1117cb59
|
25
|
+
|
26
|
+
# Do not keep production secrets in the unencrypted secrets file.
|
27
|
+
# Instead, either read values from the environment.
|
28
|
+
# Or, use `bin/rails secrets:setup` to configure encrypted secrets
|
29
|
+
# and move the `production:` environment over there.
|
18
30
|
|
19
|
-
# Do not keep production secrets in the repository,
|
20
|
-
# instead read values from the environment.
|
21
31
|
production:
|
22
32
|
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
data/test/dummy/config.ru
CHANGED
@@ -0,0 +1,7 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
+
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
|
3
|
+
#
|
4
|
+
# Examples:
|
5
|
+
#
|
6
|
+
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
|
7
|
+
# Character.create(name: 'Luke', movie: movies.first)
|
data/test/dummy/public/404.html
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
<title>The page you were looking for doesn't exist (404)</title>
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
6
|
<style>
|
7
|
-
|
7
|
+
.rails-default-error-page {
|
8
8
|
background-color: #EFEFEF;
|
9
9
|
color: #2E2F30;
|
10
10
|
text-align: center;
|
@@ -12,13 +12,13 @@
|
|
12
12
|
margin: 0;
|
13
13
|
}
|
14
14
|
|
15
|
-
div.dialog {
|
15
|
+
.rails-default-error-page div.dialog {
|
16
16
|
width: 95%;
|
17
17
|
max-width: 33em;
|
18
18
|
margin: 4em auto 0;
|
19
19
|
}
|
20
20
|
|
21
|
-
div.dialog > div {
|
21
|
+
.rails-default-error-page div.dialog > div {
|
22
22
|
border: 1px solid #CCC;
|
23
23
|
border-right-color: #999;
|
24
24
|
border-left-color: #999;
|
@@ -31,13 +31,13 @@
|
|
31
31
|
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
32
|
}
|
33
33
|
|
34
|
-
h1 {
|
34
|
+
.rails-default-error-page h1 {
|
35
35
|
font-size: 100%;
|
36
36
|
color: #730E15;
|
37
37
|
line-height: 1.5em;
|
38
38
|
}
|
39
39
|
|
40
|
-
div.dialog > p {
|
40
|
+
.rails-default-error-page div.dialog > p {
|
41
41
|
margin: 0 0 1em;
|
42
42
|
padding: 1em;
|
43
43
|
background-color: #F7F7F7;
|
@@ -54,7 +54,7 @@
|
|
54
54
|
</style>
|
55
55
|
</head>
|
56
56
|
|
57
|
-
<body>
|
57
|
+
<body class="rails-default-error-page">
|
58
58
|
<!-- This file lives in public/404.html -->
|
59
59
|
<div class="dialog">
|
60
60
|
<div>
|
data/test/dummy/public/422.html
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
<title>The change you wanted was rejected (422)</title>
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
6
|
<style>
|
7
|
-
|
7
|
+
.rails-default-error-page {
|
8
8
|
background-color: #EFEFEF;
|
9
9
|
color: #2E2F30;
|
10
10
|
text-align: center;
|
@@ -12,13 +12,13 @@
|
|
12
12
|
margin: 0;
|
13
13
|
}
|
14
14
|
|
15
|
-
div.dialog {
|
15
|
+
.rails-default-error-page div.dialog {
|
16
16
|
width: 95%;
|
17
17
|
max-width: 33em;
|
18
18
|
margin: 4em auto 0;
|
19
19
|
}
|
20
20
|
|
21
|
-
div.dialog > div {
|
21
|
+
.rails-default-error-page div.dialog > div {
|
22
22
|
border: 1px solid #CCC;
|
23
23
|
border-right-color: #999;
|
24
24
|
border-left-color: #999;
|
@@ -31,13 +31,13 @@
|
|
31
31
|
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
32
|
}
|
33
33
|
|
34
|
-
h1 {
|
34
|
+
.rails-default-error-page h1 {
|
35
35
|
font-size: 100%;
|
36
36
|
color: #730E15;
|
37
37
|
line-height: 1.5em;
|
38
38
|
}
|
39
39
|
|
40
|
-
div.dialog > p {
|
40
|
+
.rails-default-error-page div.dialog > p {
|
41
41
|
margin: 0 0 1em;
|
42
42
|
padding: 1em;
|
43
43
|
background-color: #F7F7F7;
|
@@ -54,7 +54,7 @@
|
|
54
54
|
</style>
|
55
55
|
</head>
|
56
56
|
|
57
|
-
<body>
|
57
|
+
<body class="rails-default-error-page">
|
58
58
|
<!-- This file lives in public/422.html -->
|
59
59
|
<div class="dialog">
|
60
60
|
<div>
|
data/test/dummy/public/500.html
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
<title>We're sorry, but something went wrong (500)</title>
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
6
|
<style>
|
7
|
-
|
7
|
+
.rails-default-error-page {
|
8
8
|
background-color: #EFEFEF;
|
9
9
|
color: #2E2F30;
|
10
10
|
text-align: center;
|
@@ -12,13 +12,13 @@
|
|
12
12
|
margin: 0;
|
13
13
|
}
|
14
14
|
|
15
|
-
div.dialog {
|
15
|
+
.rails-default-error-page div.dialog {
|
16
16
|
width: 95%;
|
17
17
|
max-width: 33em;
|
18
18
|
margin: 4em auto 0;
|
19
19
|
}
|
20
20
|
|
21
|
-
div.dialog > div {
|
21
|
+
.rails-default-error-page div.dialog > div {
|
22
22
|
border: 1px solid #CCC;
|
23
23
|
border-right-color: #999;
|
24
24
|
border-left-color: #999;
|
@@ -31,13 +31,13 @@
|
|
31
31
|
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
32
|
}
|
33
33
|
|
34
|
-
h1 {
|
34
|
+
.rails-default-error-page h1 {
|
35
35
|
font-size: 100%;
|
36
36
|
color: #730E15;
|
37
37
|
line-height: 1.5em;
|
38
38
|
}
|
39
39
|
|
40
|
-
div.dialog > p {
|
40
|
+
.rails-default-error-page div.dialog > p {
|
41
41
|
margin: 0 0 1em;
|
42
42
|
padding: 1em;
|
43
43
|
background-color: #F7F7F7;
|
@@ -54,7 +54,7 @@
|
|
54
54
|
</style>
|
55
55
|
</head>
|
56
56
|
|
57
|
-
<body>
|
57
|
+
<body class="rails-default-error-page">
|
58
58
|
<!-- This file lives in public/500.html -->
|
59
59
|
<div class="dialog">
|
60
60
|
<div>
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require File.expand_path('../../config/environment', __FILE__)
|
2
|
+
require 'rails/test_help'
|
3
|
+
|
4
|
+
class ActiveSupport::TestCase
|
5
|
+
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
|
6
|
+
fixtures :all
|
7
|
+
|
8
|
+
# Add more helper methods to be used by all tests here...
|
9
|
+
end
|
data/test/factories/uploads.rb
CHANGED
@@ -1,16 +1,23 @@
|
|
1
1
|
FactoryGirl.define do
|
2
2
|
factory :upload, class: "S3Relay::Upload" do
|
3
|
-
uuid
|
3
|
+
uuid { SecureRandom.uuid }
|
4
|
+
end
|
5
|
+
|
6
|
+
factory :file_upload, parent: :upload do
|
4
7
|
filename "cat.png"
|
5
8
|
content_type "image/png"
|
6
9
|
upload_type "FileUpload"
|
7
10
|
end
|
8
11
|
|
9
12
|
factory :icon_upload, parent: :upload do
|
10
|
-
|
13
|
+
filename "cat.png"
|
14
|
+
content_type "image/png"
|
15
|
+
upload_type "IconUpload"
|
11
16
|
end
|
12
17
|
|
13
18
|
factory :photo_upload, parent: :upload do
|
14
|
-
|
19
|
+
filename "cat.png"
|
20
|
+
content_type "image/png"
|
21
|
+
upload_type "PhotoUpload"
|
15
22
|
end
|
16
23
|
end
|
@@ -7,21 +7,21 @@ describe S3Relay::UploadsHelper do
|
|
7
7
|
describe "without options" do
|
8
8
|
it do
|
9
9
|
s3_relay_field(@product, :photo_uploads)
|
10
|
-
.must_equal %Q{<div class="s3r-container" data-
|
10
|
+
.must_equal %Q{<div class="s3r-container" data-parent-type="product" data-parent-id="#{@product.id}" data-association="photo_uploads" data-disposition=\"inline\"><input type="file" name="file" id="file" class="s3r-field" /><table class="s3r-upload-list"></table></div>}
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
14
|
describe "with multiple: true" do
|
15
15
|
it do
|
16
16
|
s3_relay_field(@product, :photo_uploads, multiple: true)
|
17
|
-
.must_equal %Q{<div class="s3r-container" data-
|
17
|
+
.must_equal %Q{<div class="s3r-container" data-parent-type="product" data-parent-id="#{@product.id}" data-association="photo_uploads" data-disposition=\"inline\"><input type="file" name="file" id="file" multiple="multiple" class="s3r-field" /><table class="s3r-upload-list"></table></div>}
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
describe "with disposition: attachment" do
|
22
22
|
it do
|
23
23
|
s3_relay_field(@product, :photo_uploads, disposition: :attachment)
|
24
|
-
.must_equal %Q{<div class="s3r-container" data-
|
24
|
+
.must_equal %Q{<div class="s3r-container" data-parent-type="product" data-parent-id="#{@product.id}" data-association="photo_uploads" data-disposition=\"attachment\"><input type="file" name="file" id="file" disposition=\"attachment\" class="s3r-field" /><table class="s3r-upload-list"></table></div>}
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -2,7 +2,7 @@ require "test_helper"
|
|
2
2
|
|
3
3
|
describe S3Relay::Upload do
|
4
4
|
before do
|
5
|
-
@upload =
|
5
|
+
@upload = FactoryGirl.build(:upload)
|
6
6
|
end
|
7
7
|
|
8
8
|
describe "associations" do
|
@@ -17,12 +17,13 @@ describe S3Relay::Upload do
|
|
17
17
|
describe "validations" do
|
18
18
|
describe "uuid" do
|
19
19
|
it "validates presence" do
|
20
|
+
@upload.uuid = nil
|
20
21
|
@upload.valid?
|
21
22
|
@upload.errors[:uuid].must_include("can't be blank")
|
22
23
|
end
|
23
24
|
|
24
25
|
it "validates uniqueness" do
|
25
|
-
|
26
|
+
FactoryGirl.create(:file_upload, uuid: @upload.uuid)
|
26
27
|
@upload.valid?
|
27
28
|
@upload.errors[:uuid].must_include("has already been taken")
|
28
29
|
end
|
@@ -60,9 +61,9 @@ describe S3Relay::Upload do
|
|
60
61
|
|
61
62
|
describe "scopes" do
|
62
63
|
before do
|
63
|
-
@pending =
|
64
|
+
@pending = FactoryGirl.build(:file_upload)
|
64
65
|
.tap { |u| u.save(validate: false) }
|
65
|
-
@imported =
|
66
|
+
@imported = FactoryGirl.build(:upload, state: "imported")
|
66
67
|
.tap { |u| u.save(validate: false) }
|
67
68
|
end
|
68
69
|
|
@@ -110,7 +111,7 @@ describe S3Relay::Upload do
|
|
110
111
|
end
|
111
112
|
|
112
113
|
describe "#notify_parent" do
|
113
|
-
before { @upload = FactoryGirl.build(:
|
114
|
+
before { @upload = FactoryGirl.build(:file_upload) }
|
114
115
|
|
115
116
|
describe "when the parent is associated" do
|
116
117
|
it do
|