1
0
mirror of https://github.com/cmur2/openvpn-status-web.git synced 2024-12-22 22:54:24 +01:00

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: require:
- rubocop-rake - rubocop-rake
- rubocop-rspec
AllCops: AllCops:
TargetRubyVersion: '2.5' TargetRubyVersion: '2.5'
@ -89,3 +90,13 @@ Style/Semicolon:
Style/SymbolArray: Style/SymbolArray:
Enabled: false 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 'rspec'
s.add_development_dependency 'rubocop', '~> 1.6.1' s.add_development_dependency 'rubocop', '~> 1.6.1'
s.add_development_dependency 'rubocop-rake', '~> 0.5.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' s.add_development_dependency 'solargraph', ' ~> 0.40.0'
end end

View File

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

View File

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