var Brew = require('./brew');
var expect = require('chai').expect;

describe('Brew model', function() {
  describe('get actual phase', function() {
    it('should find the phase in progress', function() {
      var brew = new Brew({
        name: 'Very IPA',
        startDate: new Date(),
        phases: [{
          min: 10,
          temp: 50,
          status: 'active'
        }, {
          min: 20,
          temp: 70,
          status: 'scheduled'
        }]
      });

      var actual = brew.getActualPhase();
      expect(actual).to.be.eql({
        min: 10,
        temp: 50,
        status: 'active'
      });
    });

    it('should handle when there is no phase in progress', function() {
      var brew = new Brew({
        name: 'Very IPA',
        startDate: new Date(),
        phases: [{
          min: 10,
          temp: 50,
          status: 'scheduled'
        }, {
          min: 20,
          temp: 70,
          status: 'scheduled'
        }]
      });

      var actual = brew.getActualPhase();
      expect(actual).to.be.undefined;
    });
  });
});

@@ -23,16 +23,56 @@
 brew');%0A
+var BrewPhase = require('./BrewPhase');%0A
 var expe
@@ -240,36 +240,43 @@
 n() %7B%0A      var 
-brew
+actualPhase
  = new Brew(%7B%0A  
@@ -262,32 +262,37 @@
 Phase = new Brew
+Phase
 (%7B%0A        name:
@@ -290,78 +290,114 @@
     
-name: 'Very IPA',%0A        startDate: new Date(),%0A        phases: %5B%7B%0A  
+min: 10,%0A        temp: 50,%0A        status: 'active'%0A      %7D);%0A%0A      var scheduledPhase = new BrewPhase(%7B%0A
     
@@ -397,38 +397,36 @@
 (%7B%0A        min: 
-1
+2
 0,%0A
-  
         temp: 50
@@ -415,38 +415,36 @@
 ,%0A        temp: 
-5
+7
 0,%0A
-  
         status: 
@@ -448,107 +448,159 @@
 s: '
-active'%0A        %7D, %7B%0A          min: 20,%0A          temp: 70,%0A          status: 'scheduled'%0A        %7D
+scheduled'%0A      %7D);%0A%0A      var brew = new Brew(%7B%0A        name: 'Very IPA',%0A        startDate: new Date(),%0A        phases: %5BactualPhase, scheduledPhase
 %5D%0A  
@@ -685,77 +685,19 @@
 eql(
-%7B%0A        min: 10,%0A        temp: 50,%0A        status: 'active'%0A      %7D
+actualPhase
 );%0A 
@@ -778,36 +778,47 @@
 n() %7B%0A      var 
-brew
+scheduledPhase1
  = new Brew(%7B%0A  
@@ -804,32 +804,37 @@
 hase1 = new Brew
+Phase
 (%7B%0A        name:
@@ -832,78 +832,118 @@
     
-name: 'Very IPA',%0A        startDate: new Date(),%0A        phases: %5B%7B%0A  
+min: 10,%0A        temp: 50,%0A        status: 'scheduled'%0A      %7D);%0A%0A      var scheduledPhase2 = new BrewPhase(%7B%0A
     
@@ -943,33 +943,33 @@
 (%7B%0A        min: 
-1
+2
 0,%0A          tem
@@ -959,38 +959,34 @@
 20,%0A        
-  
 temp: 
-5
+7
 0,%0A
-  
         stat
@@ -1011,52 +1011,96 @@
     
-  %7D, %7B%0A          min: 20,%0A          temp: 70
+%7D);%0A%0A      var brew = new Brew(%7B%0A        name: 'Very IPA',%0A        startDate: new Date()
 ,%0A  
@@ -1101,35 +1101,33 @@
 (),%0A        
-  status: '
+phases: %5B
 scheduled'%0A 
@@ -1127,19 +1127,31 @@
 uled
-'%0A        %7D
+Phase1, scheduledPhase2
 %5D%0A  

Use BrewPhase in Brew tests