diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 9719dabb9c..45c03eb60e 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -34,10 +34,6 @@ Metrics/PerceivedComplexity: RSpec/ExampleLength: Max: 38 -RSpec/ExpectInHook: - Exclude: - - 'spec/money_spec.rb' - RSpec/IdenticalEqualityAssertion: Exclude: - 'spec/currency_spec.rb' @@ -52,9 +48,6 @@ RSpec/InstanceVariable: - 'spec/money/formatting_spec.rb' - 'spec/money_spec.rb' -RSpec/MultipleExpectations: - Max: 18 - # Configuration parameters: AllowedGroups. RSpec/NestedGroups: Max: 5 @@ -79,13 +72,6 @@ RSpec/SpecFilePathFormat: - 'spec/locale_backend/i18n_spec.rb' - 'spec/rates_store/memory_spec.rb' -RSpec/StubbedMock: - Exclude: - - 'spec/bank/variable_exchange_spec.rb' - - 'spec/money/arithmetic_spec.rb' - - 'spec/money/formatting_spec.rb' - - 'spec/money_spec.rb' - # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames. RSpec/VerifiedDoubles: Exclude: @@ -157,13 +143,6 @@ Style/IfInsideElse: Exclude: - 'lib/money/bank/variable_exchange.rb' -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: line_count_dependent, lambda, literal -Style/Lambda: - Exclude: - - 'spec/money_spec.rb' - # This cop supports unsafe autocorrection (--autocorrect-all). Style/MapIntoArray: Exclude: @@ -187,13 +166,6 @@ Style/PercentLiteralDelimiters: Exclude: - 'spec/money/arithmetic_spec.rb' -# This cop supports safe autocorrection (--autocorrect). -Style/Proc: - Exclude: - - 'spec/bank/base_spec.rb' - - 'spec/bank/variable_exchange_spec.rb' - - 'spec/money/formatting_spec.rb' - # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: AllowedMethods, AllowedPatterns. Style/ReturnNilInPredicateMethodDefinition: @@ -220,15 +192,6 @@ Style/Semicolon: Style/StringLiterals: Enabled: false -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments. -# AllowedMethods: define_method -Style/SymbolProc: - Exclude: - - 'spec/bank/base_spec.rb' - - 'spec/bank/variable_exchange_spec.rb' - - 'spec/currency_spec.rb' - # This cop supports safe autocorrection (--autocorrect). Style/WhileUntilDo: Exclude: diff --git a/spec/bank/base_spec.rb b/spec/bank/base_spec.rb index f6de49b2a8..d5d39c626d 100644 --- a/spec/bank/base_spec.rb +++ b/spec/bank/base_spec.rb @@ -12,7 +12,7 @@ describe "#initialize" do it "accepts a block and stores @rounding_method" do - proc = Proc.new { |n| n.ceil } + proc = proc(&:ceil) bank = described_class.new(&proc) expect(bank.rounding_method).to eq proc end diff --git a/spec/bank/variable_exchange_spec.rb b/spec/bank/variable_exchange_spec.rb index 281a2b296d..ee8669529a 100644 --- a/spec/bank/variable_exchange_spec.rb +++ b/spec/bank/variable_exchange_spec.rb @@ -67,7 +67,7 @@ # end it "accepts a custom truncation method" do - proc = Proc.new { |n| n.ceil } + proc = proc(&:ceil) expect(bank.exchange_with(Money.new(10, 'USD'), 'EUR', &proc)).to eq Money.new(14, 'EUR') end @@ -89,7 +89,7 @@ context "with &block" do let(:bank) do - proc = Proc.new { |n| n.ceil } + proc = proc(&:ceil) described_class.new(&proc).tap do |bank| bank.add_rate('USD', 'EUR', 1.33) end @@ -101,7 +101,7 @@ end it "accepts a custom truncation method" do - proc = Proc.new { |n| n.ceil + 1 } + proc = proc { |n| n.ceil + 1 } expect(bank.exchange_with(Money.new(10, 'USD'), 'EUR', &proc)).to eq Money.new(15, 'EUR') end end diff --git a/spec/currency_spec.rb b/spec/currency_spec.rb index 46b2c5ce7f..5b1c85194f 100644 --- a/spec/currency_spec.rb +++ b/spec/currency_spec.rb @@ -447,7 +447,7 @@ def to_s it "doesn't create new symbols indefinitely" do expect { described_class.new("bogus") }.to raise_error(described_class::UnknownCurrency) - expect(Symbol.all_symbols.map { |s| s.to_s }).not_to include("bogus") + expect(Symbol.all_symbols.map(&:to_s)).not_to include("bogus") end end diff --git a/spec/money/formatting_spec.rb b/spec/money/formatting_spec.rb index 36e1669a44..cff30a0884 100644 --- a/spec/money/formatting_spec.rb +++ b/spec/money/formatting_spec.rb @@ -147,7 +147,7 @@ end it "respects the thousands_separator and decimal_mark defaults" do - one_thousand = Proc.new do |currency| + one_thousand = proc do |currency| Money.new(1000_00, currency).format end @@ -290,7 +290,7 @@ end specify "(symbol: true) returns symbol based on the given currency code" do - one = Proc.new do |currency| + one = proc do |currency| Money.new(100, currency).format(symbol: true) end diff --git a/spec/money_spec.rb b/spec/money_spec.rb index fe5343b0e6..5e042e5179 100644 --- a/spec/money_spec.rb +++ b/spec/money_spec.rb @@ -1105,7 +1105,7 @@ end it "accepts a lambda" do - Money.default_currency = lambda { :eur } + Money.default_currency = -> { :eur } expect(Money.default_currency).to eq Money::Currency.new(:eur) end @@ -1132,7 +1132,7 @@ end it 'accepts a lambda' do - Money.default_bank = lambda { Money::Bank::SingleCurrency.instance } + Money.default_bank = -> { Money::Bank::SingleCurrency.instance } expect(Money.default_bank).to be_instance_of(Money::Bank::SingleCurrency) end end