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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32ae9547194bc24867f080fd2d519d8c5121f0bd29c5f04a77ef3a0cc73ab193
4
- data.tar.gz: b3842b9bcaf9a53cabe3ff70e35397f24486848b5b4b63ba718eeac3197149fc
3
+ metadata.gz: 70cf28216c3454232717705c0f856cbbcc9c7afe64a64940031e37c244e087ca
4
+ data.tar.gz: 4b69d768141760b3aa70b2bbecad849a359fe6e5c4e3d312971f5f648a7187b4
5
5
  SHA512:
6
- metadata.gz: 57219afef63509df9ecef5d62e889f163808acb127634d869b644de4a6510a419880ccbd2bc655e8a892a69cebf29048a0afd2b24efecb72d7cb6f54f2ddf30a
7
- data.tar.gz: 74850c8fd415e42e1cd1580ab02f55b5b8b5e2ed557f7b70bb7b036c3b801dfa1c38befe388e78dd8428cf15707ad58591b52ec4b8e698257e1cd83c1d51b671
6
+ metadata.gz: b895a6a5d99124b9a8fa3e7185e949b426bbe90c134441dbf1ee7e5329f8b10609ab40a3420f2067941158e9821c08a1ea1145fe8394506f7306bd309946c8ed
7
+ data.tar.gz: fc304783878fcfe3bfaad9d452d299ace65059046244cbe5ec0aa526107b23fe957869d26c1c39dbf306bcc755d8a1d71cea297dd42123d522b8b15b4a56bca9
@@ -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
@@ -35,3 +35,7 @@ end
35
35
 
36
36
 
37
37
  task default: :test
38
+
39
+ task "assets:precompile" do
40
+ Rake::Task["app:assets:precompile"].invoke
41
+ end
@@ -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
- ].select(&:present?).first
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
- engine = obj.class.parents[-2]
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
@@ -38,7 +38,7 @@ module Agilibox::SortingHelper
38
38
 
39
39
  if sort_param.present?
40
40
  if sort_param.start_with?("-")
41
- column = sort_param[1..-1].to_sym
41
+ column = sort_param[1..].to_sym
42
42
  direction = :desc
43
43
  else
44
44
  column = sort_param.to_sym
@@ -1,8 +1,9 @@
1
1
  <%
2
2
  rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
3
- rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
4
- std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip"
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 ~@wip
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..-1] if message[0] == "^"
3
+ return message[1..] if message[0] == "^"
4
4
  super(attribute, message)
5
5
  end
6
6
  end
7
7
 
8
- ActiveModel::Errors.send(:prepend, Agilibox::ActiveModelCustomErrorMessages)
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.send(:prepend, Agilibox::ActiveModelTypeCast::Date)
50
- ActiveModel::Type::Boolean.send(:prepend, Agilibox::ActiveModelTypeCast::Boolean)
51
- ActiveModel::Type::Decimal.send(:prepend, Agilibox::ActiveModelTypeCast::Decimal)
52
- ActiveModel::Type::Float.send(:prepend, Agilibox::ActiveModelTypeCast::Decimal)
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?(/poltergeist|chrome|cuprite|_steps/) }
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.require_poltergeist! or "\
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
@@ -1 +1,4 @@
1
- Zonebie.set_random_timezone
1
+ # Temporairement désactiver en attendant de trouver une solution.
2
+ # Zonebie change la TZ sur les steps mais pas sur l'application,
3
+ # du coup on casse des tests alors que l'implémentation est bonne.
4
+ # Zonebie.set_random_timezone
@@ -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)
@@ -15,4 +15,4 @@ module Agilibox::FormBackUrl
15
15
  end
16
16
  end
17
17
 
18
- ActionView::Helpers::FormTagHelper.send(:prepend, Agilibox::FormBackUrl)
18
+ ActionView::Helpers::FormTagHelper.prepend(Agilibox::FormBackUrl)
@@ -1,3 +1,3 @@
1
1
  module Agilibox
2
- VERSION = "1.8.0"
2
+ VERSION = "1.9.5"
3
3
  end
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.8.0
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: 2019-10-09 00:00:00.000000000 Z
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,9 +0,0 @@
1
- # https://github.com/ariya/phantomjs/issues/13677
2
-
3
- module RackETagDisable
4
- def call(env)
5
- @app.call(env)
6
- end
7
- end
8
-
9
- Rack::ETag.send(:prepend, RackETagDisable)
@@ -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