Skip to content

Commit

Permalink
Merge branch 'master' into activestorage-guide
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyguenther committed Dec 15, 2017
2 parents ab2a95d + cc0d272 commit 1c5358e
Show file tree
Hide file tree
Showing 164 changed files with 1,138 additions and 504 deletions.
6 changes: 6 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ Layout/IndentationConsistency:
Layout/IndentationWidth:
Enabled: true

Layout/LeadingCommentSpace:
Enabled: true

Layout/SpaceAfterColon:
Enabled: true

Expand All @@ -73,6 +76,9 @@ Layout/SpaceAroundKeyword:
Layout/SpaceAroundOperators:
Enabled: true

Layout/SpaceBeforeComma:
Enabled: true

Layout/SpaceBeforeFirstArg:
Enabled: true

Expand Down
11 changes: 7 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ addons:
sources:
- sourceline: "ppa:mc3man/trusty-media"
- sourceline: "ppa:ubuntuhandbook1/apps"
packages:
- ffmpeg
- mupdf
- mupdf-tools

bundler_args: --without test --jobs 3 --retry 3
before_install:
Expand All @@ -38,7 +42,6 @@ before_script:
# Decodes to e.g. `export VARIABLE=VALUE`
- $(base64 --decode <<< "ZXhwb3J0IFNBVUNFX0FDQ0VTU19LRVk9YTAzNTM0M2YtZTkyMi00MGIzLWFhM2MtMDZiM2VhNjM1YzQ4")
- $(base64 --decode <<< "ZXhwb3J0IFNBVUNFX1VTRVJOQU1FPXJ1YnlvbnJhaWxz")
- if [[ $GEM = *ast* ]] ; then sudo apt-get update && sudo apt-get -y install ffmpeg mupdf mupdf-tools ; fi

script: 'ci/travis.rb'

Expand Down Expand Up @@ -103,17 +106,17 @@ matrix:
- "GEM=ar:postgresql POSTGRES=9.2"
addons:
postgresql: "9.2"
- rvm: jruby-9.1.14.0
- rvm: jruby-9.1.15.0
jdk: oraclejdk8
env:
- "GEM=ap"
- rvm: jruby-9.1.14.0
- rvm: jruby-9.1.15.0
jdk: oraclejdk8
env:
- "GEM=am,amo,aj"
allow_failures:
- rvm: ruby-head
- rvm: jruby-9.1.14.0
- rvm: jruby-9.1.15.0
- env: "GEM=ac:integration"
fast_finish: true

Expand Down
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ gem "bootsnap", ">= 1.1.0", require: false
# Active Job.
group :job do
gem "resque", require: false
gem "resque-scheduler", github: "resque/resque-scheduler", require: false
gem "resque-scheduler", require: false
gem "sidekiq", require: false
gem "sucker_punch", require: false
gem "delayed_job", require: false
gem "queue_classic", github: "QueueClassic/queue_classic", branch: "master", require: false, platforms: :ruby
gem "sneakers", require: false
gem "que", require: false
gem "backburner", require: false
#TODO: add qu after it support Rails 5.1
# TODO: add qu after it support Rails 5.1
# gem 'qu-rails', github: "bkeepers/qu", branch: "master", require: false
# gem "qu-redis", require: false
gem "delayed_job_active_record", require: false
Expand Down Expand Up @@ -119,7 +119,7 @@ group :test do
end

platforms :ruby, :mswin, :mswin64, :mingw, :x64_mingw do
gem "nokogiri", ">= 1.6.8"
gem "nokogiri", ">= 1.8.1"

# Needed for compiling the ActionDispatch::Journey parser.
gem "racc", ">=1.4.6", require: false
Expand Down
38 changes: 18 additions & 20 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,6 @@ GIT
event_emitter
websocket

GIT
remote: https://github.com/resque/resque-scheduler.git
revision: 284b862dd63967da1cf3a7e6abd9d2052067c8be
specs:
resque-scheduler (4.3.0)
mono_logger (~> 1.0)
redis (>= 3.3, < 5)
resque (~> 1.26)
rufus-scheduler (~> 3.2)

GIT
remote: https://github.com/robin850/sdoc.git
revision: 0e340352f3ab2f196c8a8743f83c2ee286e4f71c
Expand Down Expand Up @@ -315,7 +305,7 @@ GEM
mime-types-data (3.2016.0521)
mini_magick (4.8.0)
mini_mime (0.1.4)
mini_portile2 (2.2.0)
mini_portile2 (2.3.0)
minitest (5.10.3)
minitest-bisect (1.4.0)
minitest-server (~> 1.0)
Expand All @@ -337,13 +327,14 @@ GEM
mysql2 (0.4.9-x64-mingw32)
mysql2 (0.4.9-x86-mingw32)
nio4r (2.1.0)
nokogiri (1.8.0)
mini_portile2 (~> 2.2.0)
nokogiri (1.8.0-java)
nokogiri (1.8.0-x64-mingw32)
mini_portile2 (~> 2.2.0)
nokogiri (1.8.0-x86-mingw32)
mini_portile2 (~> 2.2.0)
nio4r (2.1.0-java)
nokogiri (1.8.1)
mini_portile2 (~> 2.3.0)
nokogiri (1.8.1-java)
nokogiri (1.8.1-x64-mingw32)
mini_portile2 (~> 2.3.0)
nokogiri (1.8.1-x86-mingw32)
mini_portile2 (~> 2.3.0)
os (0.9.6)
parallel (1.12.0)
parser (2.4.0.0)
Expand Down Expand Up @@ -393,6 +384,11 @@ GEM
redis-namespace (~> 1.3)
sinatra (>= 0.9.2)
vegas (~> 0.1.2)
resque-scheduler (4.3.1)
mono_logger (~> 1.0)
redis (>= 3.3, < 5)
resque (~> 1.26)
rufus-scheduler (~> 3.2)
retriable (3.1.1)
rubocop (0.51.0)
parallel (~> 1.10)
Expand Down Expand Up @@ -488,6 +484,8 @@ GEM
websocket (1.2.4)
websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-driver (0.6.5-java)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
xpath (2.1.0)
nokogiri (~> 1.3)
Expand Down Expand Up @@ -527,7 +525,7 @@ DEPENDENCIES
minitest-bisect
mocha
mysql2 (>= 0.4.4)
nokogiri (>= 1.6.8)
nokogiri (>= 1.8.1)
pg (>= 0.18.0)
psych (~> 2.0)
puma
Expand All @@ -543,7 +541,7 @@ DEPENDENCIES
redis (~> 4.0)
redis-namespace
resque
resque-scheduler!
resque-scheduler
rubocop (>= 0.47)
sass-rails
sdoc!
Expand Down
2 changes: 1 addition & 1 deletion actionmailer/test/message_delivery_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class MessageDeliveryTest < ActiveSupport::TestCase
end

test "its message should be a Mail::Message" do
assert_equal Mail::Message , @mail.message.class
assert_equal Mail::Message, @mail.message.class
end

test "should respond to .deliver_later" do
Expand Down
2 changes: 1 addition & 1 deletion actionmailer/test/url_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def test_url_for
assert_url_for "/dummy_model", DummyModel

# array
assert_url_for "/dummy_model" , [DummyModel]
assert_url_for "/dummy_model", [DummyModel]
end

def test_signed_up_with_url
Expand Down
10 changes: 10 additions & 0 deletions actionpack/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
* Changed the system tests to set Puma as default server only when the
user haven't specified manually another server.

*Guillermo Iguaran*

* Add secure `X-Download-Options` and `X-Permitted-Cross-Domain-Policies` to
default headers set.

*Guillermo Iguaran*

* Add headless firefox support to System Tests.

*bogdanvlviv*
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_dispatch/http/cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def generate_weak_etag(validators)
end

def generate_strong_etag(validators)
%("#{Digest::MD5.hexdigest(ActiveSupport::Cache.expand_cache_key(validators))}")
%("#{ActiveSupport::Digest.hexdigest(ActiveSupport::Cache.expand_cache_key(validators))}")
end

def cache_control_segments
Expand Down
20 changes: 10 additions & 10 deletions actionpack/lib/action_dispatch/journey/nfa/dot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ def to_dot
" #{from} -> #{to} [label=\"#{sym || 'ε'}\"];"
}

#memo_nodes = memos.values.flatten.map { |n|
# label = n
# if Journey::Route === n
# label = "#{n.verb.source} #{n.path.spec}"
# end
# " #{n.object_id} [label=\"#{label}\", shape=box];"
#}
#memo_edges = memos.flat_map { |k, memos|
# (memos || []).map { |v| " #{k} -> #{v.object_id};" }
#}.uniq
# memo_nodes = memos.values.flatten.map { |n|
# label = n
# if Journey::Route === n
# label = "#{n.verb.source} #{n.path.spec}"
# end
# " #{n.object_id} [label=\"#{label}\", shape=box];"
# }
# memo_edges = memos.flat_map { |k, memos|
# (memos || []).map { |v| " #{k} -> #{v.object_id};" }
# }.uniq

<<-eodot
digraph nfa {
Expand Down
4 changes: 3 additions & 1 deletion actionpack/lib/action_dispatch/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class Railtie < Rails::Railtie # :nodoc:
config.action_dispatch.default_headers = {
"X-Frame-Options" => "SAMEORIGIN",
"X-XSS-Protection" => "1; mode=block",
"X-Content-Type-Options" => "nosniff"
"X-Content-Type-Options" => "nosniff",
"X-Download-Options" => "noopen",
"X-Permitted-Cross-Domain-Policies" => "none"
}

config.action_dispatch.cookies_rotations = ActiveSupport::Messages::RotationConfiguration.new
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_dispatch/system_testing/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def setup
end

def set_server
Capybara.server = :puma, { Silent: self.class.silence_puma }
Capybara.server = :puma, { Silent: self.class.silence_puma } if Capybara.server == Capybara.servers[:default]
end

def set_port
Expand Down
7 changes: 6 additions & 1 deletion actionpack/test/abstract_unit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def pop; @queue.pop; end
def initialize(size)
@size = size
@queue = Server.new
file = File.join Dir.tmpdir, Dir::Tmpname.make_tmpname("rails-tests", "fd")
file = File.join Dir.tmpdir, tmpname
@url = "drbunix://#{file}"
@pool = nil
DRb.start_service @url, @queue
Expand Down Expand Up @@ -422,6 +422,11 @@ def translate_exceptions(result)
end
}
end

def tmpname
t = Time.now.strftime("%Y%m%d")
"rails-tests-#{t}-#{$$}-#{rand(0x100000000).to_s(36)}-fd"
end
end

if RUBY_ENGINE == "ruby" && PROCESS_COUNT > 0
Expand Down
2 changes: 1 addition & 1 deletion actionpack/test/controller/live_stream_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def test_stale_without_etag
end

def test_stale_with_etag
@request.if_none_match = %(W/"#{Digest::MD5.hexdigest('123')}")
@request.if_none_match = %(W/"#{ActiveSupport::Digest.hexdigest('123')}")
get :with_stale
assert_equal 304, response.status.to_i
end
Expand Down
2 changes: 1 addition & 1 deletion actionpack/test/controller/metal_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def hello
end
end

def test_response_has_default_headers
def test_response_does_not_have_default_headers
original_default_headers = ActionDispatch::Response.default_headers

ActionDispatch::Response.default_headers = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def walk_permitted(params)

test "key: permitted scalar values" do
values = ["a", :a, nil]
values += [0, 1.0, 2**128, BigDecimal.new(1)]
values += [0, 1.0, 2**128, BigDecimal(1)]
values += [true, false]
values += [Date.today, Time.now, DateTime.now]
values += [STDOUT, StringIO.new, ActionDispatch::Http::UploadedFile.new(tempfile: __FILE__),
Expand Down
2 changes: 1 addition & 1 deletion actionpack/test/controller/render_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ def weak_etag(record)
end

def strong_etag(record)
%("#{Digest::MD5.hexdigest(ActiveSupport::Cache.expand_cache_key(record))}")
%("#{ActiveSupport::Digest.hexdigest(ActiveSupport::Cache.expand_cache_key(record))}")
end
end

Expand Down
2 changes: 1 addition & 1 deletion actionpack/test/controller/resources_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def test_with_two_member_actions_with_same_method
set.draw do
resources :messages do
member do
match :mark , via: method
match :mark, via: method
match :unmark, via: method
end
end
Expand Down
4 changes: 2 additions & 2 deletions actionpack/test/controller/routing_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1687,7 +1687,7 @@ def test_route_requirement_with_xi_modifiers
def test_routes_with_symbols
set.draw do
get "unnamed", controller: :pages, action: :show, name: :as_symbol
get "named" , controller: :pages, action: :show, name: :as_symbol, as: :named
get "named", controller: :pages, action: :show, name: :as_symbol, as: :named
end
assert_equal({ controller: "pages", action: "show", name: :as_symbol }, set.recognize_path("/unnamed"))
assert_equal({ controller: "pages", action: "show", name: :as_symbol }, set.recognize_path("/named"))
Expand Down Expand Up @@ -1893,7 +1893,7 @@ def test_generate_with_optional_params_recalls_last_request
assert_equal({ controller: "blog", action: "show_date", year: "2006", month: "07", day: "28" }, controller.request.path_parameters)
assert_equal("/blog/2006/07/25", controller.url_for(day: 25, only_path: true))
assert_equal("/blog/2005", controller.url_for(year: 2005, only_path: true))
assert_equal("/blog/show/123", controller.url_for(action: "show" , id: 123, only_path: true))
assert_equal("/blog/show/123", controller.url_for(action: "show", id: 123, only_path: true))
assert_equal("/blog/2006", controller.url_for(year: 2006, only_path: true))
assert_equal("/blog/2006", controller.url_for(year: 2006, month: nil, only_path: true))
end
Expand Down
1 change: 0 additions & 1 deletion actionpack/test/controller/url_for_integration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class URLForIntegrationTest < ActiveSupport::TestCase
as: "blog"

resources :people
#match 'legacy/people' => "people#index", :legacy => "true"

get "symbols", controller: :symbols, action: :show, name: :as_symbol
get "id_default(/:id)" => "foo#id_default", :id => 1
Expand Down
2 changes: 1 addition & 1 deletion actionpack/test/controller/url_rewriter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def rewrite(routes, options)

def setup
@params = {}
@rewriter = Rewriter.new(@request) #.new(@request, @params)
@rewriter = Rewriter.new(@request)
@routes = ActionDispatch::Routing::RouteSet.new.tap do |r|
r.draw do
ActiveSupport::Deprecation.silence do
Expand Down
8 changes: 6 additions & 2 deletions actionpack/test/dispatch/response_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -311,13 +311,15 @@ def test_only_set_charset_still_defaults_to_text_html
end
end

test "read x_frame_options, x_content_type_options and x_xss_protection" do
test "read x_frame_options, x_content_type_options, x_xss_protection, x_download_options and x_permitted_cross_domain_policies" do
original_default_headers = ActionDispatch::Response.default_headers
begin
ActionDispatch::Response.default_headers = {
"X-Frame-Options" => "DENY",
"X-Content-Type-Options" => "nosniff",
"X-XSS-Protection" => "1;"
"X-XSS-Protection" => "1;",
"X-Download-Options" => "noopen",
"X-Permitted-Cross-Domain-Policies" => "none"
}
resp = ActionDispatch::Response.create.tap { |response|
response.body = "Hello"
Expand All @@ -327,6 +329,8 @@ def test_only_set_charset_still_defaults_to_text_html
assert_equal("DENY", resp.headers["X-Frame-Options"])
assert_equal("nosniff", resp.headers["X-Content-Type-Options"])
assert_equal("1;", resp.headers["X-XSS-Protection"])
assert_equal("noopen", resp.headers["X-Download-Options"])
assert_equal("none", resp.headers["X-Permitted-Cross-Domain-Policies"])
ensure
ActionDispatch::Response.default_headers = original_default_headers
end
Expand Down
2 changes: 1 addition & 1 deletion actionpack/test/dispatch/routing_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4225,7 +4225,7 @@ class TestGlobRoutingMapper < ActionDispatch::IntegrationTest
end
end

#include Routes.url_helpers
# include Routes.url_helpers
APP = build_app Routes
def app; APP end

Expand Down
Loading

0 comments on commit 1c5358e

Please sign in to comment.