/**
  * Update the specified group in storage.
  *
  * @param int $id
  */
 public function update($id)
 {
     $input = array('name' => Input::get('name'), 'permissions' => Input::get('permissions', array()));
     if ($this->groups->update($id, $input)) {
         return Redirect::route('groups.index');
     }
     return Redirect::route('groups.index')->with(array('not_updated' => $this->groups->getError()));
 }
 public function testUpdate()
 {
     $obj = (object) array('name' => 'Admin', 'permissions' => '');
     $mock = m::mock($obj);
     $mock->shouldReceive('save')->once()->andReturn(true);
     Sentry::shouldReceive('findGroupById')->with(1)->once()->andReturn($mock);
     $this->assertTrue($this->groups->update(1, array('name' => 'Root', 'permissions' => '{"user.create":1}')));
     Sentry::shouldReceive('findGroupById')->once()->andThrow('Cartalyst\\Sentry\\Groups\\GroupExistsException');
     $this->assertFalse($this->groups->update(1, array('name' => 'Member')));
     Sentry::shouldReceive('findGroupById')->once()->andThrow('Cartalyst\\Sentry\\Groups\\GroupNotFoundException');
     $this->assertFalse($this->groups->update(10, array()));
 }