Feedback needed for - Restrict team size

This code should accomplish two main things. 
1. Remove the ability to approve new members if the approved membership count is already the same as the business size. 
2. Remove the ability to set the business size lower than the approved count. 

The individual user should not receive errors and will be added to the team. This allows users to start tracking commutes and puts the burden on the team Captain. The Captain can the approve, deny, or edit the business size. 

I have all specs passing but only by modifying the participation calculator spec. (Adds 5 members and  business size is set at 2). I am not sure if the spec is wrong or my code. I feel that by default the status is unapproved which should in theory not be affected by my code. 

General
- [ ] Verify new code in team and membership models

Testing: 
- [ ] Verify membership_spec is written correctly. I needed to create two users. One is the default and the other is user0
- [ ] Review participation_calculator_spec if model code and validations seem correct. 





Please check that the subject line contains 'ClientId.ProjectNo.Phase.Task' and ID:

________________________________
From: Chris Thorn
Sent: Monday, July 28, 2014 4:52:30 PM
To: ResourceDataInc/commuter_challenge
Subject: Re: [commuter_challenge] Feedback needed for - Restrict team size (#91)


In app/models/membership.rb:

> @@ -23,4 +22,14 @@ def update_approved_at
>        self.approved_at = Time.now
>      end
>    end
> +
> +  def membership_cannot_exceed_business_size
> +    if team.present? && team.memberships.approved.count >= team.business_size
> +      errors.add(:memberships, "Cannot be higher than the business size")
> +    end
> +  end
> +


Delete this line.

—
Reply to this email directly or view it on GitHub<https://github.com/ResourceDataInc/commuter_challenge/pull/91/files#r15474323>.