Skip to content

Commit

Permalink
Lint: SpaceAroundOperators: AllowForAlignment: false
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredbeck committed Apr 9, 2016
1 parent 0bb7652 commit e7b73cc
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 29 deletions.
5 changes: 5 additions & 0 deletions .rubocop.yml
Expand Up @@ -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
2 changes: 1 addition & 1 deletion lib/paper_trail/config.rb
Expand Up @@ -14,7 +14,7 @@ def initialize

# 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
Expand Down
2 changes: 1 addition & 1 deletion lib/paper_trail/has_paper_trail.rb
Expand Up @@ -555,7 +555,7 @@ def paper_trail_switched_on?
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
Expand Down
4 changes: 2 additions & 2 deletions lib/paper_trail/version_number.rb
Expand Up @@ -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

Expand Down
24 changes: 12 additions & 12 deletions paper_trail.gemspec
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion test/dummy/config/environments/development.rb
Expand Up @@ -10,7 +10,7 @@
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
Expand Down
2 changes: 1 addition & 1 deletion test/dummy/config/environments/production.rb
Expand Up @@ -11,7 +11,7 @@
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)
Expand Down
2 changes: 1 addition & 1 deletion test/dummy/config/environments/test.rb
Expand Up @@ -27,7 +27,7 @@
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
Expand Down
4 changes: 2 additions & 2 deletions test/test_helper.rb
Expand Up @@ -64,7 +64,7 @@ def assert_attributes_equal(expected, actual)
# 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

Expand All @@ -79,7 +79,7 @@ def assert_changes_equal(expected, actual)
# 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

Expand Down
12 changes: 6 additions & 6 deletions test/unit/model_test.rb
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions test/unit/serializer_test.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e7b73cc

Please sign in to comment.