diff --git a/README.md b/README.md index 75662f3..134e9c8 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,13 @@ if you are using sidekiq scheduler you can use the following configuration: queue: scheduled ``` +### Block already marked users + +If you want to block already marked users, you can use the following command: +```bash +bundle exec rake decidim:spam_detection:block_users +``` + ### Further configuration list of env var, default value and their usage: ``` diff --git a/lib/tasks/decidim_block_user.rake b/lib/tasks/decidim_block_users.rake similarity index 100% rename from lib/tasks/decidim_block_user.rake rename to lib/tasks/decidim_block_users.rake diff --git a/spec/lib/tasks/decidim_block_user_spec.rb b/spec/lib/tasks/decidim_block_user_spec.rb new file mode 100644 index 0000000..d4b7975 --- /dev/null +++ b/spec/lib/tasks/decidim_block_user_spec.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +require "spec_helper" + +describe "decidim:spam_detection:block_users", type: :task do + it "preloads the Rails environment" do + expect(task.prerequisites).to include "environment" + end + + it "runs gracefully" do + expect { task.execute }.not_to raise_error + end + + it "performs the job" do + expect(Decidim::SpamDetection::BlockUsersJob).to receive(:perform_later) + + task.execute + end +end