diff --git a/.rubocop.yml b/.rubocop.yml index 32497f9..b5b354f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -5,10 +5,12 @@ require: AllCops: NewCops: enable -RSpec/FilePath: - SpecSuffixOnly: true +RSpec/MultipleExpectations: + Enabled: false RSpec/SpecFilePathFormat: Enabled: false +RSpec/SpecFilePathSuffix: + Enabled: true Layout/DotPosition: EnforcedStyle: trailing diff --git a/Gemfile b/Gemfile index d2894a2..3c34a91 100644 --- a/Gemfile +++ b/Gemfile @@ -1,9 +1,13 @@ source 'https://rubygems.org' ruby '3.3.0' -gem 'rspec' -gem 'rspec-github-actions-formatter' +group :development do + gem 'rubocop' + gem 'rubocop-performance' + gem 'rubocop-rspec' +end -gem 'rubocop' -gem 'rubocop-performance' -gem 'rubocop-rspec' +group :test do + gem 'rspec' + gem 'rspec-github-actions-formatter' +end diff --git a/Gemfile.lock b/Gemfile.lock index 4844b79..9482407 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,56 +3,48 @@ GEM specs: ast (2.4.2) diff-lcs (1.5.1) - json (2.7.1) + json (2.7.2) language_server-protocol (3.17.0.3) - parallel (1.24.0) - parser (3.3.0.5) + parallel (1.26.3) + parser (3.3.5.0) ast (~> 2.4.1) racc - racc (1.7.3) + racc (1.8.1) rainbow (3.1.1) - regexp_parser (2.9.0) - rexml (3.2.6) + regexp_parser (2.9.2) rspec (3.13.0) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.0) + rspec-core (3.13.2) rspec-support (~> 3.13.0) - rspec-expectations (3.13.0) + rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-github-actions-formatter (0.2.0) - rspec-mocks (3.13.0) + rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-support (3.13.0) - rubocop (1.60.2) + rspec-support (3.13.1) + rubocop (1.67.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.30.0, < 2.0) + regexp_parser (>= 2.4, < 3.0) + rubocop-ast (>= 1.32.2, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.30.0) - parser (>= 3.2.1.0) - rubocop-capybara (2.20.0) - rubocop (~> 1.41) - rubocop-factory_bot (2.25.1) - rubocop (~> 1.41) - rubocop-performance (1.20.2) + rubocop-ast (1.32.3) + parser (>= 3.3.1.0) + rubocop-performance (1.22.1) rubocop (>= 1.48.1, < 2.0) - rubocop-ast (>= 1.30.0, < 2.0) - rubocop-rspec (2.26.1) - rubocop (~> 1.40) - rubocop-capybara (~> 2.17) - rubocop-factory_bot (~> 2.22) + rubocop-ast (>= 1.31.1, < 2.0) + rubocop-rspec (3.1.0) + rubocop (~> 1.61) ruby-progressbar (1.13.0) - unicode-display_width (2.5.0) + unicode-display_width (2.6.0) PLATFORMS ruby diff --git a/spec/year_2015/day_11_spec.rb b/spec/year_2015/day_11_spec.rb index 93638e7..9526d65 100644 --- a/spec/year_2015/day_11_spec.rb +++ b/spec/year_2015/day_11_spec.rb @@ -7,21 +7,21 @@ end it 'checks first criteria (three straight letters)' do - { 'hijklmmn' => :to, 'abbceffg' => :not_to, 'abbcegjk' => :not_to }.each do |input, result| - expect(password_class.new(input)).send(result, be_first_criteria) - end + expect(password_class.new('hijklmmn')).to be_first_criteria + expect(password_class.new('abbceffg')).not_to be_first_criteria + expect(password_class.new('abbcegjk')).not_to be_first_criteria end it 'checks second criteria (no i/o/l)' do - { 'hijklmmn' => :not_to, 'abbceffg' => :to, 'abbcegjk' => :to }.each do |input, result| - expect(password_class.new(input)).send(result, be_second_criteria) - end + expect(password_class.new('hijklmmn')).not_to be_second_criteria + expect(password_class.new('abbceffg')).to be_second_criteria + expect(password_class.new('abbcegjk')).to be_second_criteria end it 'checks third criteria (two different pairs)' do - { 'hijklmmn' => :not_to, 'abbceffg' => :to, 'abbcegjk' => :not_to }.each do |input, result| - expect(password_class.new(input)).send(result, be_third_criteria) - end + expect(password_class.new('hijklmmn')).not_to be_third_criteria + expect(password_class.new('abbceffg')).to be_third_criteria + expect(password_class.new('abbcegjk')).not_to be_third_criteria end it 'gives a final result' do diff --git a/year_2016/day_01.rb b/year_2016/day_01.rb index 1f16add..bef06a3 100644 --- a/year_2016/day_01.rb +++ b/year_2016/day_01.rb @@ -7,7 +7,7 @@ def initialize(input_data, input_part_one = false) @version = input_part_one ? 1 : 2 @direction = 0 @position = [0, 0] - @visited = Set.new([0, 0]) + @visited = Set.new(@position) do_all_moves(input_data) end