gems: include rubocop-rspec and fix linting

This commit is contained in:
cn 2020-12-25 18:17:01 +01:00
parent 597b619b0b
commit 1e12701fc3
4 changed files with 18 additions and 6 deletions

View File

@ -1,5 +1,6 @@
require:
- rubocop-rake
- rubocop-rspec
AllCops:
TargetRubyVersion: '2.5'
@ -89,3 +90,13 @@ Style/Semicolon:
Style/SymbolArray:
Enabled: false
RSpec/ExampleLength:
Max: 10
RSpec/FilePath:
CustomTransform:
OpenVPNStatusWeb: openvpn-status-web
RSpec/MultipleExpectations:
Max: 5

View File

@ -39,5 +39,6 @@ Gem::Specification.new do |s|
s.add_development_dependency 'rspec'
s.add_development_dependency 'rubocop', '~> 1.6.1'
s.add_development_dependency 'rubocop-rake', '~> 0.5.1'
s.add_development_dependency 'rubocop-rspec', '~> 2.1.0'
s.add_development_dependency 'solargraph', ' ~> 0.40.0'
end

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative '../spec_helper'
require_relative '../../spec_helper'
describe OpenVPNStatusWeb::Parser::ModernStateless do
{
@ -8,7 +8,7 @@ describe OpenVPNStatusWeb::Parser::ModernStateless do
3 => status_v3
}.each do |version, status|
context "for status-version #{version}" do
context 'for client list' do
context 'with client list' do
it 'parses common names' do
expect(status.client_list.map { |client| client[0] }).to eq(%w[foo bar])
end
@ -34,7 +34,7 @@ describe OpenVPNStatusWeb::Parser::ModernStateless do
end
end
context 'for routing table' do
context 'with routing table' do
it 'parses virtual addresses' do
expect(status.routing_table.map { |route| route[0] }).to eq(['192.168.0.0/24', '192.168.66.2', '192.168.66.3', '2001:db8:0:0::1000'])
end

View File

@ -1,13 +1,13 @@
# frozen_string_literal: true
require_relative '../spec_helper'
require_relative '../../spec_helper'
describe OpenVPNStatusWeb::Parser::V1 do
def status
status_v1
end
context 'for client list' do
context 'with client list' do
it 'parses common names' do
expect(status.client_list.map { |client| client[0] }).to eq(%w[foo bar])
end
@ -33,7 +33,7 @@ describe OpenVPNStatusWeb::Parser::V1 do
end
end
context 'for routing table' do
context 'with routing table' do
it 'parses virtual addresses' do
expect(status.routing_table.map { |route| route[0] }).to eq(['192.168.0.0/24', '192.168.66.2', '192.168.66.3', '2001:db8:0:0::1000'])
end