title: How can I set a scope variable, test a controller, then change the scope variable and re-load the controller?
body: <p>I have something like this in my controller code.</p>
  
  <pre><code>$scope.parsedDisabled = $scope.isDisabled === 'true' ? true : false;
  </code></pre>
  
  <p>This isn't run inside any sort of function, it's the first line of code run when the controller gets created. </p>
  
  <p>So when I'm doing my unit tests I have something like this:</p>
  
  <pre><code>beforeEach(inject(function ($rootScope, $controller, $filter) {
          scope = $rootScope.$new();
          filter = $filter;
          scope.isDisabled = 'true';
          controller = $controller('toggleRadioController', {
              $scope: scope
          });
      }));
  
      describe('test stuff', function(){
          it('Should set to true', function(){
              expect(scope.parsedDisabled).toBe(true);
          });
      });
  </code></pre>
  
  <p>So this is all well and good, but then I want to be able to run that same test, but with scope.isDisabled set to <code>'false'</code>, and then again with it set to <code>undefined</code>. My issue here is that this obviously needs to be changed to false and undefined <em>before</em> the controller is actually loaded, and I don't know how to do that in this case. I've tried screwing around with nested <code>beforeEach()</code>'s but I can't get it to work.</p>