activeadmin-rb 1.5.2 → 1.6.0

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: 16c418b00684a2594838518e317b5be1842f91c2d7f86862c5177bb7646ac00d
4
- data.tar.gz: a58b8f8f1168ed57fca7bc000e30c883d643dbbb06a9d5d32021f5b428feff75
3
+ metadata.gz: 6f9390b0a2c779b367ff02ed61abf9ac18ba6d381c910528ace2face7aeb9b0e
4
+ data.tar.gz: 71eb79f51168913a392fa61864a1decc6afdda47e731a5e0bf9b3e449706e120
5
5
  SHA512:
6
- metadata.gz: 5529e188e3f1973fed618e82d36067f8bf70a38ce1f6ce3c5f7d70aef5794636bcbbe4d1c231d510cbabd989a75aaf8e63622a10cf9099c242e7a8866d47e915
7
- data.tar.gz: 6cbd6dd46a6a44f8075f901a497e6b15b23e305b9d84c0cb333ed4d241f9a087289fa37d9c14429a1c6495e398bfac0da30d4e5f353bb0f462230843c592e7fe
6
+ metadata.gz: e6c6fc6b71b50a8f9199431030c432c12e5730a6f65a8c7f11b937771e3db87293cfac2fa6cc12113ab00fe79804f91ec6318a28ccdafa80199bfeb211fc8ab1
7
+ data.tar.gz: 24dd5fb4179da63737456f605ad77fffc1001955a892f1dcad90111da5d47e482ddc5764f5c77270003fdd059790a8507f5423ef5efa30c1150a2fd0a1d75f5c
@@ -19,7 +19,7 @@ jobs:
19
19
 
20
20
  os: [ubuntu-20.04]
21
21
 
22
- deps: [rails_61, rails_60]
22
+ deps: [rails_70, rails_61]
23
23
 
24
24
  env:
25
25
  COVERAGE: false
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.6.0 [☰](https://github.com/varyonic/activeadmin-rb/compare/v1.5.2...v1.6.0)
4
+
5
+ ### Enhancements
6
+
7
+ * Add Rails 7 Support. [#7235] by [@tagliala]
8
+
9
+ ### Bug Fixes
10
+
11
+ * Fix frozen string error when downloading CSV and streaming disabled. [#7332] by [@deivid-rodriguez]
12
+
3
13
  ## 1.5.2 [☰](https://github.com/varyonic/activeadmin-rb/compare/v1.5.1...v1.5.2)
4
14
 
5
15
  * Fix Ruby 2.7 warnings about keyword args. [#6000], [#6237] by [@vcsjones] and [@deivid-rodriguez]
@@ -354,6 +364,8 @@ Please check [0-6-stable] for previous changes.
354
364
  [#5800]: https://github.com/activeadmin/activeadmin/pull/5800
355
365
  [#6000]: https://github.com/activeadmin/activeadmin/pull/6000
356
366
  [#6237]: https://github.com/activeadmin/activeadmin/pull/6237
367
+ [#7235]: https://github.com/activeadmin/activeadmin/pull/7235
368
+ [#7332]: https://github.com/activeadmin/activeadmin/pull/7332
357
369
 
358
370
  [@5t111111]: https://github.com/5t111111
359
371
  [@aarek]: https://github.com/aarek
@@ -405,6 +417,7 @@ Please check [0-6-stable] for previous changes.
405
417
  [@shekibobo]: https://github.com/shekibobo
406
418
  [@shouya]: https://github.com/shouya
407
419
  [@stefsava]: https://github.com/stefsava
420
+ [@tagliala]: https://github.com/tagliala
408
421
  [@stereoscott]: https://github.com/stereoscott
409
422
  [@tiagotex]: https://github.com/tiagotex
410
423
  [@timoschilling]: https://github.com/timoschilling
data/Gemfile CHANGED
@@ -35,6 +35,7 @@ group :development, :test do
35
35
  end
36
36
 
37
37
  group :test do
38
+ gem 'cuprite'
38
39
  gem 'capybara'
39
40
  gem 'simplecov', require: false # Test coverage generator. Go to /coverage/ after running tests
40
41
  gem 'codecov', require: false # Test coverage website. Go to https://codecov.io
@@ -45,5 +46,4 @@ group :test do
45
46
  gem 'launchy'
46
47
  gem 'rspec-rails'
47
48
  gem 'i18n-spec'
48
- gem 'poltergeist'
49
49
  end
data/Rakefile CHANGED
@@ -25,7 +25,7 @@ task :setup, [:parallel, :dir, :template] do |_t, opts|
25
25
  env = { 'BUNDLE_GEMFILE' => ENV['BUNDLE_GEMFILE'] }
26
26
  env['INSTALL_PARALLEL'] = 'yes' if opts[:parallel]
27
27
 
28
- Bundler.with_clean_env { Kernel.exec(env, command) }
28
+ Bundler.with_unbundled_env { Kernel.exec(env, command) }
29
29
 
30
30
  Rake::Task['parallel:after_setup_hook'].invoke if opts[:parallel]
31
31
  end
@@ -27,6 +27,20 @@ Feature: Format as CSV
27
27
  Then I should download a CSV file for "my-articles" containing:
28
28
  | Id | Title | Body | Published date | Position | Starred | Foo | Created at | Updated at |
29
29
 
30
+ Scenario: Default with streaming disabled
31
+ Given a configuration of:
32
+ """
33
+ ActiveAdmin.application.disable_streaming_in = ["test"]
34
+
35
+ ActiveAdmin.register Post
36
+ """
37
+ And a post with the title "Hello World" exists
38
+ When I am on the index page for posts
39
+ And I follow "CSV"
40
+ Then I should download a CSV file for "posts" containing:
41
+ | Id | Title | Body | Published date | Position | Starred | Foo |Created at | Updated at |
42
+ | \d+ | Hello World | | | | | |(.*) | (.*) |
43
+
30
44
  Scenario: With CSV format customization
31
45
  Given a configuration of:
32
46
  """
@@ -58,9 +58,6 @@ Given /^I submit the batch action form with "([^"]*)"$/ do |action|
58
58
  end
59
59
 
60
60
  When /^I click "(.*?)" and accept confirmation$/ do |link|
61
- # Use this implementation instead if poltergeist ever implements it
62
- # page.driver.accept_modal(:confirm) { click_link(link) }
63
-
64
61
  click_link(link)
65
62
  expect(page).to have_content("Are you sure you want to delete these posts?")
66
63
  click_button("OK")
@@ -2,10 +2,12 @@ require 'csv'
2
2
 
3
3
  Around '@csv' do |scenario, block|
4
4
  default_csv_options = ActiveAdmin.application.csv_options
5
+ default_disable_streaming_in = ActiveAdmin.application.disable_streaming_in
5
6
 
6
7
  begin
7
8
  block.call
8
9
  ensure
10
+ ActiveAdmin.application.disable_streaming_in = default_disable_streaming_in
9
11
  ActiveAdmin.application.csv_options = default_csv_options
10
12
  end
11
13
  end
@@ -47,13 +47,13 @@ After do
47
47
  end
48
48
  end
49
49
 
50
- require 'capybara/rails'
51
- require 'capybara/cucumber'
52
- require 'capybara/session'
53
- require 'capybara/poltergeist'
54
- require 'phantomjs/poltergeist'
50
+ require "capybara/cuprite"
55
51
 
56
- Capybara.javascript_driver = :poltergeist
52
+ Capybara.register_driver(:cuprite) do |app|
53
+ Capybara::Cuprite::Driver.new(app, process_timeout: 30, timeout: 30)
54
+ end
55
+
56
+ Capybara.javascript_driver = :cuprite
57
57
 
58
58
  Capybara.server = :webrick
59
59
 
@@ -95,7 +95,7 @@ end
95
95
  Before do
96
96
  # We are caching classes, but need to manually clear references to
97
97
  # the controllers. If they aren't clear, the router stores references
98
- ActiveSupport::Dependencies.clear
98
+ ActiveSupport::Dependencies.clear if Rails::VERSION::MAJOR < 7
99
99
 
100
100
  # Reload Active Admin
101
101
  ActiveAdmin.unload!
@@ -3,7 +3,7 @@ source "https://rubygems.org"
3
3
  eval_gemfile(File.expand_path(File.join("..", "Gemfile"), __dir__))
4
4
 
5
5
  gem "rails", "~> 6.0.0"
6
- gem "rails-i18n", ">= 6.0.x"
6
+ gem "rails-i18n", "~> 6.0"
7
7
  gem "sass-rails", ">= 6.0.x"
8
8
  gem "sprockets", ">= 4.0.x"
9
9
  gem "bootsnap"
@@ -2,8 +2,8 @@ source "https://rubygems.org"
2
2
 
3
3
  eval_gemfile(File.expand_path(File.join("..", "Gemfile"), __dir__))
4
4
 
5
- gem "rails", ">= 6.0.x"
6
- gem "rails-i18n", ">= 6.0.x"
5
+ gem "rails", "~> 6.1.0"
6
+ gem "rails-i18n", "~> 6.0.x"
7
7
  gem "sass-rails", ">= 6.0.x"
8
8
  gem "sprockets", ">= 4.0.x"
9
9
  gem "bootsnap"
@@ -0,0 +1,17 @@
1
+ source "https://rubygems.org"
2
+
3
+ eval_gemfile(File.expand_path(File.join("..", "Gemfile"), __dir__))
4
+
5
+ gem "rails", ">= 7.0.0.rc"
6
+ gem "rails-i18n", ">= 6.0.x"
7
+ gem "sass-rails", ">= 6.0.x"
8
+ gem "sprockets", ">= 4.0.x"
9
+ gem "bootsnap"
10
+ gem "devise", "~> 4.4"
11
+ gem "draper"
12
+ gem "inherited_resources", github: "varyonic/inherited_resources", branch: "rails-7"
13
+ gem "ransack", ">= 2.0" # 2.x for Rails 5.2+ only.
14
+ gem 'sqlite3', platforms: :mri
15
+ gem "activerecord-jdbcsqlite3-adapter", ">= 60.0.x", platform: :jruby
16
+
17
+ gemspec path: "../"
@@ -79,7 +79,7 @@ module ActiveAdmin
79
79
  def active_admin_authorization_adapter
80
80
  adapter = active_admin_namespace.authorization_adapter
81
81
  if adapter.is_a? String
82
- ActiveSupport::Dependencies.constantize adapter
82
+ adapter.constantize
83
83
  else
84
84
  adapter
85
85
  end
@@ -1,6 +1,7 @@
1
1
  module ActiveAdmin
2
2
  class Engine < ::Rails::Engine
3
- initializer "active_admin.load_app_path" do |app|
3
+ # Set default values for app_path and load_paths before running initializers
4
+ initializer "active_admin.load_app_path", before: :load_config_initializers do |app|
4
5
  ActiveAdmin::Application.setting :app_path, app.root
5
6
  ActiveAdmin::Application.setting :load_paths, [File.expand_path('app/admin', app.root)]
6
7
  end
@@ -96,11 +96,11 @@ module ActiveAdmin
96
96
  # The class this resource wraps. If you register the Post model, Resource#resource_class
97
97
  # will point to the Post class
98
98
  def resource_class
99
- ActiveSupport::Dependencies.constantize(resource_class_name)
99
+ resource_class_name.constantize
100
100
  end
101
101
 
102
102
  def decorator_class
103
- ActiveSupport::Dependencies.constantize(decorator_class_name) if decorator_class_name
103
+ decorator_class_name&.constantize
104
104
  end
105
105
 
106
106
  def resource_table_name
@@ -22,14 +22,14 @@ module ActiveAdmin
22
22
  headers['Cache-Control'] = 'no-cache'
23
23
 
24
24
  if ActiveAdmin.application.disable_streaming_in.include? Rails.env
25
- self.response_body = block['']
25
+ self.response_body = block[String.new]
26
26
  else
27
27
  self.response_body = Enumerator.new &block
28
28
  end
29
29
  end
30
30
 
31
31
  def csv_filename
32
- "#{resource_collection_name.to_s.gsub('_', '-')}-#{Time.zone.now.to_date.to_s(:default)}.csv"
32
+ "#{resource_collection_name.to_s.gsub('_', '-')}-#{Time.zone.now.to_date.to_formatted_s(:default)}.csv"
33
33
  end
34
34
 
35
35
  def stream_csv
@@ -1,3 +1,3 @@
1
1
  module ActiveAdmin
2
- VERSION = '1.5.2'
2
+ VERSION = '1.6.0'
3
3
  end
@@ -3,7 +3,7 @@ require 'open3'
3
3
 
4
4
  RSpec.describe 'bug_report_templates' do
5
5
  subject do
6
- Bundler.with_clean_env do
6
+ Bundler.with_unbundled_env do
7
7
  Dir.chdir(chdir_path) do
8
8
  Open3.capture2e(
9
9
  {'ACTIVE_ADMIN_PATH' => active_admin_root},
@@ -123,7 +123,7 @@ RUBY
123
123
 
124
124
  # TODO: remove this line after the STI pre-loading is fixed
125
125
  # The test commenting.feature/Commenting on a STI subclass fails with zeitwerk autoloader
126
- inject_into_file 'config/environments/test.rb', "\n config.autoloader = :classic\n", after: 'Rails.application.configure do' if Rails::VERSION::MAJOR >= 6
126
+ inject_into_file 'config/environments/test.rb', "\n config.autoloader = :classic\n", after: 'Rails.application.configure do' if Rails::VERSION::MAJOR == 6
127
127
 
128
128
  # Add our local Active Admin to the application
129
129
  gem 'activeadmin-rb', path: '../..'
@@ -178,7 +178,7 @@ RSpec.describe ActiveAdmin::Filters::ActiveFilter do
178
178
  end
179
179
 
180
180
  it "should use the association's primary key to find the associated record" do
181
- allow(ActiveSupport::Dependencies).to receive(:constantize).with("::SuperPost").and_return(resource_klass)
181
+ stub_const("::SuperPost", resource_klass)
182
182
 
183
183
  resource.add_filter(:kategory)
184
184
 
@@ -210,7 +210,7 @@ RSpec.describe ActiveAdmin::Filters::ActiveFilter do
210
210
  end
211
211
 
212
212
  it "should use the association's primary key to find the associated record" do
213
- allow(ActiveSupport::Dependencies).to receive(:constantize).with("::#{resource_klass.name}").and_return(resource_klass)
213
+ stub_const("::#{resource_klass.name}", resource_klass)
214
214
 
215
215
  expect(subject.values.first).to eq user
216
216
  end
@@ -241,8 +241,8 @@ module ActiveAdmin
241
241
  let(:resource) { namespace.register(Post) }
242
242
  let(:post) { double }
243
243
  before do
244
- allow(Post).to receive(:find_by).with("id" => "12345") { post }
245
- allow(Post).to receive(:find_by).with("id" => "54321") { nil }
244
+ allow(Post).to receive(:find_by).with({"id" => "12345"}) { post }
245
+ allow(Post).to receive(:find_by).with({"id" => "54321"}) { nil }
246
246
  end
247
247
 
248
248
  it 'can find the resource' do
@@ -265,7 +265,7 @@ module ActiveAdmin
265
265
  before do
266
266
  allow(Post).to receive(:primary_key).and_return 'something_else'
267
267
  allow(Post).to receive(:find_by).
268
- with("something_else" => "55555") { different_post }
268
+ with({"something_else" => "55555"}) { different_post }
269
269
  end
270
270
 
271
271
  it 'can find the post by the custom primary key' do
@@ -8,7 +8,7 @@ RSpec.describe ActiveAdmin::ViewHelpers::FormHelper do
8
8
  let(:default_options) { { builder: ActiveAdmin::FormBuilder } }
9
9
 
10
10
  it 'calls semantic_form_for with the ActiveAdmin form builder' do
11
- expect(view).to receive(:semantic_form_for).with(resource, builder: ActiveAdmin::FormBuilder)
11
+ expect(view).to receive(:semantic_form_for).with(resource, { builder: ActiveAdmin::FormBuilder })
12
12
  view.active_admin_form_for(resource)
13
13
  end
14
14
 
@@ -16,7 +16,7 @@ RSpec.describe ActiveAdmin::ViewHelpers::FormHelper do
16
16
  # We can't use a stub here because options gets marshalled, and a new
17
17
  # instance built. Any constant will work.
18
18
  custom_builder = Object
19
- expect(view).to receive(:semantic_form_for).with(resource, builder: custom_builder)
19
+ expect(view).to receive(:semantic_form_for).with(resource, { builder: custom_builder })
20
20
  view.active_admin_form_for(resource, builder: custom_builder)
21
21
  end
22
22
  end
data/tasks/local.rake CHANGED
@@ -20,6 +20,6 @@ task :local do
20
20
  env = { 'BUNDLE_GEMFILE' => ENV['BUNDLE_GEMFILE'] }
21
21
 
22
22
  Dir.chdir(app_folder) do
23
- Bundler.with_clean_env { Kernel.exec(env, command) }
23
+ Bundler.with_unbundled_env { Kernel.exec(env, command) }
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Bell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-08 00:00:00.000000000 Z
11
+ date: 2022-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: arbre
@@ -462,6 +462,7 @@ files:
462
462
  - gemfiles/rails_52.gemfile
463
463
  - gemfiles/rails_60.gemfile
464
464
  - gemfiles/rails_61.gemfile
465
+ - gemfiles/rails_70.gemfile
465
466
  - lib/active_admin.rb
466
467
  - lib/active_admin/abstract_view_factory.rb
467
468
  - lib/active_admin/application.rb
@@ -790,7 +791,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
790
791
  - !ruby/object:Gem::Version
791
792
  version: '0'
792
793
  requirements: []
793
- rubygems_version: 3.2.29
794
+ rubygems_version: 3.2.15
794
795
  signing_key:
795
796
  specification_version: 4
796
797
  summary: The administration framework for Ruby on Rails.