Lint: SpaceAroundOperators: AllowForAlignment: false

This commit is contained in:
Jared Beck 2016-04-09 00:31:44 -04:00
parent 0bb765289e
commit e7b73cc4ba
11 changed files with 34 additions and 29 deletions

View File

@ -93,3 +93,8 @@ Style/PredicateName:
# performance implications. Double quotes are slightly easier to read.
Style/StringLiterals:
EnforcedStyle: double_quotes
# Use exactly one space on each side of an operator. Do not align operators
# because it makes the code harder to edit, and makes lines unnecessarily long.
Style/SpaceAroundOperators:
AllowForAlignment: false

View File

@ -14,7 +14,7 @@ module PaperTrail
# Variables which affect all threads, whose access is *not* synchronized.
@timestamp_field = :created_at
@serializer = PaperTrail::Serializers::YAML
@serializer = PaperTrail::Serializers::YAML
end
def serialized_attributes

View File

@ -555,7 +555,7 @@ module PaperTrail
end
def save_version?
if_condition = paper_trail_options[:if]
if_condition = paper_trail_options[:if]
unless_condition = paper_trail_options[:unless]
(if_condition.blank? || if_condition.call(self)) && !unless_condition.try(:call, self)
end

View File

@ -2,8 +2,8 @@ module PaperTrail
module VERSION
MAJOR = 5
MINOR = 0
TINY = 0
PRE = "pre".freeze
TINY = 0
PRE = "pre".freeze
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".").freeze

View File

@ -2,19 +2,19 @@ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
require "paper_trail/version_number"
Gem::Specification.new do |s|
s.name = "paper_trail"
s.version = PaperTrail::VERSION::STRING
s.platform = Gem::Platform::RUBY
s.summary = "Track changes to your models' data. Good for auditing or versioning."
s.description = s.summary
s.homepage = "https://github.com/airblade/paper_trail"
s.authors = ["Andy Stewart", "Ben Atkins"]
s.email = "batkinz@gmail.com"
s.license = "MIT"
s.name = "paper_trail"
s.version = PaperTrail::VERSION::STRING
s.platform = Gem::Platform::RUBY
s.summary = "Track changes to your models' data. Good for auditing or versioning."
s.description = s.summary
s.homepage = "https://github.com/airblade/paper_trail"
s.authors = ["Andy Stewart", "Ben Atkins"]
s.email = "batkinz@gmail.com"
s.license = "MIT"
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
s.require_paths = ["lib"]
s.required_rubygems_version = ">= 1.3.6"

View File

@ -10,7 +10,7 @@ Dummy::Application.configure do
config.eager_load = false
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send

View File

@ -11,7 +11,7 @@ Dummy::Application.configure do
config.eager_load = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)

View File

@ -27,7 +27,7 @@ Dummy::Application.configure do
end
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates

View File

@ -64,7 +64,7 @@ module ActiveSupport
# Adjust timestamps for missing fractional seconds precision.
%w(created_at updated_at).each do |timestamp|
expected[timestamp] = expected[timestamp].change(usec: 0)
actual[timestamp] = actual[timestamp].change(usec: 0)
actual[timestamp] = actual[timestamp].change(usec: 0)
end
end
@ -79,7 +79,7 @@ module ActiveSupport
# Adjust timestamps for missing fractional seconds precision.
%w(created_at updated_at).each do |timestamp|
expected[timestamp][1] = expected[timestamp][1].change(usec: 0)
actual[timestamp][1] = actual[timestamp][1].change(usec: 0)
actual[timestamp][1] = actual[timestamp][1].change(usec: 0)
end
end

View File

@ -275,10 +275,10 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase
# to test.
changes = {
"name" => [nil, "Henry"],
"name" => [nil, "Henry"],
"created_at" => [nil, @widget.created_at.to_time.utc],
"updated_at" => [nil, @widget.updated_at.to_time.utc],
"id" => [nil, @widget.id]
"id" => [nil, @widget.id]
}
assert_kind_of Time, @widget.versions.last.changeset["updated_at"][1]
@ -754,8 +754,8 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase
context "which were created over time" do
setup do
@created = 2.days.ago
@first_update = 1.day.ago
@created = 2.days.ago
@first_update = 1.day.ago
@second_update = 1.hour.ago
@widget.versions[0].update_attributes created_at: @created
@widget.versions[1].update_attributes created_at: @first_update
@ -980,7 +980,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase
@widget = Widget.create name: "Bob"
%w(Tom Dick Jane).each { |name| @widget.update_attributes name: name }
@second_widget = @widget.versions[1].reify # first widget is `nil`
@last_widget = @widget.versions.last.reify
@last_widget = @widget.versions.last.reify
end
should "have a previous version" do
@ -997,7 +997,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase
context ":has_many :through" do
setup do
@book = Book.create title: "War and Peace"
@dostoyevsky = Person.create name: "Dostoyevsky"
@dostoyevsky = Person.create name: "Dostoyevsky"
@solzhenitsyn = Person.create name: "Solzhenitsyn"
end

View File

@ -65,7 +65,7 @@ class SerializerTest < ActiveSupport::TestCase
should "store object_changes" do
initial_changeset = { "name" => [nil, "Some text."], "id" => [nil, @fluxor.id] }
second_changeset = { "name" => ["Some text.", "Some more text."] }
second_changeset = { "name" => ["Some text.", "Some more text."] }
assert_equal initial_changeset, @fluxor.versions[0].changeset
assert_equal second_changeset, @fluxor.versions[1].changeset
end
@ -110,7 +110,7 @@ class SerializerTest < ActiveSupport::TestCase
should "store object_changes" do
initial_changeset = { "id" => [nil, @fluxor.id] }
second_changeset = { "name" => [nil, "Some more text."] }
second_changeset = { "name" => [nil, "Some more text."] }
assert_equal initial_changeset, @fluxor.versions[0].changeset
assert_equal second_changeset, @fluxor.versions[1].changeset
end