From 6561d7cab6d6208eb3549f5d0cec872ec3dca9ec Mon Sep 17 00:00:00 2001 From: Gena M Date: Fri, 7 Feb 2020 12:26:21 +0100 Subject: [PATCH] Update Travis CI with ActiveAdmin 2.6.0 --- .gitignore | 1 + .travis.yml | 6 ++---- Gemfile | 6 +++--- .../inputs/filters/date_time_range_input.rb | 6 ++++++ spec/filter_form_spec.rb | 11 +++++++++-- spec/spec_helper.rb | 1 + 6 files changed, 22 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 7120e5f..a51ee16 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +bin/ Gemfile.lock coverage/ spec/rails/rails-* diff --git a/.travis.yml b/.travis.yml index 8f8a635..036409a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,12 +11,10 @@ script: bundle exec rspec spec env: matrix: - - RAILS=4.2.0 AA=1.1.0 - - RAILS=5.1.0 AA=1.2.0 - - RAILS=5.2.0 AA=1.3.0 - RAILS=5.2.0 AA=1.4.0 - RAILS=5.2.0 AA=2.0.0 + - RAILS=6.0.0 AA=2.6.0 rvm: - - 2.4 + - 2.5 - 2.6 diff --git a/Gemfile b/Gemfile index f76a44c..0607cf3 100644 --- a/Gemfile +++ b/Gemfile @@ -4,8 +4,8 @@ source 'https://rubygems.org' gemspec group :test do - default_rails_version = '5.2.1' - default_activeadmin_version = '2.0.0' + default_rails_version = '6.0.0' + default_activeadmin_version = '2.6.0' gem 'rails', "~> #{ENV['RAILS'] || default_rails_version}" gem 'activeadmin', "~> #{ENV['AA'] || default_activeadmin_version}" @@ -14,7 +14,7 @@ group :test do gem 'rspec-rails' gem 'coveralls', require: false # Test coverage website. Go to https://coveralls.io gem 'sass-rails' - gem 'sqlite3', '~> 1.3.6' + gem 'sqlite3', '~> 1.4.0' gem 'launchy' gem 'database_cleaner' gem 'capybara' diff --git a/lib/active_admin_datetimepicker/inputs/filters/date_time_range_input.rb b/lib/active_admin_datetimepicker/inputs/filters/date_time_range_input.rb index f3ea97b..5f3e859 100644 --- a/lib/active_admin_datetimepicker/inputs/filters/date_time_range_input.rb +++ b/lib/active_admin_datetimepicker/inputs/filters/date_time_range_input.rb @@ -11,6 +11,12 @@ def input_html_options(input_name = gt_input_name, placeholder = gt_input_placeh end end + # This method is for compatibility for ActiveAdmin 2.6 + def input_html_options_for(input_name, placeholder) + super.merge placeholder: placeholder, + value: input_value(input_name) + end + def gt_input_name column && column.type == :date ? super : "#{method}_gteq_datetime_picker" end diff --git a/spec/filter_form_spec.rb b/spec/filter_form_spec.rb index f46fe50..1b36158 100644 --- a/spec/filter_form_spec.rb +++ b/spec/filter_form_spec.rb @@ -71,6 +71,9 @@ page.find('.xdsoft_datetimepicker', visible: true) .find('.xdsoft_timepicker.active .xdsoft_time.xdsoft_current').click + @value_from = page.find('#q_created_at_gteq_datetime_picker').value + @value_to = page.find('#q_created_at_lteq_datetime_picker').value + page.find('#sidebar input[type=submit]').click page.has_css?('h4', text: 'Current filters:') end @@ -80,9 +83,13 @@ expect(page).not_to have_text('from-the-future') end - it 'submit filter form' do + it 'input#value and placeholder is the same as before form submit' do # created_at(Timestamp type) should contain Hours:Minutes, as selected before submit - expect(page.find('#q_created_at_gteq_datetime_picker').value).to match(/\A\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}\z/) + expect(page.find('#q_created_at_gteq_datetime_picker').value).to match(@value_from) + expect(page.find('#q_created_at_lteq_datetime_picker').value).to match(@value_to) + + expect(page).to have_css('#q_created_at_gteq_datetime_picker[placeholder=From]') + expect(page).to have_css('#q_created_at_lteq_datetime_picker[placeholder=To]') end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c0098f6..c523fb4 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -21,6 +21,7 @@ require 'active_model' # require ActiveRecord to ensure that Ransack loads correctly require 'active_record' +require 'action_view' require 'active_admin' ActiveAdmin.application.load_paths = [ENV['RAILS_ROOT'] + "/app/admin"] require ENV['RAILS_ROOT'] + '/config/environment.rb'