Extract component for restore and hide actions

By doing so, we remove a lot of duplication.
This commit is contained in:
Javi Martín
2020-06-14 18:32:21 +02:00
parent 64b0cc741b
commit eb3f2bc2ca
9 changed files with 66 additions and 66 deletions

View File

@@ -0,0 +1,14 @@
require "rails_helper"
describe Admin::HiddenTableActionsComponent, type: :component do
let(:record) { create(:user) }
let(:component) { Admin::HiddenTableActionsComponent.new(record) }
it "renders links to restore and confirm hide" do
render_inline component
expect(page).to have_css "a", count: 2
expect(page).to have_css "a[href*='restore'][data-method='put']", text: "Restore"
expect(page).to have_css "a[href*='confirm_hide'][data-method='put']", text: "Confirm moderation"
end
end