Merge pull request #767 from airblade/rubocop_class_and_module_children2
Fix Style/ClassAndModuleChildren offense
This commit is contained in:
commit
38b1063371
|
@ -31,12 +31,6 @@ Style/Alias:
|
|||
- 'test/dummy/app/models/song.rb'
|
||||
- 'test/unit/model_test.rb'
|
||||
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
# SupportedStyles: nested, compact
|
||||
Style/ClassAndModuleChildren:
|
||||
Exclude:
|
||||
- 'test/unit/ar_id_map_test.rb'
|
||||
|
||||
# Offense count: 33
|
||||
Style/Documentation:
|
||||
Enabled: false
|
||||
|
|
|
@ -126,6 +126,17 @@ describe Widget, type: :model do
|
|||
end
|
||||
end
|
||||
|
||||
if defined?(ActiveRecord::IdentityMap) && ActiveRecord::IdentityMap.respond_to?(:without)
|
||||
describe "IdentityMap", versioning: true do
|
||||
it "should not clobber the IdentityMap when reifying" do
|
||||
widget.update_attributes name: "Henry", created_at: Time.now - 1.day
|
||||
widget.update_attributes name: "Harry"
|
||||
expect(ActiveRecord::IdentityMap).to receive(:without).once
|
||||
widget.versions.last.reify
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "Methods" do
|
||||
describe "Instance", versioning: true do
|
||||
describe '#paper_trail_originator' do
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
require "test_helper"
|
||||
|
||||
class ARIdMapTest < ActiveSupport::TestCase
|
||||
setup do
|
||||
@widget = Widget.new
|
||||
@widget.update_attributes name: "Henry", created_at: Time.now - 1.day
|
||||
@widget.update_attributes name: "Harry"
|
||||
end
|
||||
|
||||
if defined?(ActiveRecord::IdentityMap) && ActiveRecord::IdentityMap.respond_to?(:without)
|
||||
should "not clobber the IdentityMap when reifying" do
|
||||
module ActiveRecord::IdentityMap
|
||||
class << self
|
||||
alias __without without
|
||||
def without(&block)
|
||||
@unclobbered = true
|
||||
__without(&block)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@widget.versions.last.reify
|
||||
assert ActiveRecord::IdentityMap.instance_variable_get("@unclobbered")
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue