agilibox 1.8.0 → 1.9.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 +19 -0
- data/Rakefile +4 -0
- data/app/controllers/concerns/agilibox/back_url_concern.rb +11 -3
- data/app/helpers/agilibox/routes_helper.rb +5 -1
- data/app/helpers/agilibox/sorting_helper.rb +1 -1
- data/config/cucumber.yml +4 -3
- data/lib/agilibox/active_model_custom_error_messages.rb +2 -2
- data/lib/agilibox/active_model_type_cast.rb +4 -4
- data/lib/agilibox/cucumber_config.rb +1 -11
- data/lib/agilibox/cucumber_helpers/capybara.rb +1 -1
- data/lib/agilibox/cucumber_helpers/zonebie.rb +4 -1
- data/lib/agilibox/engine.rb +4 -0
- data/lib/agilibox/errors_middleware.rb +47 -0
- data/lib/agilibox/form_back_url.rb +1 -1
- data/lib/agilibox/version.rb +1 -1
- metadata +3 -4
- data/lib/agilibox/cucumber_helpers/fix_referrer.rb +0 -9
- data/lib/agilibox/cucumber_helpers/poltergeist.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70cf28216c3454232717705c0f856cbbcc9c7afe64a64940031e37c244e087ca
|
4
|
+
data.tar.gz: 4b69d768141760b3aa70b2bbecad849a359fe6e5c4e3d312971f5f648a7187b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b895a6a5d99124b9a8fa3e7185e949b426bbe90c134441dbf1ee7e5329f8b10609ab40a3420f2067941158e9821c08a1ea1145fe8394506f7306bd309946c8ed
|
7
|
+
data.tar.gz: fc304783878fcfe3bfaad9d452d299ace65059046244cbe5ec0aa526107b23fe957869d26c1c39dbf306bcc755d8a1d71cea297dd42123d522b8b15b4a56bca9
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,25 @@
|
|
2
2
|
|
3
3
|
## Next version
|
4
4
|
|
5
|
+
## 1.9.5
|
6
|
+
- Fix warnings on Rails 6
|
7
|
+
|
8
|
+
## 1.9.4
|
9
|
+
- Cucumber : disable Zonebie
|
10
|
+
|
11
|
+
## 1.9.3
|
12
|
+
- No change
|
13
|
+
|
14
|
+
## 1.9.2
|
15
|
+
- ErrorsMiddleware improvements
|
16
|
+
|
17
|
+
## 1.9.1
|
18
|
+
- Add ErrorsMiddleware
|
19
|
+
|
20
|
+
## 1.9.0
|
21
|
+
- Remove phantomjs/poltergeist support
|
22
|
+
- BackUrlConcern transforms absolute URLs to relative
|
23
|
+
|
5
24
|
## 1.8.0
|
6
25
|
- SMS improvements
|
7
26
|
- Replace TapMethods by Tapenade gem
|
data/Rakefile
CHANGED
@@ -7,12 +7,20 @@ module Agilibox::BackUrlConcern
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def back_url
|
10
|
-
[
|
10
|
+
url = [
|
11
11
|
params[:back_url],
|
12
12
|
request.referer,
|
13
13
|
default_back_url,
|
14
|
-
main_app.root_path,
|
14
|
+
main_app.try(:root_path),
|
15
15
|
"/",
|
16
|
-
].
|
16
|
+
].find(&:present?)
|
17
|
+
|
18
|
+
uri = URI.parse(url)
|
19
|
+
uri.host = nil
|
20
|
+
uri.port = nil
|
21
|
+
uri.scheme = nil
|
22
|
+
uri.user = nil
|
23
|
+
uri.password = nil
|
24
|
+
uri.to_s
|
17
25
|
end
|
18
26
|
end
|
@@ -1,6 +1,10 @@
|
|
1
1
|
module Agilibox::RoutesHelper
|
2
2
|
def engine_polymorphic_path(obj, opts = {})
|
3
|
-
|
3
|
+
if Rails::VERSION::STRING >= "6.0.0"
|
4
|
+
engine = obj.class.module_parents[-2]
|
5
|
+
else
|
6
|
+
engine = obj.class.parents[-2]
|
7
|
+
end
|
4
8
|
|
5
9
|
if engine.nil?
|
6
10
|
routes = main_app
|
data/config/cucumber.yml
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
<%
|
2
2
|
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
|
3
|
-
|
4
|
-
|
3
|
+
rerun = rerun.strip.gsub /\s/, ' '
|
4
|
+
rerun_opts = rerun.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
|
5
|
+
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags 'not @wip'"
|
5
6
|
%>
|
6
7
|
default: <%= std_opts %> features
|
7
8
|
wip: --tags @wip:3 --wip features
|
8
|
-
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags
|
9
|
+
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags 'not @wip'
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Agilibox::ActiveModelCustomErrorMessages
|
2
2
|
def full_message(attribute, message)
|
3
|
-
return message[1
|
3
|
+
return message[1..] if message[0] == "^"
|
4
4
|
super(attribute, message)
|
5
5
|
end
|
6
6
|
end
|
7
7
|
|
8
|
-
ActiveModel::Errors.
|
8
|
+
ActiveModel::Errors.prepend(Agilibox::ActiveModelCustomErrorMessages)
|
@@ -46,7 +46,7 @@ module Agilibox::ActiveModelTypeCast
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
ActiveModel::Type::Date.
|
50
|
-
ActiveModel::Type::Boolean.
|
51
|
-
ActiveModel::Type::Decimal.
|
52
|
-
ActiveModel::Type::Float.
|
49
|
+
ActiveModel::Type::Date.prepend(Agilibox::ActiveModelTypeCast::Date)
|
50
|
+
ActiveModel::Type::Boolean.prepend(Agilibox::ActiveModelTypeCast::Boolean)
|
51
|
+
ActiveModel::Type::Decimal.prepend(Agilibox::ActiveModelTypeCast::Decimal)
|
52
|
+
ActiveModel::Type::Float.prepend(Agilibox::ActiveModelTypeCast::Decimal)
|
@@ -1,12 +1,6 @@
|
|
1
1
|
class << Agilibox::CucumberConfig = Class.new
|
2
2
|
undef new
|
3
3
|
|
4
|
-
attr_writer :phantomjs_version
|
5
|
-
|
6
|
-
def phantomjs_version
|
7
|
-
@phantomjs_version ||= "2.1.1"
|
8
|
-
end
|
9
|
-
|
10
4
|
attr_writer :cuprite_timeout
|
11
5
|
|
12
6
|
def cuprite_timeout
|
@@ -37,14 +31,10 @@ class << Agilibox::CucumberConfig = Class.new
|
|
37
31
|
|
38
32
|
def require_all_helpers!
|
39
33
|
files = Dir.glob Agilibox::Engine.root.join("lib", "agilibox", "cucumber_helpers", "*.rb")
|
40
|
-
files.delete_if { |f| f.match?(/
|
34
|
+
files.delete_if { |f| f.match?(/chrome|cuprite|_steps/) }
|
41
35
|
files.each { |file| require file }
|
42
36
|
end
|
43
37
|
|
44
|
-
def require_poltergeist!
|
45
|
-
require Agilibox::Engine.root.join("lib", "agilibox", "cucumber_helpers", "poltergeist.rb")
|
46
|
-
end
|
47
|
-
|
48
38
|
def require_chrome_headless!
|
49
39
|
require Agilibox::Engine.root.join("lib", "agilibox", "cucumber_helpers", "chrome_headless.rb")
|
50
40
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
Capybara.register_driver :agilibox_no_driver do |_app|
|
2
|
-
raise "You need to add Agilibox::CucumberConfig.
|
2
|
+
raise "You need to add Agilibox::CucumberConfig.require_cuprite! or "\
|
3
3
|
"Agilibox::CucumberConfig.require_chrome_headless! " \
|
4
4
|
"to your features/support/env.rb"
|
5
5
|
end
|
data/lib/agilibox/engine.rb
CHANGED
@@ -12,6 +12,10 @@ module Agilibox
|
|
12
12
|
Mime::Type.register "application/vnd.ms-excel", :xls
|
13
13
|
Mime::Type.register "application/vnd.ms-excel", :xlsx
|
14
14
|
end
|
15
|
+
|
16
|
+
# initializer "agilibox_errors_middleware" do
|
17
|
+
# require "agilibox/errors_middleware"
|
18
|
+
# end
|
15
19
|
end
|
16
20
|
end
|
17
21
|
|
@@ -0,0 +1,47 @@
|
|
1
|
+
class Agilibox::ErrorsMiddleware
|
2
|
+
MAINTENANCE_ERRORS = [
|
3
|
+
"ActiveRecord::ConnectionTimeoutError",
|
4
|
+
"connections on port 5432",
|
5
|
+
"PG::UnableToSend",
|
6
|
+
]
|
7
|
+
|
8
|
+
NOT_ACCEPTABLE_ERRORS = [
|
9
|
+
"ActionController::BadRequest",
|
10
|
+
"ActionController::UnknownFormat",
|
11
|
+
"ActionController::UnknownHttpMethod",
|
12
|
+
"ActionView::MissingTemplate",
|
13
|
+
]
|
14
|
+
|
15
|
+
def initialize(app)
|
16
|
+
@app = app
|
17
|
+
end
|
18
|
+
|
19
|
+
def call(env)
|
20
|
+
@app.call(env)
|
21
|
+
rescue StandardError => e
|
22
|
+
error = "#{e.class} : #{e.message}"
|
23
|
+
|
24
|
+
if MAINTENANCE_ERRORS.any? { |pattern| error.match?(pattern) }
|
25
|
+
return respond_with 503, "Maintenance en cours."
|
26
|
+
end
|
27
|
+
|
28
|
+
if NOT_ACCEPTABLE_ERRORS.any? { |pattern| error.match?(pattern) }
|
29
|
+
return respond_with 406, "Not acceptable."
|
30
|
+
end
|
31
|
+
|
32
|
+
raise e
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def respond_with(status, body)
|
38
|
+
[status, {"Content-Type" => "text/plain; charset=UTF-8"}, [body]]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
stack = Rails.configuration.middleware
|
43
|
+
mw = Agilibox::ErrorsMiddleware
|
44
|
+
stack.unshift(mw)
|
45
|
+
stack.insert_after(ActionDispatch::DebugExceptions, mw) if defined?(ActionDispatch::DebugExceptions)
|
46
|
+
stack.insert_after(Bugsnag::Rack, mw) if defined?(Bugsnag::Rack)
|
47
|
+
stack.use(mw)
|
data/lib/agilibox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: agilibox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- agilidée
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails-i18n
|
@@ -206,8 +206,6 @@ files:
|
|
206
206
|
- lib/agilibox/cucumber_helpers/cuprite.rb
|
207
207
|
- lib/agilibox/cucumber_helpers/database_cleaner.rb
|
208
208
|
- lib/agilibox/cucumber_helpers/factory_bot.rb
|
209
|
-
- lib/agilibox/cucumber_helpers/fix_referrer.rb
|
210
|
-
- lib/agilibox/cucumber_helpers/poltergeist.rb
|
211
209
|
- lib/agilibox/cucumber_helpers/rails.rb
|
212
210
|
- lib/agilibox/cucumber_helpers/rspec.rb
|
213
211
|
- lib/agilibox/cucumber_helpers/screenshots.rb
|
@@ -219,6 +217,7 @@ files:
|
|
219
217
|
- lib/agilibox/cucumber_helpers/zonebie.rb
|
220
218
|
- lib/agilibox/engine.rb
|
221
219
|
- lib/agilibox/engine_file.rb
|
220
|
+
- lib/agilibox/errors_middleware.rb
|
222
221
|
- lib/agilibox/form_back_url.rb
|
223
222
|
- lib/agilibox/rspec.rb
|
224
223
|
- lib/agilibox/test_helpers.rb
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require "capybara/poltergeist"
|
2
|
-
|
3
|
-
phantomjs_version = Agilibox::CucumberConfig.phantomjs_version
|
4
|
-
phantomjs_binary = `which phantomjs-#{phantomjs_version} phantomjs`.split("\n").first
|
5
|
-
raise "invalid phantomjs version" if `#{phantomjs_binary} -v`.strip != phantomjs_version
|
6
|
-
# You can download phantomjs here : https://bitbucket.org/ariya/phantomjs/downloads/
|
7
|
-
# Semaphore setup commmand : change-phantomjs-version 2.1.1
|
8
|
-
|
9
|
-
Capybara.register_driver :agilibox_poltergeist do |app|
|
10
|
-
Capybara::Poltergeist::Driver.new(app,
|
11
|
-
:debug => false,
|
12
|
-
:window_size => Agilibox::CucumberConfig.window_size,
|
13
|
-
:timeout => 60,
|
14
|
-
:phantomjs => phantomjs_binary,
|
15
|
-
)
|
16
|
-
end
|
17
|
-
|
18
|
-
Capybara.default_driver = :agilibox_poltergeist
|
19
|
-
Capybara.javascript_driver = :agilibox_poltergeist
|
20
|
-
Capybara.current_driver = :agilibox_poltergeist
|