* Initial automatic cleanup with rubocop * Fix syntax error introduced by rubocop * Cleanup seeds file * Cleanup lib folder * Exclude bin folder because it contains auto generated files * Make Rubocop a little bit more chatty * Block length should not include comments in the count * Cleanup config folder * Cleanup specs * Updated Rubocop version and generated a todo file * Fix broken ArticlesApi spec * Fix tests * Restored rubocop pre-commit hook
36 lines
875 B
Ruby
36 lines
875 B
Ruby
class NoOpHTTPClient
|
|
def self.post(uri, params = {})
|
|
# bonus, you could log or observe posted params here
|
|
end
|
|
end
|
|
|
|
def create_normal_notifier
|
|
Slack::Notifier.new(
|
|
ApplicationConfig["SLACK_WEBHOOK_URL"],
|
|
channel: ApplicationConfig["SLACK_CHANNEL"],
|
|
username: "activity_bot",
|
|
)
|
|
end
|
|
|
|
def create_test_channel_notifier
|
|
Slack::Notifier.new(
|
|
ApplicationConfig["SLACK_WEBHOOK_URL"],
|
|
channel: "#test",
|
|
username: "development_test_bot",
|
|
)
|
|
end
|
|
|
|
def create_stubbed_notifier
|
|
Slack::Notifier.new "WEBHOOK_URL" do
|
|
http_client NoOpHTTPClient
|
|
end
|
|
end
|
|
|
|
::SlackBot = case Rails.env # rubocop:disable Naming/ConstantName
|
|
when "production"
|
|
create_normal_notifier
|
|
when "development"
|
|
create_test_channel_notifier
|
|
when "test"
|
|
create_stubbed_notifier
|
|
end
|