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:49 PM
To: ResourceDataInc/commuter_challenge
Subject: Re: [commuter_challenge] Feedback needed for - Restrict team size (#91)


In app/models/team.rb:

>
>    scope :by_name, -> { order :name }
>
>    def to_param
>      "#{id}-#{name.parameterize}"
>    end
> +
> +  private
> +
> +  def business_size_cannot_be_lower_than_approved_memberships
> +    if self.business_size < self.memberships.approved.count
> +      errors.add(:business_size, "Cannot be lower than approved membership.")
> +    end
> +  end
> +


Delete this line.

—
Reply to this email directly or view it on GitHub<https://github.com/ResourceDataInc/commuter_challenge/pull/91/files#r15474345>.