Files
grecia/spec/components/moderation/users/index_component_spec.rb
Javi Martín e9d9789c25 Move users moderation index view to a component
This way it's easier to change the logic and write tests for it.
2021-12-30 15:50:03 +01:00

31 lines
790 B
Ruby

require "rails_helper"
describe Moderation::Users::IndexComponent, controller: Moderation::UsersController do
describe "actions or status" do
let(:component) { Moderation::Users::IndexComponent.new(User.with_hidden.page(1)) }
it "shows actions to block or hide users" do
create(:user)
render_inline component
page.find("table") do |table|
expect(table).to have_button "Hide"
expect(table).to have_button "Block"
expect(table).not_to have_content "Blocked"
end
end
it "shows 'blocked' for hidden users" do
create(:user, :hidden)
render_inline component
page.find("table") do |table|
expect(table).to have_content "Blocked"
expect(table).not_to have_button
end
end
end
end