From 30f5ba9a1210b3363067309f9374a6ba65e0861e Mon Sep 17 00:00:00 2001 From: Fabio Teixeira Date: Fri, 26 Sep 2014 18:47:08 -0300 Subject: [PATCH] correcoes_aderencia: Unit test for person full name validation --- test/unit/mpog_person_test.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+), 0 deletions(-) create mode 100644 test/unit/mpog_person_test.rb diff --git a/test/unit/mpog_person_test.rb b/test/unit/mpog_person_test.rb new file mode 100644 index 0000000..7179827 --- /dev/null +++ b/test/unit/mpog_person_test.rb @@ -0,0 +1,21 @@ +require File.dirname(__FILE__) + '/../../../../test/test_helper' + +class MpogSoftwarePluginPersonTest < ActiveSupport::TestCase + should 'save person with a valid full name' do + p = Person::new :name=>"S1mpl3 N4m3", :identifier=>"simple-name" + p.user = fast_create(:user) + + assert_equal true, p.save + end + + should 'not save person whose name has not capital letter' do + p = Person::new :name=>"simple name" + assert !p.save, _("Name Should begin with a capital letter and no special characters") + end + + should 'not save person whose name has special characters' do + p = Person::new :name=>"Simple N@me" + + assert !p.save , _("Name Should begin with a capital letter and no special characters") + end +end \ No newline at end of file -- libgit2 0.21.2