DEV: Bump rubocop-discourse (#141)

* DEV: Bump rubocop-discourse

* Fix rubocop violations
This commit is contained in:
David Taylor 2022-10-03 20:36:52 +01:00 committed by GitHub
parent 7bf7368520
commit 5047583d95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 36 additions and 31 deletions

View File

@ -7,28 +7,33 @@ GIT
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
ast (2.4.0) ast (2.4.2)
jaro_winkler (1.5.4) json (2.6.2)
parallel (1.19.1) parallel (1.22.1)
parser (2.7.1.2) parser (3.1.2.1)
ast (~> 2.4.0) ast (~> 2.4.1)
rainbow (3.0.0) rainbow (3.1.1)
regexp_parser (2.6.0)
rexml (3.2.5) rexml (3.2.5)
rubocop (0.82.0) rubocop (1.36.0)
jaro_winkler (~> 1.5.1) json (~> 2.3)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 2.7.0.1) parser (>= 3.1.2.1)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
rexml regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.20.1, < 2.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0) unicode-display_width (>= 1.4.0, < 3.0)
rubocop-discourse (2.1.1) rubocop-ast (1.21.0)
rubocop (>= 0.69.0) parser (>= 3.1.1.0)
rubocop-rspec (>= 1.39.0) rubocop-discourse (3.0)
rubocop-rspec (1.39.0) rubocop (>= 1.1.0)
rubocop (>= 0.68.1) rubocop-rspec (>= 2.0.0)
ruby-progressbar (1.10.1) rubocop-rspec (2.13.2)
unicode-display_width (1.7.0) rubocop (~> 1.33)
ruby-progressbar (1.11.0)
unicode-display_width (2.3.0)
PLATFORMS PLATFORMS
ruby ruby

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
RSpec.shared_context "dummy provider" do RSpec.shared_context "with dummy provider" do
before(:each) do before(:each) do
module ::DiscourseChatIntegration::Provider::DummyProvider module ::DiscourseChatIntegration::Provider::DummyProvider
PROVIDER_NAME = "dummy".freeze PROVIDER_NAME = "dummy".freeze
@ -39,7 +39,7 @@ RSpec.shared_context "dummy provider" do
let(:provider) { ::DiscourseChatIntegration::Provider::DummyProvider } let(:provider) { ::DiscourseChatIntegration::Provider::DummyProvider }
end end
RSpec.shared_context "validated dummy provider" do RSpec.shared_context "with validated dummy provider" do
before(:each) do before(:each) do
module ::DiscourseChatIntegration::Provider::Dummy2Provider module ::DiscourseChatIntegration::Provider::Dummy2Provider
PROVIDER_NAME = "dummy2".freeze PROVIDER_NAME = "dummy2".freeze

View File

@ -4,7 +4,7 @@ require 'rails_helper'
require_relative '../dummy_provider' require_relative '../dummy_provider'
RSpec.describe DiscourseChatIntegration::Manager do RSpec.describe DiscourseChatIntegration::Manager do
include_context "dummy provider" include_context "with dummy provider"
let(:chan1) { DiscourseChatIntegration::Channel.create!(provider: 'dummy') } let(:chan1) { DiscourseChatIntegration::Channel.create!(provider: 'dummy') }
let(:chan2) { DiscourseChatIntegration::Channel.create!(provider: 'dummy') } let(:chan2) { DiscourseChatIntegration::Channel.create!(provider: 'dummy') }

View File

@ -95,7 +95,7 @@ describe 'Mattermost Command Controller', type: :request do
expect(rule.tags).to eq(nil) expect(rule.tags).to eq(nil)
end end
context 'from an unknown channel' do describe 'from an unknown channel' do
it 'creates the channel' do it 'creates the channel' do
post "/chat-integration/mattermost/command.json", params: { post "/chat-integration/mattermost/command.json", params: {
text: "watch #{category.slug}", text: "watch #{category.slug}",

View File

@ -113,7 +113,7 @@ describe 'Slack Command Controller', type: :request do
expect(rule.tags).to eq(nil) expect(rule.tags).to eq(nil)
end end
context 'from an unknown channel' do describe 'from an unknown channel' do
it 'creates the channel' do it 'creates the channel' do
post "/chat-integration/slack/command.json", params: { post "/chat-integration/slack/command.json", params: {
text: "watch #{category.slug}", text: "watch #{category.slug}",

View File

@ -4,7 +4,7 @@ require 'rails_helper'
RSpec.describe DiscourseChatIntegration::Provider::SlackProvider::SlackMessageFormatter do RSpec.describe DiscourseChatIntegration::Provider::SlackProvider::SlackMessageFormatter do
describe '.format' do describe '.format' do
context 'links' do context 'with links' do
it 'should return the right message' do it 'should return the right message' do
expect(described_class.format("<a href='http://somepath.com'>test</a>")) expect(described_class.format("<a href='http://somepath.com'>test</a>"))
.to eq('<http://somepath.com|test>') .to eq('<http://somepath.com|test>')

View File

@ -108,7 +108,7 @@ describe 'Telegram Command Controller', type: :request do
expect(rule.tags).to eq(nil) expect(rule.tags).to eq(nil)
end end
context 'from an unknown channel' do describe 'from an unknown channel' do
it 'does nothing' do it 'does nothing' do
post '/chat-integration/telegram/command/shhh.json', params: { post '/chat-integration/telegram/command/shhh.json', params: {
message: { chat: { id: 456 }, text: "/watch #{category.slug}" } message: { chat: { id: 456 }, text: "/watch #{category.slug}" }

View File

@ -4,8 +4,8 @@ require 'rails_helper'
require_relative '../dummy_provider' require_relative '../dummy_provider'
RSpec.describe DiscourseChatIntegration::Channel do RSpec.describe DiscourseChatIntegration::Channel do
include_context "dummy provider" include_context "with dummy provider"
include_context "validated dummy provider" include_context "with validated dummy provider"
it 'should save and load successfully' do it 'should save and load successfully' do
expect(DiscourseChatIntegration::Channel.all.length).to eq(0) expect(DiscourseChatIntegration::Channel.all.length).to eq(0)

View File

@ -4,7 +4,7 @@ require 'rails_helper'
require_relative '../dummy_provider' require_relative '../dummy_provider'
RSpec.describe DiscourseChatIntegration::Rule do RSpec.describe DiscourseChatIntegration::Rule do
include_context "dummy provider" include_context "with dummy provider"
let(:tag1) { Fabricate(:tag) } let(:tag1) { Fabricate(:tag) }
let(:tag2) { Fabricate(:tag) } let(:tag2) { Fabricate(:tag) }

View File

@ -12,8 +12,8 @@ describe 'Chat Controller', type: :request do
let(:tag) { Fabricate(:tag) } let(:tag) { Fabricate(:tag) }
let(:channel) { DiscourseChatIntegration::Channel.create(provider: 'dummy') } let(:channel) { DiscourseChatIntegration::Channel.create(provider: 'dummy') }
include_context "dummy provider" include_context "with dummy provider"
include_context "validated dummy provider" include_context "with validated dummy provider"
before do before do
SiteSetting.chat_integration_enabled = true SiteSetting.chat_integration_enabled = true

View File

@ -15,7 +15,7 @@ RSpec.describe DiscourseChatIntegration::Manager do
let(:second_post) { Fabricate(:post, topic: topic, post_number: 2) } let(:second_post) { Fabricate(:post, topic: topic, post_number: 2) }
describe '.trigger_notifications' do describe '.trigger_notifications' do
include_context "dummy provider" include_context "with dummy provider"
let(:chan1) { DiscourseChatIntegration::Channel.create!(provider: 'dummy') } let(:chan1) { DiscourseChatIntegration::Channel.create!(provider: 'dummy') }
let(:chan2) { DiscourseChatIntegration::Channel.create!(provider: 'dummy') } let(:chan2) { DiscourseChatIntegration::Channel.create!(provider: 'dummy') }