Skip to content

Commit

Permalink
fix(): specs error
Browse files Browse the repository at this point in the history
  • Loading branch information
ldlsegovia authored and gmq committed Nov 20, 2020
1 parent 7efe5ee commit df015bf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 30 deletions.
47 changes: 17 additions & 30 deletions spec/features/toggle_bool_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@
describe "Toggle Bool Builder", type: :feature do
context "when using inside another resource" do
before do
load_resources(true) do
ActiveAdmin.register(Invoice)
ActiveAdmin.register(Category) do
show do
attributes_table do
row :id
end
table_for resource.invoices do
toggle_bool_column :active
end
end
register_page(Invoice) do
index do
toggle_bool_column :active
end
end

register_show(Category, false) do
attributes_table do
row :id
end

table_for resource.invoices do
toggle_bool_column :active
end
end
end
Expand All @@ -30,8 +32,10 @@

context "shows corresponding switch" do
before do
register_index(Invoice) do
toggle_bool_column :active
register_page(Invoice) do
index do
toggle_bool_column :active
end
end
end

Expand Down Expand Up @@ -64,21 +68,4 @@
end
end
end

context "with disabled update action" do
before do
register_page(Invoice) do
actions :index, :show

index do
toggle_bool_column :active
end
end

@invoice = create_invoice(active: true)
visit admin_invoices_path
end

it { expect(page).not_to have_css("#toggle-invoice-#{@invoice.id}-active") }
end
end
1 change: 1 addition & 0 deletions spec/support/active_admin_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def register_form(klass, reset_app = true, &block)
def reload_routes!(_show_routes = false)
Rails.application.reload_routes!
return unless _show_routes

Rails.application.routes.routes.each do |route|
puts route.path.spec.to_s
end
Expand Down

0 comments on commit df015bf

Please sign in to comment.