From 1e12701fc353724b7da87544e2220220b28d56b9 Mon Sep 17 00:00:00 2001 From: cn Date: Fri, 25 Dec 2020 18:17:01 +0100 Subject: [PATCH] gems: include rubocop-rspec and fix linting --- .rubocop.yml | 11 +++++++++++ openvpn-status-web.gemspec | 1 + .../parser/modern_stateless_spec.rb | 6 +++--- spec/{ => openvpn-status-web}/parser/v1_spec.rb | 6 +++--- 4 files changed, 18 insertions(+), 6 deletions(-) rename spec/{ => openvpn-status-web}/parser/modern_stateless_spec.rb (94%) rename spec/{ => openvpn-status-web}/parser/v1_spec.rb (94%) diff --git a/.rubocop.yml b/.rubocop.yml index 6c1a3c8..5b4e1c2 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -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 diff --git a/openvpn-status-web.gemspec b/openvpn-status-web.gemspec index 43fc54e..ca22ced 100644 --- a/openvpn-status-web.gemspec +++ b/openvpn-status-web.gemspec @@ -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 diff --git a/spec/parser/modern_stateless_spec.rb b/spec/openvpn-status-web/parser/modern_stateless_spec.rb similarity index 94% rename from spec/parser/modern_stateless_spec.rb rename to spec/openvpn-status-web/parser/modern_stateless_spec.rb index 6e916a4..2ab9417 100644 --- a/spec/parser/modern_stateless_spec.rb +++ b/spec/openvpn-status-web/parser/modern_stateless_spec.rb @@ -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 diff --git a/spec/parser/v1_spec.rb b/spec/openvpn-status-web/parser/v1_spec.rb similarity index 94% rename from spec/parser/v1_spec.rb rename to spec/openvpn-status-web/parser/v1_spec.rb index ff7baba..aa8088a 100644 --- a/spec/parser/v1_spec.rb +++ b/spec/openvpn-status-web/parser/v1_spec.rb @@ -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