Commit 3c93f5c072cd28983a404e178cd81a1d01aaae58

Authored by Fabio Teixeira
1 parent 82748c1c

Fix broken unit, cucumber tests

Signed-off-by: Brenddon Gontijo <brenddongontijo@msn.com>
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
Signed-off-by: Gabriela Navarro <navarro1703@gmail.com>
features/steps_definitions/gov_user_steps.rb
@@ -66,7 +66,6 @@ Given /^the following public institutions?$/ do |table| @@ -66,7 +66,6 @@ Given /^the following public institutions?$/ do |table|
66 end 66 end
67 end 67 end
68 68
69 -  
70 Given /^I sleep for (\d+) seconds$/ do |time| 69 Given /^I sleep for (\d+) seconds$/ do |time|
71 sleep time.to_i 70 sleep time.to_i
72 end 71 end
@@ -87,4 +86,5 @@ Given /^I am logged in as mpog_admin$/ do @@ -87,4 +86,5 @@ Given /^I am logged in as mpog_admin$/ do
87 fill_in("Username", :with => user.login) 86 fill_in("Username", :with => user.login)
88 fill_in("Password", :with => '123456') 87 fill_in("Password", :with => '123456')
89 click_button("Log in") 88 click_button("Log in")
90 -end  
91 \ No newline at end of file 89 \ No newline at end of file
  90 +end
  91 +
test/unit/gov_user_person_test.rb
@@ -15,6 +15,7 @@ class SoftwareCommunitiesPluginPersonTest &lt; ActiveSupport::TestCase @@ -15,6 +15,7 @@ class SoftwareCommunitiesPluginPersonTest &lt; ActiveSupport::TestCase
15 "user@email.com", 15 "user@email.com",
16 "123456", 16 "123456",
17 "123456", 17 "123456",
  18 + "user2@email.com",
18 "Any State", 19 "Any State",
19 "Some City" 20 "Some City"
20 ) 21 )
test/unit/institution_test.rb
@@ -29,34 +29,35 @@ class InstitutionTest &lt; ActiveSupport::TestCase @@ -29,34 +29,35 @@ class InstitutionTest &lt; ActiveSupport::TestCase
29 end 29 end
30 should "not save institutions without name" do 30 should "not save institutions without name" do
31 @institution.name = nil 31 @institution.name = nil
32 - assert !@institution.save  
33 - assert @institution.errors.full_messages.include? "Name can't be blank" 32 + assert_equal false, @institution.save
  33 + assert_equal true, @institution.errors.full_messages.include?("Name can't be blank")
34 end 34 end
35 35
36 should "not save if institution has invalid type" do 36 should "not save if institution has invalid type" do
37 invalid_msg = "Type invalid, only public and private institutions are allowed." 37 invalid_msg = "Type invalid, only public and private institutions are allowed."
38 @institution.type = "Other type" 38 @institution.type = "Other type"
39 - assert !@institution.save, 'Invalid type'  
40 - assert @institution.errors.full_messages.include? invalid_msg 39 + assert_equal false, @institution.save
  40 + assert_equal true, @institution.errors.full_messages.include?(invalid_msg)
41 end 41 end
42 42
43 should "not save without country" do 43 should "not save without country" do
44 @institution.community.country = nil 44 @institution.community.country = nil
45 - assert !@institution.save, "Country can't be blank"  
46 - assert @institution.errors.full_messages.include? "Country can't be blank" 45 + assert_equal false, @institution.save
  46 + assert_equal true, @institution.errors.full_messages.include?("Country can't be blank")
47 end 47 end
48 48
49 should "not save without state" do 49 should "not save without state" do
50 @institution.community.state = nil 50 @institution.community.state = nil
51 51
52 - assert !@institution.save, "State can't be blank"  
53 - assert @institution.errors.full_messages.include? "State can't be blank" 52 + assert_equal false, @institution.save
  53 + assert_equal true, @institution.errors.full_messages.include?("State can't be blank")
54 end 54 end
55 55
56 should "not save without city" do 56 should "not save without city" do
57 @institution.community.city = nil 57 @institution.community.city = nil
  58 + @institution.community.state = "DF"
58 59
59 - assert !@institution.save, "City can't be blank"  
60 - assert @institution.errors.full_messages.include? "City can't be blank" 60 + assert_equal false, @institution.save
  61 + assert_equal true, @institution.errors.full_messages.include?("City can't be blank")
61 end 62 end
62 end 63 end