Project

General

Profile

Refactor #12147

move rails3 compatible changes from the rails4 branch to develop

Added by Tom Caspy almost 4 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Rails
Target version:
Team Backlog:
Fixed in Releases:
Found in Releases:

Related issues

Related to Foreman - Bug #12278: Foreman fails when creating a role if default user has 2 or more filters with same permissionClosed2015-10-23

Associated revisions

Revision f531e4af (diff)
Added by Tom Caspy almost 4 years ago

refs #12147 - updating cycle test to comply with rails4

Using a custom Edge class with validations to act as any other ActiveModel instead of mimicking ActiveModel using an errors array on the OpenStruct

Revision 46f6f2c3 (diff)
Added by Tom Caspy almost 4 years ago

refs #12147 - factory updates for medium - rails4 compatibility

Revision 251eb689 (diff)
Added by Tom Caspy almost 4 years ago

refs #12147 - removing informational print from rake task in tests

Revision 93e9d22d (diff)
Added by Tom Caspy almost 4 years ago

refs #12147 - fixing dhcp test to work properly with rails 4

In rails 4, the #reload method doesn't reset instance variables on the
reloaded instance, so we fetch it again as a new item. That said, the
reload method does work correctly for associations, just to be
consistent. Updated test to work for both rails 3 and 4.

Revision 44dffec9 (diff)
Added by Tom Caspy almost 4 years ago

refs #12147 - task#as_json should return hash

ActiveSupport 4 does not add the as_json method on all objects, thus,
this doesn't work on rails 4, for compatibility we use same syntax in
rails 3.

Revision e4d969a1 (diff)
Added by Tom Caspy almost 4 years ago

refs #12147 - correcting route for unattended controller

Revision 7bfc21fc (diff)
Added by Tom Caspy almost 4 years ago

refs #12147 - adding safety guards to method_missing on compute attributes

There's no need to pass to vm_atts when the method is a setter, also,
there's no need to pass if vm_attrs is blank. Those safety guards are
required in rails4, and compatible with 3.

Revision 1f5d2516 (diff)
Added by Tom Caspy almost 4 years ago

refs #12147 - adding permissions setter to roles

Problem

Calling FactoryGirl.build(:role, :permissions => []) needs a setter
directly on role. Otherwise it fails on Rails 4 with:
ActiveRecord::HasManyThroughNestedAssociationsAreReadonly: Cannot modify
association 'Role#permissions' because it goes through more than one
other association.

Solution

Add a setter for permissions in role.rb. It's compatible with Rails 3
and 4.

Revision 768aad03 (diff)
Added by Tom Caspy almost 4 years ago

refs #12147 - compatible test updates for api fact value controller

Revision 33a47095 (diff)
Added by Daniel Lobato Garcia almost 4 years ago

Refs #12147 - Remove trends output from tests

Removes the rest of trends output from tests, since ad4db10 only removes
the first part.

Revision 3b84be4f (diff)
Added by Tom Caspy almost 4 years ago

refs #12147 - making sure that rails4 seeds think they are in rake

seeds depend on the in_rake? method, in rails 4 that method returns
false in tests, thus, we stub it so seeds think they're running properly

History

#1 Updated by The Foreman Bot almost 4 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/2814 added
  • Pull request deleted ()

#6 Updated by Marek Hulán almost 4 years ago

  • Related to Bug #12278: Foreman fails when creating a role if default user has 2 or more filters with same permission added

#8 Updated by The Foreman Bot almost 4 years ago

  • Pull request https://github.com/theforeman/foreman/pull/2828 added

#9 Updated by Dominic Cleal over 3 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF