Tim,
     Your suggestion for the condition statement is more readable and is
incorporated into the code now.
    As per your comment on test case, there is already a app creation test
case @spec/models/runtime/app_spec.rb:1043 context "app creation" do ...
it "should raise error when quota is exceeded" do  which covers the
scenario.




From:	Tim Labeeuw <notifications@github.com>
To:	cloudfoundry/cloud_controller_ng
            <cloud_controller_ng@noreply.github.com>
Cc:	Srinivas R Brahmaroutu/Silicon Valley/IBM@IBMUS
Date:	11/04/2013 02:27 PM
Subject:	Re: [cloud_controller_ng] Allow apps to be scaled down or
            stopped when the quota is lowered. (#119)



In app/models/runtime/app.rb:


>        if space && (space.organization.memory_remaining <
additional_memory_requested)
> -        errors.add(:memory, :quota_exceeded)
> +        errors.add(:memory, :quota_exceeded) unless !new? &&
being_stopped?



There is no test for why we need the unless new?.
Furthermore a positive statement would be clearer here if new?
|| !being_stopped?


—
Reply to this email directly or view it on GitHub.