Commit dd2e5fc632b99f1f02792ae265bc1b0e320a5247
1 parent
36ac32c6
Exists in
master
and in
29 other branches
adding a simple profile model
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@7 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
5 changed files
with
45 additions
and
2 deletions
Show diff stats
app/models/virtual_community.rb
... | ... | @@ -2,8 +2,6 @@ class VirtualCommunity < ActiveRecord::Base |
2 | 2 | validates_presence_of :domain |
3 | 3 | validates_format_of :domain, :with => /^(\w+\.)+\w+$/ |
4 | 4 | |
5 | - validates_presence_of :identifier | |
6 | - validates_format_of :identifier, :with => /^[a-z][a-z0-9_]+[a-z0-9]$/ | |
7 | 5 | |
8 | 6 | serialize :features |
9 | 7 | def features | ... | ... |
... | ... | @@ -0,0 +1,24 @@ |
1 | +require File.dirname(__FILE__) + '/../test_helper' | |
2 | + | |
3 | +class ProfileTest < Test::Unit::TestCase | |
4 | + fixtures :profiles | |
5 | + | |
6 | + def test_identifier_validation | |
7 | + p = Profile.new | |
8 | + p.valid? | |
9 | + assert p.errors.invalid?(:identifier) | |
10 | + | |
11 | + p.identifier = 'with space' | |
12 | + p.valid? | |
13 | + assert p.errors.invalid?(:identifier) | |
14 | + | |
15 | + p.identifier = 'áéíóú' | |
16 | + p.valid? | |
17 | + assert p.errors.invalid?(:identifier) | |
18 | + | |
19 | + p.identifier = 'right_format' | |
20 | + p.valid? | |
21 | + assert ! p.errors.invalid?(:identifier) | |
22 | + | |
23 | + end | |
24 | +end | ... | ... |