Skip to content

Commit

Permalink
Autofix rubocop issues
Browse files Browse the repository at this point in the history
Autofix rubocop issues
  • Loading branch information
Ladas committed Mar 10, 2017
1 parent 66e9d34 commit e5e35b1
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 53 deletions.
2 changes: 1 addition & 1 deletion app/models/manager_refresh/target_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def id
def manager_refs_by_association
@manager_refs_by_association ||= targets.select { |x| x.kind_of?(ManagerRefresh::Target) }.each_with_object({}) do |x, obj|
if obj[x.association].blank?
obj[x.association] = x.manager_ref.each_with_object({}) { |(key, value), hash| hash[key] = Set.new([value])}
obj[x.association] = x.manager_ref.each_with_object({}) { |(key, value), hash| hash[key] = Set.new([value]) }
else
obj[x.association].each do |key, value|
value << x.manager_ref[key]
Expand Down
42 changes: 18 additions & 24 deletions spec/models/manager_refresh/target_collection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@

expect(target_collection.targets.first).to(
have_attributes(
{
:manager => @ems,
:manager_id => @ems.id,
:event_id => nil,
:association => :vms,
:manager_ref => {:ems_ref => @vm_1.ems_ref},
:options => {:opt1 => "opt1", :opt2 => "opt2"}
}
:manager => @ems,
:manager_id => @ems.id,
:event_id => nil,
:association => :vms,
:manager_ref => {:ems_ref => @vm_1.ems_ref},
:options => {:opt1 => "opt1", :opt2 => "opt2"}
)
)
end
Expand All @@ -52,14 +50,12 @@

expect(target_collection.targets.first).to(
have_attributes(
{
:manager => @ems,
:manager_id => @ems.id,
:event_id => @ems_event.id,
:association => :vms,
:manager_ref => {:ems_ref => @vm_1.ems_ref},
:options => {:opt1 => "opt1", :opt2 => "opt2"}
}
:manager => @ems,
:manager_id => @ems.id,
:event_id => @ems_event.id,
:association => :vms,
:manager_ref => {:ems_ref => @vm_1.ems_ref},
:options => {:opt1 => "opt1", :opt2 => "opt2"}
)
)
end
Expand All @@ -75,14 +71,12 @@

expect(target_collection.targets.first).to(
have_attributes(
{
:manager => @ems,
:manager_id => @ems.id,
:event_id => @ems_event.id,
:association => :vms,
:manager_ref => {:ems_ref => @vm_1.ems_ref},
:options => {:opt1 => "opt1", :opt2 => "opt2"}
}
:manager => @ems,
:manager_id => @ems.id,
:event_id => @ems_event.id,
:association => :vms,
:manager_ref => {:ems_ref => @vm_1.ems_ref},
:options => {:opt1 => "opt1", :opt2 => "opt2"}
)
)
end
Expand Down
48 changes: 20 additions & 28 deletions spec/models/manager_refresh/target_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@

expect(target_1).to(
have_attributes(
{
:manager => @ems,
:manager_id => @ems.id,
:association => :vms,
:manager_ref => {:ems_ref => @vm_1.ems_ref},
:options => {:opt1 => "opt1", :opt2 => "opt2"}
}
:manager => @ems,
:manager_id => @ems.id,
:association => :vms,
:manager_ref => {:ems_ref => @vm_1.ems_ref},
:options => {:opt1 => "opt1", :opt2 => "opt2"}
)
)
end
Expand All @@ -48,13 +46,11 @@

expect(target_1).to(
have_attributes(
{
:manager => @ems,
:manager_id => @ems.id,
:association => :vms,
:manager_ref => {:ems_ref => @vm_1.ems_ref},
:options => {:opt1 => "opt1", :opt2 => "opt2"}
}
:manager => @ems,
:manager_id => @ems.id,
:association => :vms,
:manager_ref => {:ems_ref => @vm_1.ems_ref},
:options => {:opt1 => "opt1", :opt2 => "opt2"}
)
)
end
Expand All @@ -80,13 +76,11 @@

expect(target_1.dump).to(
eq(
{
:manager_id => @ems.id,
:event_id => nil,
:association => :vms,
:manager_ref => {:ems_ref => @vm_1.ems_ref},
:options => {:opt1 => "opt1", :opt2 => "opt2"}
}
:manager_id => @ems.id,
:event_id => nil,
:association => :vms,
:manager_ref => {:ems_ref => @vm_1.ems_ref},
:options => {:opt1 => "opt1", :opt2 => "opt2"}
)
)
end
Expand All @@ -101,13 +95,11 @@

expect(target_1.dump).to(
eq(
{
:manager_id => @ems.id,
:event_id => nil,
:association => :vms,
:manager_ref => {:ems_ref => @vm_1.ems_ref},
:options => {:opt1 => "opt1", :opt2 => "opt2"}
}
:manager_id => @ems.id,
:event_id => nil,
:association => :vms,
:manager_ref => {:ems_ref => @vm_1.ems_ref},
:options => {:opt1 => "opt1", :opt2 => "opt2"}
)
)
end
Expand Down

0 comments on commit e5e35b1

Please sign in to comment.