diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 8181c8cc..d5261777 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -5,15 +5,15 @@ Metrics/AbcSize: Max: 30 # Goal: 15 Metrics/ClassLength: - Max: 400 + Max: 327 Exclude: - test/**/* Metrics/CyclomaticComplexity: - Max: 13 # Goal: 6 + Max: 8 # Goal: 6 Metrics/ModuleLength: Max: 317 Metrics/PerceivedComplexity: - Max: 16 # Goal: 7 + Max: 10 # Goal: 7 diff --git a/paper_trail.gemspec b/paper_trail.gemspec index 3c23ab82..06a666bd 100644 --- a/paper_trail.gemspec +++ b/paper_trail.gemspec @@ -35,7 +35,7 @@ Gem::Specification.new do |s| s.add_development_dependency "generator_spec", "~> 0.9.3" s.add_development_dependency "database_cleaner", "~> 1.2" s.add_development_dependency "pry-nav", "~> 0.2.4" - s.add_development_dependency "rubocop", "~> 0.40.0" + s.add_development_dependency "rubocop", "~> 0.41.1" s.add_development_dependency "timecop", "~> 0.8.0" if defined?(JRUBY_VERSION) diff --git a/spec/models/gadget_spec.rb b/spec/models/gadget_spec.rb index 9d2632da..fa2e5074 100644 --- a/spec/models/gadget_spec.rb +++ b/spec/models/gadget_spec.rb @@ -25,7 +25,7 @@ describe Gadget, type: :model do describe "Methods" do describe "Instance", versioning: true do describe "private" do - describe '#changed_notably?' do + describe "#changed_notably?" do subject { Gadget.new(created_at: Time.now) } context "create events" do diff --git a/spec/models/joined_version_spec.rb b/spec/models/joined_version_spec.rb index aec06037..11f6c77c 100644 --- a/spec/models/joined_version_spec.rb +++ b/spec/models/joined_version_spec.rb @@ -14,19 +14,19 @@ describe JoinedVersion, type: :model, versioning: true do describe "VersionConcern::ClassMethods" do before { widget } # persist a widget - describe '#subsequent' do + describe "#subsequent" do it "shouldn't error out when there is a default_scope that joins" do JoinedVersion.subsequent(version).first end end - describe '#preceding' do + describe "#preceding" do it "shouldn't error out when there is a default scope that joins" do JoinedVersion.preceding(version).first end end - describe '#between' do + describe "#between" do it "shouldn't error out when there is a default scope that joins" do JoinedVersion.between(Time.now, 1.minute.from_now).first end @@ -35,7 +35,7 @@ describe JoinedVersion, type: :model, versioning: true do end describe "Methods" do - describe '#index' do + describe "#index" do it { is_expected.to respond_to(:index) } it "shouldn't error out when there is a default scope that joins" do diff --git a/spec/models/json_version_spec.rb b/spec/models/json_version_spec.rb index ee672325..9eebf3f6 100644 --- a/spec/models/json_version_spec.rb +++ b/spec/models/json_version_spec.rb @@ -11,7 +11,7 @@ if JsonVersion.table_exists? describe "Methods" do describe "Class" do - describe '#where_object' do + describe "#where_object" do it { expect(JsonVersion).to respond_to(:where_object) } it "escapes values" do @@ -50,7 +50,7 @@ if JsonVersion.table_exists? end end - describe '#where_object_changes' do + describe "#where_object_changes" do it { expect(JsonVersion).to respond_to(:where_object_changes) } it "escapes values" do diff --git a/spec/models/kitchen/banana_spec.rb b/spec/models/kitchen/banana_spec.rb index c30da4ea..3d02eb9a 100644 --- a/spec/models/kitchen/banana_spec.rb +++ b/spec/models/kitchen/banana_spec.rb @@ -4,7 +4,7 @@ module Kitchen describe Banana, type: :model do it { is_expected.to be_versioned } - describe '#versions' do + describe "#versions" do it "returns instances of Kitchen::BananaVersion", versioning: true do banana = described_class.create! expect(banana.versions.first).to be_a(Kitchen::BananaVersion) diff --git a/spec/models/version_spec.rb b/spec/models/version_spec.rb index c4675e24..0f2949e1 100644 --- a/spec/models/version_spec.rb +++ b/spec/models/version_spec.rb @@ -45,7 +45,7 @@ describe PaperTrail::Version, type: :model do describe "Instance" do subject { PaperTrail::Version.new } - describe '#paper_trail_originator' do + describe "#paper_trail_originator" do it { is_expected.to respond_to(:paper_trail_originator) } context "No previous versions" do @@ -89,7 +89,7 @@ describe PaperTrail::Version, type: :model do end end - describe '#terminator' do + describe "#terminator" do let(:attributes) { { whodunnit: FFaker::Name.first_name } } subject { PaperTrail::Version.new attributes } @@ -100,7 +100,7 @@ describe PaperTrail::Version, type: :model do end end - describe '#version_author' do + describe "#version_author" do it { is_expected.to respond_to(:version_author) } it "should be an alias for the `terminator` method" do @@ -140,7 +140,7 @@ describe PaperTrail::Version, type: :model do end end - describe '#where_object' do + describe "#where_object" do it { expect(PaperTrail::Version).to respond_to(:where_object) } context "invalid arguments" do @@ -205,7 +205,7 @@ describe PaperTrail::Version, type: :model do end end - describe '#where_object_changes' do + describe "#where_object_changes" do context "invalid arguments" do it "should raise an error" do expect { diff --git a/spec/models/widget_spec.rb b/spec/models/widget_spec.rb index 06a22b94..1ed09918 100644 --- a/spec/models/widget_spec.rb +++ b/spec/models/widget_spec.rb @@ -140,7 +140,7 @@ describe Widget, type: :model do describe "Methods" do describe "Instance", versioning: true do - describe '#paper_trail.originator' do + describe "#paper_trail.originator" do describe "return value" do let(:orig_name) { FFaker::Name.name } let(:new_name) { FFaker::Name.name } @@ -192,7 +192,7 @@ describe Widget, type: :model do end end - describe '#version_at' do + describe "#version_at" do context "Timestamp argument is AFTER object has been destroyed" do it "should return `nil`" do widget.update_attribute(:name, "foobar") @@ -202,7 +202,7 @@ describe Widget, type: :model do end end - describe '#whodunnit' do + describe "#whodunnit" do it { is_expected.to respond_to(:whodunnit) } context "no block given" do @@ -250,7 +250,7 @@ describe Widget, type: :model do end end - describe '#touch_with_version' do + describe "#touch_with_version" do it "creates a version" do count = widget.versions.size # Travel 1 second because MySQL lacks sub-second resolution diff --git a/spec/modules/paper_trail_spec.rb b/spec/modules/paper_trail_spec.rb index ac83ae66..4bf9fe6e 100644 --- a/spec/modules/paper_trail_spec.rb +++ b/spec/modules/paper_trail_spec.rb @@ -1,7 +1,7 @@ require "rails_helper" describe PaperTrail, type: :module, versioning: true do - describe '#config' do + describe "#config" do it { is_expected.to respond_to(:config) } it "should allow for config values to be set" do @@ -17,7 +17,7 @@ describe PaperTrail, type: :module, versioning: true do end end - describe '#configure' do + describe "#configure" do it { is_expected.to respond_to(:configure) } it "should be an alias for the `config` method" do diff --git a/spec/modules/version_number_spec.rb b/spec/modules/version_number_spec.rb index 2514b131..ca60dda5 100644 --- a/spec/modules/version_number_spec.rb +++ b/spec/modules/version_number_spec.rb @@ -36,7 +36,7 @@ describe PaperTrail::VERSION do end describe PaperTrail do - describe '#version' do + describe "#version" do it { is_expected.to respond_to(:version) } it { expect(subject.version).to eq(PaperTrail::VERSION::STRING) } end diff --git a/test/unit/model_test.rb b/test/unit/model_test.rb index 776a43cc..c7e3be53 100644 --- a/test/unit/model_test.rb +++ b/test/unit/model_test.rb @@ -943,7 +943,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase context "A reified item" do setup do widget = Widget.create name: "Bob" - %w( Tom Dick Jane ).each { |name| widget.update_attributes name: name } + %w(Tom Dick Jane).each { |name| widget.update_attributes name: name } @version = widget.versions.last @widget = @version.reify end @@ -972,7 +972,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase context "with versions" do setup do @widget.save - %w( Tom Dick Jane ).each { |name| @widget.update_attributes name: name } + %w(Tom Dick Jane).each { |name| @widget.update_attributes name: name } end should "have a previous version" do @@ -1405,7 +1405,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase context "A reified item with a column -version- and custom version_method" do setup do widget = LegacyWidget.create(name: "foo", version: 2) - %w( bar baz ).each { |name| widget.update_attributes name: name } + %w(bar baz).each { |name| widget.update_attributes name: name } @version = widget.versions.last @widget = @version.reify end