diff --git a/.travis.yml b/.travis.yml
index b836657c..6c613b19 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,8 +2,8 @@ language: ruby
services: mongodb
before_script: ./script/ci/before_build.sh
rvm:
- - 2.6.5
- - 2.7.2
+ - 3.0.5
+ - 3.1.2
addons:
code_climate:
repo_token: 3fa74f2ade25037fccd7261090acbdeae232639c3a83aafb80ee428ec16b8cf9
diff --git a/Gemfile b/Gemfile
index 643ebe94..87cba026 100644
--- a/Gemfile
+++ b/Gemfile
@@ -4,31 +4,29 @@ gemspec
group :development do
# gem 'locomotivecms_common', github: 'locomotivecms/common', ref: '4d1bd56'
- # gem 'locomotivecms_common', path: '../common'
+ gem 'locomotivecms_common', path: '../common'
# gem 'duktape', path: '../tmp/duktape.rb'
# gem 'duktape', github: 'judofyr/duktape.rb', ref: '20ef6a5'
# gem 'duktape', github: 'did/duktape.rb', branch: 'any-fixnum'
- gem 'puma', '~> 5.6.4'
- gem 'haml', '~> 5.2.0'
+ gem 'puma', '~> 6.1.0'
+ gem 'haml', '~> 6.1.1'
- gem 'rack', '~> 2.2.3.1'
- gem 'rack-mini-profiler', '~> 0.10.1'
+ gem 'rack', '~> 2', '< 3'
+ gem 'rack-mini-profiler', '~> 3.0.0'
gem 'flamegraph'
gem 'stackprof' # ruby 2.1+ only
gem 'memory_profiler'
+ gem 'rubocop'
end
group :test do
- gem 'rspec', '~> 3.7.0'
+ gem 'rspec', '~> 3.12.0'
gem 'json_spec', '~> 1.1.5'
gem 'i18n-spec', '~> 0.6.0'
-
- gem 'timecop', '~> 0.9.1'
-
- # gem 'pry-byebug', '~> 3.3.0'
-
- gem 'rack-test', '~> 0.8.2'
-
- gem 'coveralls', '~> 0.8.1', require: false
+ gem 'rack-test', '~> 2.0.2'
+
+ gem 'timecop', '~> 0.9.6'
+ gem 'pry-byebug', '~> 3.10.1'
+ gem 'simplecov', require: false
end
diff --git a/Gemfile.lock b/Gemfile.lock
index 751ed894..899636f7 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,76 +1,58 @@
+PATH
+ remote: ../common
+ specs:
+ locomotivecms_common (1.0.0)
+ activesupport (>= 7)
+ attr_extras (~> 7.1.0)
+ colorize
+ stringex (~> 2.8.5)
+
PATH
remote: .
specs:
- locomotivecms_steam (1.6.1)
+ locomotivecms_steam (2.0.0)
RedCloth (~> 4.3.2)
- autoprefixer-rails (~> 8.0.0)
- bcrypt (~> 3.1.11)
+ bcrypt (~> 3.1.18)
chronic (~> 0.10.2)
- coffee-script (~> 2.4.1)
- compass (~> 1.0.3)
- dragonfly (>= 1.2, < 1.5)
- duktape (~> 2.0.1.1)
- httparty (~> 0.16.0)
- kramdown (~> 2.3.0)
+ dragonfly (~> 1.4.0)
+ duktape (~> 2.7.0.0)
+ execjs (~> 2.8.1)
+ httparty (~> 0.21.0)
+ kramdown (~> 2.4.0)
liquid (~> 4.0.4)
- locomotivecms_common (~> 0.4.0)
- mime-types (~> 3.3.0)
+ locomotivecms_common (>= 1)
+ mime-types (~> 3.4.1)
mimetype-fu (~> 0.1.2)
- moneta (~> 1.0.0)
+ moneta (~> 1.5.2)
morphine (~> 0.1.1)
multi_json (~> 1.15.0)
- nokogiri (>= 1.11, < 1.14)
- pony (~> 1.12)
- rack-cache (~> 1.7.0)
+ nokogiri (~> 1.14.2)
+ pony (~> 1.13)
+ rack-cache (~> 1.13.0)
rack-rewrite (~> 1.5.1)
- rack_csrf (~> 2.6.0)
- sanitize (~> 5.2.1)
- sass (~> 3.4.25)
- sprockets (~> 3.7.1)
- uglifier (~> 4.1.3)
+ rack_csrf (~> 2.7.0)
+ sanitize (~> 6.0.1)
GEM
remote: https://rubygems.org/
specs:
RedCloth (4.3.2)
- activesupport (5.2.8.1)
+ activesupport (7.0.4.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
- i18n (>= 0.7, < 2)
- minitest (~> 5.1)
- tzinfo (~> 1.1)
+ i18n (>= 1.6, < 2)
+ minitest (>= 5.1)
+ tzinfo (~> 2.0)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
- attr_extras (5.2.0)
- autoprefixer-rails (8.0.0)
- execjs
+ ast (2.4.2)
+ attr_extras (7.1.0)
bcrypt (3.1.18)
bson (4.15.0)
+ byebug (11.1.3)
chronic (0.10.2)
- chunky_png (1.4.0)
- coffee-script (2.4.1)
- coffee-script-source
- execjs
- coffee-script-source (1.12.2)
+ coderay (1.1.3)
colorize (0.8.1)
- compass (1.0.3)
- chunky_png (~> 1.2)
- compass-core (~> 1.0.2)
- compass-import-once (~> 1.0.5)
- rb-fsevent (>= 0.9.3)
- rb-inotify (>= 0.9)
- sass (>= 3.3.13, < 3.5)
- compass-core (1.0.3)
- multi_json (~> 1.0)
- sass (>= 3.3.0, < 3.5)
- compass-import-once (1.0.5)
- sass (>= 3.2, < 3.5)
- concurrent-ruby (1.1.10)
- coveralls (0.8.23)
- json (>= 1.8, < 3)
- simplecov (~> 0.16.1)
- term-ansicolor (~> 1.3)
- thor (>= 0.19.4, < 2.0)
- tins (~> 1.6)
+ concurrent-ruby (1.2.2)
crass (1.0.6)
date (3.3.3)
diff-lcs (1.5.0)
@@ -79,15 +61,15 @@ GEM
addressable (~> 2.3)
multi_json (~> 1.0)
rack (>= 1.3)
- duktape (2.0.1.1)
+ duktape (2.7.0.0)
execjs (2.8.1)
- ffi (1.15.5)
flamegraph (0.9.5)
- haml (5.2.2)
- temple (>= 0.8.0)
+ haml (6.1.1)
+ temple (>= 0.8.2)
+ thor
tilt
- httparty (0.16.4)
- mime-types (~> 3.0)
+ httparty (0.21.0)
+ mini_mime (>= 1.0.0)
multi_xml (>= 0.5.2)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
@@ -95,34 +77,29 @@ GEM
iso
iso (0.4.0)
i18n
- json (2.6.2)
+ json (2.6.3)
json_spec (1.1.5)
multi_json (~> 1.0)
rspec (>= 2.0, < 4.0)
- kramdown (2.3.2)
+ kramdown (2.4.0)
rexml
liquid (4.0.4)
- locomotivecms_common (0.4.0)
- activesupport (>= 5.1.5, < 6.0)
- attr_extras (~> 5.2.0)
- colorize
- stringex (~> 2.8.2)
- mail (2.8.0.1)
+ mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
- memory_profiler (1.0.0)
- mime-types (3.3.1)
+ memory_profiler (1.0.1)
+ method_source (1.0.0)
+ mime-types (3.4.1)
mime-types-data (~> 3.2015)
- mime-types-data (3.2022.0105)
+ mime-types-data (3.2023.0218.1)
mimetype-fu (0.1.2)
mini_mime (1.1.2)
- mini_portile2 (2.8.1)
minitest (5.17.0)
- moneta (1.0.0)
- mongo (2.13.3)
- bson (>= 4.8.2, < 5.0.0)
+ moneta (1.5.2)
+ mongo (2.18.2)
+ bson (>= 4.14.1, < 5.0.0)
morphine (0.1.1)
multi_json (1.15.0)
multi_xml (0.6.0)
@@ -136,98 +113,108 @@ GEM
net-smtp (0.3.3)
net-protocol
nio4r (2.5.8)
- nokogiri (1.13.10)
- mini_portile2 (~> 2.8.0)
+ nokogiri (1.14.2-x86_64-darwin)
racc (~> 1.4)
- nokogumbo (2.0.5)
- nokogiri (~> 1.8, >= 1.8.4)
origin (2.3.1)
+ parallel (1.22.1)
+ parser (3.2.1.0)
+ ast (~> 2.4.1)
pony (1.13.1)
mail (>= 2.0)
+ pry (0.14.2)
+ coderay (~> 1.1)
+ method_source (~> 1.0)
+ pry-byebug (3.10.1)
+ byebug (~> 11.0)
+ pry (>= 0.13, < 0.15)
public_suffix (5.0.1)
- puma (5.6.5)
+ puma (6.1.0)
nio4r (~> 2.0)
racc (1.6.2)
- rack (2.2.3.1)
- rack-cache (1.7.2)
+ rack (2.2.6.2)
+ rack-cache (1.13.0)
rack (>= 0.4)
- rack-mini-profiler (0.10.7)
+ rack-mini-profiler (3.0.0)
rack (>= 1.2.0)
rack-rewrite (1.5.1)
- rack-test (0.8.3)
- rack (>= 1.0, < 3)
- rack_csrf (2.6.0)
+ rack-test (2.0.2)
+ rack (>= 1.3)
+ rack_csrf (2.7.0)
rack (>= 1.1.0)
+ rainbow (3.1.1)
rake (13.0.6)
- rb-fsevent (0.11.2)
- rb-inotify (0.10.1)
- ffi (~> 1.0)
+ regexp_parser (2.7.0)
rexml (3.2.5)
- rspec (3.7.0)
- rspec-core (~> 3.7.0)
- rspec-expectations (~> 3.7.0)
- rspec-mocks (~> 3.7.0)
- rspec-core (3.7.1)
- rspec-support (~> 3.7.0)
- rspec-expectations (3.7.0)
+ rspec (3.12.0)
+ rspec-core (~> 3.12.0)
+ rspec-expectations (~> 3.12.0)
+ rspec-mocks (~> 3.12.0)
+ rspec-core (3.12.1)
+ rspec-support (~> 3.12.0)
+ rspec-expectations (3.12.2)
diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (~> 3.7.0)
- rspec-mocks (3.7.0)
+ rspec-support (~> 3.12.0)
+ rspec-mocks (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (~> 3.7.0)
- rspec-support (3.7.1)
- sanitize (5.2.3)
+ rspec-support (~> 3.12.0)
+ rspec-support (3.12.0)
+ rubocop (1.46.0)
+ json (~> 2.3)
+ parallel (~> 1.10)
+ parser (>= 3.2.0.0)
+ rainbow (>= 2.2.2, < 4.0)
+ regexp_parser (>= 1.8, < 3.0)
+ rexml (>= 3.2.5, < 4.0)
+ rubocop-ast (>= 1.26.0, < 2.0)
+ ruby-progressbar (~> 1.7)
+ unicode-display_width (>= 2.4.0, < 3.0)
+ rubocop-ast (1.26.0)
+ parser (>= 3.2.1.0)
+ ruby-progressbar (1.11.0)
+ sanitize (6.0.1)
crass (~> 1.0.2)
- nokogiri (>= 1.8.0)
- nokogumbo (~> 2.0)
- sass (3.4.25)
- simplecov (0.16.1)
+ nokogiri (>= 1.12.0)
+ simplecov (0.22.0)
docile (~> 1.1)
- json (>= 1.8, < 3)
- simplecov-html (~> 0.10.0)
- simplecov-html (0.10.2)
- sprockets (3.7.2)
- concurrent-ruby (~> 1.0)
- rack (> 1, < 3)
- stackprof (0.2.21)
+ simplecov-html (~> 0.11)
+ simplecov_json_formatter (~> 0.1)
+ simplecov-html (0.12.3)
+ simplecov_json_formatter (0.1.4)
+ stackprof (0.2.23)
stringex (2.8.5)
- sync (0.5.0)
- temple (0.8.2)
- term-ansicolor (1.7.1)
- tins (~> 1.0)
+ temple (0.10.0)
thor (1.2.1)
- thread_safe (0.3.6)
- tilt (2.0.11)
- timecop (0.9.5)
- timeout (0.3.1)
- tins (1.31.1)
- sync
- tzinfo (1.2.11)
- thread_safe (~> 0.1)
- uglifier (4.1.20)
- execjs (>= 0.3.0, < 3)
+ tilt (2.1.0)
+ timecop (0.9.6)
+ timeout (0.3.2)
+ tzinfo (2.0.6)
+ concurrent-ruby (~> 1.0)
+ unicode-display_width (2.4.2)
PLATFORMS
- ruby
+ x86_64-darwin-22
DEPENDENCIES
- coveralls (~> 0.8.1)
flamegraph
- haml (~> 5.2.0)
+ haml (~> 6.1.1)
i18n-spec (~> 0.6.0)
json_spec (~> 1.1.5)
+ locomotivecms_common!
locomotivecms_steam!
memory_profiler
- mongo (~> 2.13.1)
+ mongo (~> 2.18.2)
origin (~> 2.3.1)
- puma (~> 5.6.4)
- rack (~> 2.2.3.1)
- rack-mini-profiler (~> 0.10.1)
- rack-test (~> 0.8.2)
- rake (~> 13.0.1)
- rspec (~> 3.7.0)
+ pry-byebug (~> 3.10.1)
+ puma (~> 6.1.0)
+ rack (~> 2, < 3)
+ rack-mini-profiler (~> 3.0.0)
+ rack-test (~> 2.0.2)
+ rake (~> 13.0.6)
+ rspec (~> 3.12.0)
+ rubocop
+ simplecov
stackprof
- timecop (~> 0.9.1)
+ timecop (~> 0.9.6)
BUNDLED WITH
- 2.1.4
+ 2.3.25
diff --git a/MIT-LICENSE b/MIT-LICENSE
index 681ec282..6e829705 100644
--- a/MIT-LICENSE
+++ b/MIT-LICENSE
@@ -1,6 +1,6 @@
The MIT License (MIT)
-Copyright (c) 2020 NoCoffee
+Copyright (c) 2023 NoCoffee
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
diff --git a/README.md b/README.md
index 631626df..f2af8965 100644
--- a/README.md
+++ b/README.md
@@ -103,4 +103,4 @@ Note: you do not need to prefix with bundle exec as the docky-ruby image already
## License
-Copyright (c) 2020 NoCoffee. MIT Licensed, see MIT-LICENSE for details.
+Copyright (c) 2023 NoCoffee. MIT Licensed, see MIT-LICENSE for details.
diff --git a/Rakefile b/Rakefile
index 7787046c..b29b3aea 100755
--- a/Rakefile
+++ b/Rakefile
@@ -27,8 +27,8 @@ namespace :mongodb do
`mv #{dump_path} #{db_path}`
end
- `mongo steam_test_1_5_x --eval "db.dropDatabase()" #{host}`
- `mongorestore -d steam_test_1_5_x #{db_path} #{host}`
+ `mongo steam_test_2 --eval "db.dropDatabase()" #{host}`
+ `mongorestore -d steam_test_2 #{db_path} #{host}`
puts "Done! Update now the spec/support/helpers.rb file by setting the new id of the site returned by the mongodb_site_id method"
end
diff --git a/config/locales/nb.yml b/config/locales/nb.yml
index 4ab8d0f1..c5646028 100644
--- a/config/locales/nb.yml
+++ b/config/locales/nb.yml
@@ -139,7 +139,7 @@ nb:
minute: "Minutt"
second: "Sekund"
number:
- format: &number_format
+ format:
precision: 2
separator: ","
delimiter: " "
@@ -149,7 +149,11 @@ nb:
format:
unit: "kr"
format: "%n %u"
- <<: *number_format
+ precision: 2
+ separator: ","
+ delimiter: " "
+ significant: false
+ strip_insignificant_zeros: true
precision:
format:
delimiter: ""
diff --git a/lib/locomotive/steam/decorators/template_decorator.rb b/lib/locomotive/steam/decorators/template_decorator.rb
index 383787ea..024a94c8 100644
--- a/lib/locomotive/steam/decorators/template_decorator.rb
+++ b/lib/locomotive/steam/decorators/template_decorator.rb
@@ -36,7 +36,7 @@ def source_from_template_file
def render_haml(source, template_path)
begin
- Haml::Engine.new(source, escape_attrs: false).render
+ eval Haml::Engine.new(escape_attrs: false).call(source)
rescue Haml::SyntaxError => e
raise Steam::RenderError.new(e, template_path, source)
end
diff --git a/lib/locomotive/steam/initializers.rb b/lib/locomotive/steam/initializers.rb
index 034f4aac..5ed116ef 100644
--- a/lib/locomotive/steam/initializers.rb
+++ b/lib/locomotive/steam/initializers.rb
@@ -1,3 +1,2 @@
-require_relative 'initializers/sprockets.rb'
require_relative 'initializers/i18n.rb'
require_relative 'initializers/dragonfly.rb'
diff --git a/lib/locomotive/steam/initializers/sprockets.rb b/lib/locomotive/steam/initializers/sprockets.rb
deleted file mode 100644
index abb7409d..00000000
--- a/lib/locomotive/steam/initializers/sprockets.rb
+++ /dev/null
@@ -1,69 +0,0 @@
-require 'sprockets'
-require 'sass'
-require 'coffee_script'
-require 'compass'
-require 'uglifier'
-require 'autoprefixer-rails'
-
-require 'execjs'
-
-module Locomotive::Steam
-
- class SprocketsEnvironment < ::Sprockets::Environment
-
- attr_reader :steam_path
-
- def initialize(root, options = {})
- super(root)
-
- @steam_path = root
-
- append_steam_paths
-
- install_minifiers if options[:minify]
-
- install_autoprefixer
-
- context_class.class_eval do
- def asset_path(path, options = {})
- path
- end
- end
- end
-
- private
-
- def append_steam_paths
- %w(fonts stylesheets javascripts).each do |name|
- append_path File.join(@steam_path, name)
- end
-
- Compass::Frameworks::ALL.each { |f| append_path(f.stylesheets_directory) }
- end
-
- def install_minifiers
- # minify javascripts and stylesheets
- self.js_compressor = :uglify
- self.css_compressor = :scss
- end
-
- def install_autoprefixer
- file = File.join(root, '..', 'config', 'autoprefixer.yml')
-
- if File.exists?(file)
- params = (::YAML.load_file(file) || {}).symbolize_keys
- AutoprefixerRails.install(self, params)
-
- Locomotive::Common::Logger.info "[Autoprefixer] detected and installed".light_white
-
- if ENV['EXECJS_RUNTIME'].blank?
- Locomotive::Common::Logger.warn "[Autoprefixer]".light_white + " [Warning] if you notice bad performance, install NodeJS and run \"export EXECJS_RUNTIME=Node\" in your shell"
- end
-
- Locomotive::Common::Logger.info "\n"
- end
- end
-
- end
-
-end
diff --git a/lib/locomotive/steam/middlewares/auth.rb b/lib/locomotive/steam/middlewares/auth.rb
index 23ae42f3..fe23ad10 100644
--- a/lib/locomotive/steam/middlewares/auth.rb
+++ b/lib/locomotive/steam/middlewares/auth.rb
@@ -13,9 +13,9 @@ module Middlewares
#
class Auth < ThreadSafe
- include Concerns::Helpers
- include Concerns::AuthHelpers
- include Concerns::Recaptcha
+ include Locomotive::Steam::Middlewares::Concerns::Helpers
+ include Locomotive::Steam::Middlewares::Concerns::AuthHelpers
+ include Locomotive::Steam::Middlewares::Concerns::Recaptcha
def _call
load_authenticated_entry
diff --git a/lib/locomotive/steam/middlewares/cache.rb b/lib/locomotive/steam/middlewares/cache.rb
index 3361390b..8decf908 100644
--- a/lib/locomotive/steam/middlewares/cache.rb
+++ b/lib/locomotive/steam/middlewares/cache.rb
@@ -39,8 +39,8 @@ def _call
code, headers, _ = response = fetch_cached_response(key)
unless CACHEABLE_RESPONSE_CODES.include?(code.to_i)
- env['steam.cache_control'] = headers['Cache-Control'] = NO_CACHE_CONTROL
- env['steam.cache_vary'] = headers['Vary'] = nil
+ env['steam.cache_control'] = headers['cache-control'] = NO_CACHE_CONTROL
+ env['steam.cache_vary'] = headers['vary'] = nil
end
# we don't want to render twice the page
diff --git a/lib/locomotive/steam/middlewares/concerns/helpers.rb b/lib/locomotive/steam/middlewares/concerns/helpers.rb
index 2a57c9c0..452addb9 100644
--- a/lib/locomotive/steam/middlewares/concerns/helpers.rb
+++ b/lib/locomotive/steam/middlewares/concerns/helpers.rb
@@ -8,10 +8,10 @@ module Helpers
HTML_MIME_TYPES = [nil, 'text/html', 'application/x-www-form-urlencoded', 'multipart/form-data'].freeze
CACHE_HEADERS = {
- 'steam.cache_control' => 'Cache-Control',
- 'steam.cache_vary' => 'Vary',
- 'steam.cache_etag' => 'ETag',
- 'steam.cache_last_modified' => 'Last-Modified'
+ 'steam.cache_control' => 'cache-control',
+ 'steam.cache_vary' => 'vary',
+ 'steam.cache_etag' => 'etag',
+ 'steam.cache_last_modified' => 'last-modified'
}.freeze
def html?
@@ -25,7 +25,7 @@ def json?
end
def render_response(content, code = 200, type = nil)
- base_headers = { 'Content-Type' => type || HTML_CONTENT_TYPE }
+ base_headers = { 'content-type' => type || HTML_CONTENT_TYPE }
CACHE_HEADERS.each do |key, http_name|
base_headers[http_name] = env[key] if env[key]
@@ -42,7 +42,7 @@ def redirect_to(location, type = 301)
self.debug_log "Redirected to #{_location}".blue
- headers = { 'Content-Type' => HTML_CONTENT_TYPE, 'Location' => _location }
+ headers = { 'content-type' => HTML_CONTENT_TYPE, 'location' => _location }
inject_cookies(headers)
@next_response = [type, headers, []]
diff --git a/lib/locomotive/steam/middlewares/dynamic_assets.rb b/lib/locomotive/steam/middlewares/dynamic_assets.rb
deleted file mode 100644
index 4e4250a4..00000000
--- a/lib/locomotive/steam/middlewares/dynamic_assets.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-module Locomotive::Steam
- module Middlewares
-
- class DynamicAssets
-
- REGEXP = /^\/(javascripts|stylesheets)\/(.*)$/o
-
- @@sprocket_environments = {}
-
- attr_reader :app, :assets
-
- def initialize(app, options)
- @app = app
- @assets = self.class.sprocket_environment(options[:root], options)
- end
-
- def call(env)
- if env['PATH_INFO'] =~ REGEXP
- env['PATH_INFO'] = $2
- assets.call(env)
- else
- app.call(env)
- end
- end
-
- def self.sprocket_environment(root, options)
- @@sprocket_environments[root] ||= Locomotive::Steam::SprocketsEnvironment.new(root, options)
- end
-
- end
-
- end
-end
diff --git a/lib/locomotive/steam/middlewares/favicon.rb b/lib/locomotive/steam/middlewares/favicon.rb
index e9b014d0..d45a75dd 100644
--- a/lib/locomotive/steam/middlewares/favicon.rb
+++ b/lib/locomotive/steam/middlewares/favicon.rb
@@ -10,7 +10,7 @@ class Favicon
def call(env)
if env['PATH_INFO'] == '/favicon.ico'
# Default and empty Favicon rendered
- [200, { 'Content-Type' => 'image/vnd.microsoft.icon' }, ['']]
+ [200, { 'content-type' => 'image/vnd.microsoft.icon' }, ['']]
else
app.call(env)
end
diff --git a/lib/locomotive/steam/middlewares/sitemap.rb b/lib/locomotive/steam/middlewares/sitemap.rb
index d69b364b..3739b5ff 100644
--- a/lib/locomotive/steam/middlewares/sitemap.rb
+++ b/lib/locomotive/steam/middlewares/sitemap.rb
@@ -89,7 +89,7 @@ def entry_to_xml(entry)
<<-XML
#{base_url}#{entry[:loc]}
- #{entry[:date].to_s('%Y-%m-%d')}
+ #{entry[:date].to_fs('%Y-%m-%d')}
#{entry_links_to_xml(entry[:links])}
XML
diff --git a/lib/locomotive/steam/models/concerns/validation.rb b/lib/locomotive/steam/models/concerns/validation.rb
index 8c09d727..49ba668b 100644
--- a/lib/locomotive/steam/models/concerns/validation.rb
+++ b/lib/locomotive/steam/models/concerns/validation.rb
@@ -41,7 +41,7 @@ def add(attribute, message, options = {})
end
def generate_message(message, options = {})
- I18n.t(message, {
+ I18n.t(message, **{
scope: 'errors.messages',
default: message
}.merge(options))
diff --git a/lib/locomotive/steam/server.rb b/lib/locomotive/steam/server.rb
index cafc8bcb..96dd36b2 100644
--- a/lib/locomotive/steam/server.rb
+++ b/lib/locomotive/steam/server.rb
@@ -31,11 +31,11 @@ def default_middlewares
if configuration.serve_assets
use ::Rack::Static, {
root: configuration.asset_path,
- urls: ['/images', '/fonts', '/samples', '/sites', '/misc', '/others', '/pdfs', '/media']
- }
- use Middlewares::DynamicAssets, {
- root: configuration.asset_path,
- minify: configuration.minify_assets
+ urls: [
+ '/stylesheets', '/javascripts',
+ '/images', '/fonts', '/samples',
+ '/sites', '/misc', '/others',
+ '/pdfs', '/media']
}
end
diff --git a/lib/locomotive/steam/version.rb b/lib/locomotive/steam/version.rb
index a53eb268..534dafb3 100644
--- a/lib/locomotive/steam/version.rb
+++ b/lib/locomotive/steam/version.rb
@@ -3,6 +3,6 @@
# 1.0.0.alpha < 1.0.0.alpha1 < 1.0.0.beta < 1.0.0.beta2 < 1.0.0.beta11 < 1.0.0.rc1 < 1.0.0
module Locomotive
module Steam
- VERSION = '1.6.1'
+ VERSION = '2.0.0'
end
end
diff --git a/locomotivecms_steam.gemspec b/locomotivecms_steam.gemspec
index 6fe8e294..3ac2f753 100644
--- a/locomotivecms_steam.gemspec
+++ b/locomotivecms_steam.gemspec
@@ -15,41 +15,35 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']
- spec.add_development_dependency 'rake', '~> 13.0.1'
+ spec.add_development_dependency 'rake', '~> 13.0.6'
- spec.add_development_dependency 'mongo', '~> 2.13.1'
+ spec.add_development_dependency 'mongo', '~> 2.18.2'
spec.add_development_dependency 'origin', '~> 2.3.1'
- spec.add_dependency 'nokogiri', '>= 1.11', '< 1.14'
- spec.add_dependency 'sanitize', '~> 5.2.1'
+ spec.add_dependency 'nokogiri', '~> 1.14.2'
+ spec.add_dependency 'sanitize', '~> 6.0.1'
spec.add_dependency 'morphine', '~> 0.1.1'
- spec.add_dependency 'httparty', '~> 0.16.0'
+ spec.add_dependency 'httparty', '~> 0.21.0'
spec.add_dependency 'chronic', '~> 0.10.2'
- spec.add_dependency 'bcrypt', '~> 3.1.11'
+ spec.add_dependency 'bcrypt', '~> 3.1.18'
spec.add_dependency 'multi_json', '~> 1.15.0'
spec.add_dependency 'liquid', '~> 4.0.4'
spec.add_dependency 'rack-rewrite', '~> 1.5.1'
- spec.add_dependency 'rack-cache', '~> 1.7.0'
- spec.add_dependency 'rack_csrf', '~> 2.6.0'
- spec.add_dependency 'dragonfly', '>= 1.2', '< 1.5'
- spec.add_dependency 'moneta', '~> 1.0.0'
-
- spec.add_dependency 'sprockets', '~> 3.7.1'
- spec.add_dependency 'sass', '~> 3.4.25'
- spec.add_dependency 'uglifier', '~> 4.1.3'
- spec.add_dependency 'coffee-script', '~> 2.4.1'
- spec.add_dependency 'compass', '~> 1.0.3'
- spec.add_dependency 'autoprefixer-rails', '~> 8.0.0'
-
- spec.add_dependency 'kramdown', '~> 2.3.0'
+ spec.add_dependency 'rack-cache', '~> 1.13.0'
+ spec.add_dependency 'rack_csrf', '~> 2.7.0'
+ spec.add_dependency 'dragonfly', '~> 1.4.0'
+ spec.add_dependency 'moneta', '~> 1.5.2'
+
+ spec.add_dependency 'kramdown', '~> 2.4.0'
spec.add_dependency 'RedCloth', '~> 4.3.2'
spec.add_dependency 'mimetype-fu', '~> 0.1.2'
- spec.add_dependency 'mime-types', '~> 3.3.0'
- spec.add_dependency 'duktape', '~> 2.0.1.1'
- spec.add_dependency 'pony', '~> 1.12'
+ spec.add_dependency 'mime-types', '~> 3.4.1'
+ spec.add_dependency 'duktape', '~> 2.7.0.0'
+ spec.add_dependency 'execjs', '~> 2.8.1'
+ spec.add_dependency 'pony', '~> 1.13'
- spec.add_dependency 'locomotivecms_common', '~> 0.4.0'
+ spec.add_dependency 'locomotivecms_common', '>= 1'
- spec.required_ruby_version = ['>= 2.5', '< 3']
+ spec.required_ruby_version = ['>= 3']
end
diff --git a/script/ci/before_build.sh b/script/ci/before_build.sh
index 313a4c26..c574f275 100755
--- a/script/ci/before_build.sh
+++ b/script/ci/before_build.sh
@@ -2,4 +2,4 @@
echo 'America/Chicago' | sudo tee /etc/timezone
sudo dpkg-reconfigure --frontend noninteractive tzdata
date
-mongo --version
+mongosh --version
diff --git a/spec/fixtures/default/public/javascripts/application.js b/spec/fixtures/default/public/javascripts/application.js
new file mode 100644
index 00000000..a40177f7
--- /dev/null
+++ b/spec/fixtures/default/public/javascripts/application.js
@@ -0,0 +1 @@
+window.on('load', () => { alert('hello world') })
\ No newline at end of file
diff --git a/spec/fixtures/default/public/javascripts/application.js.coffee b/spec/fixtures/default/public/javascripts/application.js.coffee
deleted file mode 100644
index bf73e703..00000000
--- a/spec/fixtures/default/public/javascripts/application.js.coffee
+++ /dev/null
@@ -1,2 +0,0 @@
-$(document).ready ->
- alert 'hello world'
\ No newline at end of file
diff --git a/spec/fixtures/default/public/stylesheets/other/extra.css.less b/spec/fixtures/default/public/stylesheets/other/extra.css.less
deleted file mode 100644
index a076a9d0..00000000
--- a/spec/fixtures/default/public/stylesheets/other/extra.css.less
+++ /dev/null
@@ -1,8 +0,0 @@
-@color: #4D926F;
-
-#header {
- color: @color;
-}
-h2 {
- color: @color;
-}
\ No newline at end of file
diff --git a/spec/fixtures/default/public/stylesheets/other/style.css.scss b/spec/fixtures/default/public/stylesheets/other/style.css.scss
deleted file mode 100644
index 9a210d3f..00000000
--- a/spec/fixtures/default/public/stylesheets/other/style.css.scss
+++ /dev/null
@@ -1,13 +0,0 @@
-@import "compass/reset/utilities";
-
-html {
- @include global-reset;
-}
-
-body {
- background: red;
-
- h1 {
- color: green;
- }
-}
\ No newline at end of file
diff --git a/spec/integration/adapters/mongodb_spec.rb b/spec/integration/adapters/mongodb_spec.rb
index 4f6f5e32..9e4ffa65 100644
--- a/spec/integration/adapters/mongodb_spec.rb
+++ b/spec/integration/adapters/mongodb_spec.rb
@@ -43,7 +43,7 @@
end
def current_connections
- `mongo --eval "db.serverStatus().connections.current"`.split("\n").last.to_i
+ `mongosh --eval "db.serverStatus().connections.current"`.split("\n").last.to_i
end
end
diff --git a/spec/integration/liquid/filters/translate_spec.rb b/spec/integration/liquid/filters/translate_spec.rb
index 8dd676d4..e2959fd9 100644
--- a/spec/integration/liquid/filters/translate_spec.rb
+++ b/spec/integration/liquid/filters/translate_spec.rb
@@ -37,21 +37,21 @@
describe 'legacy syntax' do
let(:source) { "{{ 'welcome_message' | translate: 'fr', 'locomotive.default' }}" }
- it { expect(translator).to receive(:translate).with('welcome_message', 'locale' => 'fr', 'scope' => 'locomotive.default'); subject }
+ it { expect(translator).to receive(:translate).with('welcome_message', { 'locale' => 'fr', 'scope' => 'locomotive.default' }); subject }
end
describe 'new syntax' do
let(:source) { "{{ 'welcome_message' | translate: locale: 'fr', scope: 'locomotive.default' }}" }
- it { expect(translator).to receive(:translate).with('welcome_message', 'locale' => 'fr', 'scope' => 'locomotive.default'); subject }
+ it { expect(translator).to receive(:translate).with('welcome_message', { 'locale' => 'fr', 'scope' => 'locomotive.default' }); subject }
end
describe 'shortcut alias' do
let(:source) { "{{ 'welcome_message' | t: 'fr', 'locomotive.default' }}" }
- it { expect(translator).to receive(:translate).with('welcome_message', 'locale' => 'fr', 'scope' => 'locomotive.default'); subject }
+ it { expect(translator).to receive(:translate).with('welcome_message', { 'locale' => 'fr', 'scope' => 'locomotive.default' }); subject }
end
diff --git a/spec/integration/repositories/theme_asset_repository_spec.rb b/spec/integration/repositories/theme_asset_repository_spec.rb
index 933dc903..fa5ab2f6 100644
--- a/spec/integration/repositories/theme_asset_repository_spec.rb
+++ b/spec/integration/repositories/theme_asset_repository_spec.rb
@@ -38,7 +38,7 @@
describe '#all' do
subject { repository.all }
- it { expect(subject.size).to eq 16 }
+ it { expect(subject.size).to eq 14 }
end
describe '#url_for' do
diff --git a/spec/integration/server/assets_spec.rb b/spec/integration/server/assets_spec.rb
index 502e4b79..7a2d783c 100644
--- a/spec/integration/server/assets_spec.rb
+++ b/spec/integration/server/assets_spec.rb
@@ -24,35 +24,18 @@ def app
it { is_expected.to include("") }
it { is_expected.to include(' ') }
- end
-
- describe 'static assets' do
-
- it 'renders an image' do
- get '/images/nav_on.png'
- expect(last_response.status).to eq(200)
- end
-
- end
-
- describe 'dynamic assets (SCSS + Coffeescript)' do
-
it 'renders a stylesheet' do
get '/stylesheets/application.css'
expect(last_response.status).to eq(200)
- expect(last_response.body).to include('body{background:#f0eee3')
+ expect(last_response.body).to include('body { background: #f0eee3')
end
+ end
- it 'renders a SCSS asset' do
- get '/stylesheets/other/style.css'
- expect(last_response.status).to eq(200)
- expect(last_response.body).to include('body{background:red}')
- end
+ describe 'static assets' do
- it 'renders a Coffeescript asset' do
- get '/javascripts/application.js'
+ it 'renders an image' do
+ get '/images/nav_on.png'
expect(last_response.status).to eq(200)
- expect(last_response.body).to include('alert("hello world")')
end
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 4711cb11..25d9f895 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,11 +1,4 @@
-# require 'simplecov'
-# require 'codeclimate-test-reporter'
-# require 'coveralls'
-# require 'simplecov'
-# require 'coveralls'
-
require 'simplecov'
-require 'coveralls'
SimpleCov.start do
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index cdff3f74..a2e58590 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -4,7 +4,7 @@ module Spec
module Helpers
def mongodb_database
- 'steam_test_1_5_x'
+ 'steam_test_2'
end
def mongodb_site_id
diff --git a/spec/unit/initializers/sprockets_spec.rb b/spec/unit/initializers/sprockets_spec.rb
deleted file mode 100644
index fbfd9ea6..00000000
--- a/spec/unit/initializers/sprockets_spec.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-require 'spec_helper'
-
-require_relative '../../../lib/locomotive/steam/initializers/sprockets'
-
-describe Locomotive::Steam::SprocketsEnvironment do
-
- let(:root) { '.' }
- let(:options) { { minify: true } }
- let(:env) { described_class.new(root, options) }
-
- describe '#install_autoprefixer' do
-
- let(:options) { { minify: false } }
-
- subject { env }
-
- context "config/autoprefixer.yml doesn't exist" do
-
- before { allow(File).to receive(:exists?).and_return false }
-
- it { expect(AutoprefixerRails).not_to receive(:install); subject }
-
- end
-
- context "config/autoprefixer.yml exists" do
-
- before {
- allow(File).to receive(:exists?).and_return(true)
- allow(YAML).to receive(:load_file).and_return({})
- }
-
- it { expect(AutoprefixerRails).to receive(:install).and_return(true); subject }
-
- it 'warns developers if they notice bad performance when using autoprefixer' do
- curent_execjs_runtime = ENV['EXECJS_RUNTIME']
- ENV['EXECJS_RUNTIME'] = 'NodeJS'
- expect(Locomotive::Common::Logger).not_to receive(:warn)
- expect(AutoprefixerRails).to receive(:install).and_return(true)
- subject
- ENV['EXECJS_RUNTIME'] = curent_execjs_runtime
- end
-
- end
-
- end
-
-end
diff --git a/spec/unit/liquid/drops/content_entry_collection_spec.rb b/spec/unit/liquid/drops/content_entry_collection_spec.rb
index 7fb1c097..bd814059 100644
--- a/spec/unit/liquid/drops/content_entry_collection_spec.rb
+++ b/spec/unit/liquid/drops/content_entry_collection_spec.rb
@@ -42,14 +42,14 @@
describe '#first' do
before do
- expect(services.repositories.content_entry).to receive(:all).with('visible' => true).and_return(['a', 'b'])
+ expect(services.repositories.content_entry).to receive(:all).with({ 'visible' => true }).and_return(['a', 'b'])
end
it { expect(drop.first).to eq('a') }
end
describe '#count' do
before do
- expect(services.repositories.content_entry).to receive(:count).with('visible' => true).and_return(2)
+ expect(services.repositories.content_entry).to receive(:count).with({ 'visible' => true }).and_return(2)
end
it { expect(drop.count).to eq 2 }
end
@@ -57,7 +57,7 @@
describe 'only applied to the first content type' do
it 'sets the content type in the context' do
- expect(services.repositories.content_entry).to receive(:all).with('visible' => true).and_return(['a', 'b'])
+ expect(services.repositories.content_entry).to receive(:all).with({ 'visible' => true }).and_return(['a', 'b'])
expect(context['with_scope_content_type']).to eq nil
drop.first
expect(context['with_scope_content_type']).to eq 'articles'
diff --git a/spec/unit/liquid/tags/consume_spec.rb b/spec/unit/liquid/tags/consume_spec.rb
index 09861ab7..4ae54da9 100644
--- a/spec/unit/liquid/tags/consume_spec.rb
+++ b/spec/unit/liquid/tags/consume_spec.rb
@@ -111,7 +111,7 @@
let(:source) { %{{% consume blog from "#{url}" timeout: 5.0 %}{{ blog.title }}{% endconsume %}} }
it 'should pass the timeout option to httparty' do
- expect(services.external_api).to receive(:consume).with(url, timeout: 5.0).and_return(response)
+ expect(services.external_api).to receive(:consume).with(url, { timeout: 5.0 }).and_return(response)
subject
end
diff --git a/spec/unit/middlewares/auth_spec.rb b/spec/unit/middlewares/auth_spec.rb
index e3d0c064..742d2c1c 100644
--- a/spec/unit/middlewares/auth_spec.rb
+++ b/spec/unit/middlewares/auth_spec.rb
@@ -3,6 +3,7 @@
require_relative '../../../lib/locomotive/steam/middlewares/thread_safe'
require_relative '../../../lib/locomotive/steam/middlewares/concerns/helpers'
require_relative '../../../lib/locomotive/steam/middlewares/concerns/recaptcha'
+require_relative '../../../lib/locomotive/steam/middlewares/concerns/auth_helpers'
require_relative '../../../lib/locomotive/steam/middlewares/auth'
describe Locomotive::Steam::Middlewares::Auth::AuthOptions do
diff --git a/spec/unit/middlewares/cache_spec.rb b/spec/unit/middlewares/cache_spec.rb
index da9272e2..b9a6815a 100644
--- a/spec/unit/middlewares/cache_spec.rb
+++ b/spec/unit/middlewares/cache_spec.rb
@@ -55,11 +55,11 @@
let(:response) { nil }
- before { expect(cache).to receive(:read).with('4fb84e6d3037dcd54979c3461c5a5ffd').and_return(response) }
+ before { expect(cache).to receive(:read).with('90e7ab47507fd0ba61d272b14c99096e').and_return(response) }
context 'the cache is empty' do
- before { expect(cache).to receive(:write).with('4fb84e6d3037dcd54979c3461c5a5ffd', Marshal.dump([200, {}, ["Hello world!"]])) }
+ before { expect(cache).to receive(:write).with('90e7ab47507fd0ba61d272b14c99096e', Marshal.dump([200, {}, ["Hello world!"]])) }
it 'tells the CDN to cache the page and also cache it internally' do
is_expected.to eq ['max-age=0, s-maxage=3600, public, must-revalidate', 'Accept-Language']
@@ -69,7 +69,7 @@
subject { send_request[:env]['steam.cache_etag'] }
- it { is_expected.to eq '4fb84e6d3037dcd54979c3461c5a5ffd' }
+ it { is_expected.to eq '90e7ab47507fd0ba61d272b14c99096e' }
end
@@ -104,11 +104,11 @@
context 'based on the ETag' do
- let(:etag) { '4fb84e6d3037dcd54979c3461c5a5ffd' }
+ let(:etag) { '90e7ab47507fd0ba61d272b14c99096e' }
it 'returns a 304 (Not modified) without no cache headers' do
expect(subject.first).to eq 304
- expect(subject.last['Cache-Control']).to eq nil
+ expect(subject.last['cache-control']).to eq nil
end
end
@@ -119,7 +119,7 @@
it 'returns a 304 (Not modified) without no cache headers' do
expect(subject.first).to eq 304
- expect(subject.last['Cache-Control']).to eq nil
+ expect(subject.last['cache-control']).to eq nil
end
end
diff --git a/spec/unit/middlewares/dynamic_assets_spec.rb b/spec/unit/middlewares/dynamic_assets_spec.rb
deleted file mode 100644
index 78683d07..00000000
--- a/spec/unit/middlewares/dynamic_assets_spec.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-require 'spec_helper'
-
-require_relative '../../../lib/locomotive/steam/middlewares/dynamic_assets'
-
-describe Locomotive::Steam::Middlewares::DynamicAssets do
-
- let(:app) { ->(env) { [200, env, 'app'] }}
- let(:options) { { root: File.dirname(__FILE__), minify: true } }
- let(:middleware) { described_class.new(app, options) }
-
- describe '#call' do
-
- let(:env) { { 'PATH_INFO' => '/stylesheets/application.css' } }
- subject { middleware.call(env) }
-
- it 'calls sprockets to process the asset' do
- expect(middleware.assets).to receive(:call).with(env).and_return(true)
- is_expected.to eq true
- end
-
- context 'not an asset' do
-
- let(:env) { { 'PATH_INFO' => '/index' } }
-
- it 'bypasses sprockets' do
- expect(middleware.assets).not_to receive(:call)
- is_expected.not_to eq nil
- end
-
- end
-
- end
-
-end
diff --git a/spec/unit/middlewares/encoded_link_redirection_spec.rb b/spec/unit/middlewares/encoded_link_redirection_spec.rb
index 0a8c5bb5..452ef24c 100644
--- a/spec/unit/middlewares/encoded_link_redirection_spec.rb
+++ b/spec/unit/middlewares/encoded_link_redirection_spec.rb
@@ -22,7 +22,7 @@
env['steam.services'] = services
env['locomotive.path'] = locomotive_path
code, env = middleware.call(env)
- [code, env['Location']]
+ [code, env['location']]
end
describe 'no redirections' do
diff --git a/spec/unit/middlewares/helpers_spec.rb b/spec/unit/middlewares/helpers_spec.rb
index 545584ea..891bd5c9 100644
--- a/spec/unit/middlewares/helpers_spec.rb
+++ b/spec/unit/middlewares/helpers_spec.rb
@@ -38,7 +38,7 @@
describe '#redirect_to' do
- subject { instance.redirect_to(location)[1]['Location'] }
+ subject { instance.redirect_to(location)[1]['location'] }
context 'mounted_on is not blank' do
diff --git a/spec/unit/middlewares/impersonated_entry_spec.rb b/spec/unit/middlewares/impersonated_entry_spec.rb
index 16007258..9362fbb9 100644
--- a/spec/unit/middlewares/impersonated_entry_spec.rb
+++ b/spec/unit/middlewares/impersonated_entry_spec.rb
@@ -54,7 +54,7 @@
subject do
code, env, body = call
- [code, env['steam.impersonating_authenticated_entry'], env['Location']]
+ [code, env['steam.impersonating_authenticated_entry'], env['location']]
end
before do
diff --git a/spec/unit/middlewares/locale_redirection_spec.rb b/spec/unit/middlewares/locale_redirection_spec.rb
index 704a15b8..e3bc21c3 100644
--- a/spec/unit/middlewares/locale_redirection_spec.rb
+++ b/spec/unit/middlewares/locale_redirection_spec.rb
@@ -20,7 +20,7 @@
env['steam.request'] = Rack::Request.new(env)
env['steam.path'] = env['steam.request'].path_info.gsub(/\A#{mounted_on}/, '').gsub(/\A\/#{locale}/, '')
code, env = middleware.call(env)
- [code, env['Location']]
+ [code, env['location']]
end
describe 'prefix_default_locale is false' do
diff --git a/spec/unit/middlewares/redirection_spec.rb b/spec/unit/middlewares/redirection_spec.rb
index cb54905b..fec4cbfc 100644
--- a/spec/unit/middlewares/redirection_spec.rb
+++ b/spec/unit/middlewares/redirection_spec.rb
@@ -17,7 +17,7 @@
env['steam.request'] = Rack::Request.new(env)
env['locomotive.path'] = locomotive_path
code, env = middleware.call(env)
- [code, env['Location']]
+ [code, env['location']]
end
describe 'no redirection exception raised' do
diff --git a/spec/unit/middlewares/section_spec.rb b/spec/unit/middlewares/section_spec.rb
index 0ce43677..bdfd597d 100644
--- a/spec/unit/middlewares/section_spec.rb
+++ b/spec/unit/middlewares/section_spec.rb
@@ -46,7 +46,7 @@
it 'renders the HTML code related to the section' do
is_expected.to eq [
200,
- { "Content-Type" => "text/html" },
+ { "content-type" => "text/html" },
[%(
)]
]
end
@@ -62,7 +62,7 @@
it 'renders the HTML code related to the section' do
is_expected.to eq [
200,
- { "Content-Type" => "text/html" },
+ { "content-type" => "text/html" },
[%( Here some modified HTML
)]
]
end
diff --git a/spec/unit/middlewares/site_spec.rb b/spec/unit/middlewares/site_spec.rb
index 7b4b5f24..2966a106 100644
--- a/spec/unit/middlewares/site_spec.rb
+++ b/spec/unit/middlewares/site_spec.rb
@@ -23,7 +23,7 @@
env['steam.is_default_host'] = is_default_host
env['steam.live_editing'] = live_editing
code, env = middleware.call(env)
- [code, env['Location']]
+ [code, env['location']]
end
describe 'no site' do
diff --git a/spec/unit/middlewares/sitemap_spec.rb b/spec/unit/middlewares/sitemap_spec.rb
index c218785f..b72236e0 100644
--- a/spec/unit/middlewares/sitemap_spec.rb
+++ b/spec/unit/middlewares/sitemap_spec.rb
@@ -26,7 +26,7 @@
describe 'no pages' do
it 'renders a blank sitemap' do
- is_expected.to eq [200, { "Content-Type"=>"application/xml" }, ["\n\n\n \n"]]
+ is_expected.to eq [200, { "content-type"=>"application/xml" }, ["\n\n\n \n"]]
end
end
@@ -36,7 +36,7 @@
let(:pages) { [instance_double('Page', index?: false, not_found?: false, layout?: true)] }
it 'renders a blank sitemap' do
- is_expected.to eq [200, { "Content-Type"=>"application/xml" }, ["\n\n\n \n"]]
+ is_expected.to eq [200, { "content-type"=>"application/xml" }, ["\n\n\n \n"]]
end
end
diff --git a/spec/unit/middlewares/url_redirection_spec.rb b/spec/unit/middlewares/url_redirection_spec.rb
index 88f268ef..43d8adb9 100644
--- a/spec/unit/middlewares/url_redirection_spec.rb
+++ b/spec/unit/middlewares/url_redirection_spec.rb
@@ -18,7 +18,7 @@
env['steam.request'] = Rack::Request.new(env)
env['locomotive.path'] = locomotive_path
code, env = middleware.call(env)
- [code, env['Location']]
+ [code, env['location']]
end
describe 'no redirections' do
diff --git a/spec/unit/services/email_service_spec.rb b/spec/unit/services/email_service_spec.rb
index d0746fa4..ffcdd056 100644
--- a/spec/unit/services/email_service_spec.rb
+++ b/spec/unit/services/email_service_spec.rb
@@ -21,7 +21,7 @@
subject { service.send_email(options, context) }
it 'sends the email over Pony' do
- expect(Pony).to receive(:mail).with(
+ expect(Pony).to receive(:mail).with({
to: 'john@doe.net',
from: 'me@locomotivecms.com',
subject: 'Hello world',
@@ -32,7 +32,7 @@
user_name: 'user',
password: 'password'
}
- )
+ })
subject
end
@@ -61,7 +61,7 @@
let(:options) { { to: 'john@doe.net', from: 'me@locomotivecms.com', subject: 'Hello world', page_handle: 'notification-email', smtp: smtp_options, html: true } }
it 'sends the email over Pony' do
- expect(Pony).to receive(:mail).with(
+ expect(Pony).to receive(:mail).with({
to: 'john@doe.net',
from: 'me@locomotivecms.com',
subject: 'Hello world',
@@ -72,7 +72,7 @@
user_name: 'user',
password: 'password'
}
- )
+ })
subject
end
@@ -100,7 +100,7 @@
end
it 'sends the email over Pony' do
- expect(Pony).to receive(:mail).with(
+ expect(Pony).to receive(:mail).with({
to: 'john@doe.net',
from: 'me@locomotivecms.com',
subject: 'Hello world',
@@ -112,7 +112,7 @@
user_name: 'user',
password: 'password'
}
- )
+ })
subject
end
@@ -124,7 +124,7 @@
it 'sends the email over Pony' do
expect(Net::HTTP).to receive(:get).with(URI('http://acme.org/bar.txt')).and_return('Bar')
- expect(Pony).to receive(:mail).with(
+ expect(Pony).to receive(:mail).with({
to: 'john@doe.net',
from: 'me@locomotivecms.com',
subject: 'Hello world',
@@ -136,7 +136,7 @@
user_name: 'user',
password: 'password'
}
- )
+ })
subject
end
@@ -144,7 +144,7 @@
it "doesn't send the email" do
expect(Net::HTTP).to receive(:get).with(URI('http://acme.org/bar.txt')).and_raise('URL not responding')
- expect(Pony).to receive(:mail).with(
+ expect(Pony).to receive(:mail).with({
to: 'john@doe.net',
from: 'me@locomotivecms.com',
subject: 'Hello world',
@@ -156,7 +156,7 @@
user_name: 'user',
password: 'password'
}
- )
+ })
subject
end
@@ -169,7 +169,7 @@
let(:attachments) { { 'bar.txt' => 'Bar' } }
it 'sends the email over Pony' do
- expect(Pony).to receive(:mail).with(
+ expect(Pony).to receive(:mail).with({
to: 'john@doe.net',
from: 'me@locomotivecms.com',
subject: 'Hello world',
@@ -181,7 +181,7 @@
user_name: 'user',
password: 'password'
}
- )
+ })
subject
end
@@ -190,9 +190,4 @@
end
end
-
- def default_options
-
- end
-
end