diff --git a/app/models/role.rb b/app/models/role.rb index 63eaf0b..73048cc 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -15,9 +15,6 @@ column: 'access' validates :user, :plan, :access, presence: true - validates :access, one_role_per_user_plan: true - -# TODO: Do we really want to force the save in these 2 methods? ## # return the access level for the current project group @@ -34,7 +31,6 @@ else return 1 end - self.save! end ## @@ -55,9 +51,5 @@ else self.editor = false end - -puts self.inspect - - self.save! end end diff --git a/test/unit/role_test.rb b/test/unit/role_test.rb index 937ae8d..7797783 100644 --- a/test/unit/role_test.rb +++ b/test/unit/role_test.rb @@ -24,17 +24,7 @@ end # --------------------------------------------------- - test "cannot have more than one role per User+Plan" do - @user.roles << Role.new(plan: @plan, access: 2) - assert_not @user.valid?, "Expected to NOT be able to add more than one role for the same user/plan" - - plan = Plan.create(title: 'Test Plan', template: Template.last) - @user.roles << Role.new(plan: plan, access: 3) - assert @user.valid?, "Expected to be able to add a role for the same user but a different plan" - end - - # --------------------------------------------------- - test "access_level acts a proxy to the 'access' flagshihtzu bit flag field" do + test "access_level acts a proxy to the 'access' FlagShihTzu bit flag field" do puts @role.inspect