On 23/01/12 17:29 +0100, mzatko(a)redhat.com wrote:
From: Maros Zatko <mzatko(a)redhat.com>
---
src/spec/models/provider_account_spec.rb | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/src/spec/models/provider_account_spec.rb
b/src/spec/models/provider_account_spec.rb
index 53b4872..2fa2cf1 100644
--- a/src/spec/models/provider_account_spec.rb
+++ b/src/spec/models/provider_account_spec.rb
@@ -152,4 +152,34 @@ describe ProviderAccount do
@provider_account.quota = nil
@provider_account.should_not be_valid
end
+
+ context "validations" do
+ context "priority" do
+ it "can be positive integer" do
+ @provider_account.priority = 7
+ @provider_account.should be_valid
+ end
+
+ it "can be negative integer" do
+ @provider_account.priority = -32767
+ @provider_account.should be_valid
+ end
+
+ it "can be zero" do
+ @provider_account.priority = 0
+ @provider_account.should be_valid
+ end
+
+ it "can be blank" do
+ @provider_account.priority = ''
+ @provider_account.should be_valid
+ end
+
+ it "can't be text" do
+ @provider_account.priority = '(*&^$@!lkajsd'
+ @provider_account.should_not be_valid
+ end
+ end
+ end
+
end
--
1.7.7.5
I have not tested this, but it is a good example of something I was
trying to say the other day. This appears to be a simple/standard
rails built-in validation, in which case there is no need to test that
it works - the rails project already takes care of this testing. The
basic premise is that we shoudl never be testing the code of a library
or framework we use. It leads to brittle tests on our side (there was
a similar one recently for a validation of how many characters are
allowed in a given field, which I also proposed we just remove).
Net, this BZ should merely need the validation added, no tests.
-j