Skip to content

Commit 561c93a

Browse files
committed
navigation spec and locales fixes
1 parent 6ca4bd7 commit 561c93a

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed

config/locales/en.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ en:
1212
failed:
1313
one: "Failed to import 1 %{model}"
1414
other: "Failed to import %{count} %{plural_model}"
15-
import_model: "Import %{model}"
15+
import_model: "Import %{plural_model}"
1616
import_btn: "Import"
1717
import_btn_disabled: "Wait..."

config/locales/it.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ it:
1212
failed:
1313
one: "Importazione di 1 %{model} fallita"
1414
other: "Importazione di %{count} %{plural_model} fallita"
15-
import_model: "Importa %{model}"
15+
import_model: "Importa %{plural_model}"
1616
import_btn: "Importa"
1717
import_btn_disabled: "In attesa..."

lib/active_admin_import/dsl.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def active_admin_import(options = {}, &block)
4949

5050
action_item :import, only: :index do
5151
if authorized?(ActiveAdminImport::Auth::IMPORT, active_admin_config.resource_class)
52-
link_to(I18n.t('active_admin_import.import_model', model: options[:resource_label]), action: :import)
52+
link_to(I18n.t('active_admin_import.import_model', plural_model: options[:plural_resource_label]), action: :import)
5353
end
5454
end
5555

spec/import_spec.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,22 @@ def upload_file!(name, ext='csv')
2222
find_button('Import').click
2323
end
2424

25+
context "authors index" do
26+
before do
27+
add_author_resource
28+
29+
end
30+
31+
it "should navigate to import page" do
32+
#todo: removing this causes undefined method `ransack' for #<ActiveRecord::Relation []>
33+
allow_any_instance_of(Admin::AuthorsController).to receive(:find_collection).and_return(Author.all)
34+
visit '/admin/authors'
35+
find_link('Import Authors').click
36+
expect(current_path).to eq("/admin/authors/import")
37+
end
38+
39+
40+
end
2541

2642
context "with custom block" do
2743

spec/support/admin.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
def add_author_resource(options = {}, &block)
22

33
ActiveAdmin.register Author do
4+
config.filters = false
45
active_admin_import(options, &block)
56
end
67
Rails.application.reload_routes!

0 commit comments

Comments
 (0)