Skip to content

Commit

Permalink
Add rubocop-performance, rubocop-rake and rubocop-rspec.
Browse files Browse the repository at this point in the history
Fix some violations.
  • Loading branch information
ppostma committed Dec 6, 2024
1 parent 06fb407 commit 596cda2
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 16 deletions.
24 changes: 24 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
require:
- rubocop-performance
- rubocop-rake
- rubocop-rspec

AllCops:
TargetRubyVersion: 3.0
DisplayCopNames: true
Expand Down Expand Up @@ -27,6 +32,25 @@ Metrics/MethodLength:
Enabled: false


RSpec/DescribedClass:
Enabled: false

RSpec/ExampleLength:
Enabled: false

RSpec/MultipleMemoizedHelpers:
Enabled: false

RSpec/NamedSubject:
Enabled: false

RSpec/NestedGroups:
Enabled: false

RSpec/SpecFilePathFormat:
Enabled: false


Style/AccessorGrouping:
Enabled: false

Expand Down
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ gemspec

group :development, :test do
gem 'rubocop', '~> 1.69'
gem 'rubocop-performance', '~> 1.20'
gem 'rubocop-rake', '~> 0.6'
gem 'rubocop-rspec', '~> 3.0'

gem 'rspec', '~> 3.13.0'
gem 'timecop', '~> 0.9.1'
Expand Down
10 changes: 10 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ GEM
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.36.2)
parser (>= 3.3.1.0)
rubocop-performance (1.23.0)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (3.2.0)
rubocop (~> 1.61)
ruby-progressbar (1.13.0)
timecop (0.9.10)
unicode-display_width (3.1.2)
Expand All @@ -73,6 +80,9 @@ DEPENDENCIES
rake (~> 13.0)
rspec (~> 3.13.0)
rubocop (~> 1.69)
rubocop-performance (~> 1.20)
rubocop-rake (~> 0.6)
rubocop-rspec (~> 3.0)
timecop (~> 0.9.1)
webmock (~> 3.24.0)

Expand Down
2 changes: 1 addition & 1 deletion spec/client_spec.rb → spec/omnikassa2/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe Omnikassa2::Client do
describe '#status_pull' do
before(:each) do
before do
Timecop.freeze Time.parse('2016-11-24T17:30:00.000+0000')
end

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
end

it 'returns false' do
expect(subject.expiring?).to eq(false)
expect(subject.expiring?).to be(false)
end
end

Expand All @@ -68,7 +68,7 @@
end

it 'returns true' do
expect(subject.expiring?).to eq(true)
expect(subject.expiring?).to be(true)
end
end

Expand All @@ -82,7 +82,7 @@
end

it 'returns true' do
expect(subject.expiring?).to eq(true)
expect(subject.expiring?).to be(true)
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
subject { Omnikassa2::Notification.new(base_params) }

it 'returns true' do
expect(subject.valid_signature?(config[:signing_key])).to eq(true)
expect(subject.valid_signature?(config[:signing_key])).to be(true)
end
end

Expand All @@ -80,7 +80,7 @@
end

it 'returns false' do
expect(subject.valid_signature?(config[:signing_key])).to eq(false)
expect(subject.valid_signature?(config[:signing_key])).to be(false)
end
end
end
Expand All @@ -100,7 +100,7 @@
end

it 'returns false' do
expect(subject.expiring?).to eq(false)
expect(subject.expiring?).to be(false)
end
end

Expand All @@ -114,7 +114,7 @@
end

it 'returns true' do
expect(subject.expiring?).to eq(true)
expect(subject.expiring?).to be(true)
end
end

Expand All @@ -128,7 +128,7 @@
end

it 'returns true' do
expect(subject.expiring?).to eq(true)
expect(subject.expiring?).to be(true)
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
end

it 'stores moreOrderResultsAvailable as a boolean' do
expect(subject.more_order_results_available).to eq(false)
expect(subject.more_order_results_available).to be(false)
end

it 'stores order.merchantOrderId' do
Expand Down Expand Up @@ -103,7 +103,7 @@
end

it 'returns true' do
expect(subject.valid_signature?(config[:signing_key])).to eq(true)
expect(subject.valid_signature?(config[:signing_key])).to be(true)
end
end

Expand All @@ -115,7 +115,7 @@
end

it 'returns false' do
expect(subject.valid_signature?(config[:signing_key])).to eq(false)
expect(subject.valid_signature?(config[:signing_key])).to be(false)
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require 'time'

describe Omnikassa2::OrderAnnounceRequest do
before(:each) do
before do
stub_request(:post, 'https://www.example.org/sandbox/order/server/api/v2/order').to_return(
body: {
signature: 's1gnaTuRe',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

describe Omnikassa2::RefreshRequest do
before(:each) do
before do
stub_request(:any, //).to_return(
body: {
token: 'myAccEssT0ken',
Expand Down Expand Up @@ -49,7 +49,7 @@
end

it 'contains duration_in_millis' do
expect(access_token.duration_in_millis).to eql(28_800_000)
expect(access_token.duration_in_millis).to be(28_800_000)
end
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

describe Omnikassa2::StatusPullRequest do
before(:each) do
before do
stub_request(:any, //).to_return(
body: StatusPullResponseBodyFactory.create(
{
Expand Down

0 comments on commit 596cda2

Please sign in to comment.