From 3c93f5c072cd28983a404e178cd81a1d01aaae58 Mon Sep 17 00:00:00 2001 From: Fabio Teixeira Date: Wed, 15 Jul 2015 10:44:45 -0300 Subject: [PATCH] Fix broken unit, cucumber tests --- features/steps_definitions/gov_user_steps.rb | 4 ++-- test/unit/gov_user_person_test.rb | 1 + test/unit/institution_test.rb | 21 +++++++++++---------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/features/steps_definitions/gov_user_steps.rb b/features/steps_definitions/gov_user_steps.rb index 62f2b6c..97cf5e2 100644 --- a/features/steps_definitions/gov_user_steps.rb +++ b/features/steps_definitions/gov_user_steps.rb @@ -66,7 +66,6 @@ Given /^the following public institutions?$/ do |table| end end - Given /^I sleep for (\d+) seconds$/ do |time| sleep time.to_i end @@ -87,4 +86,5 @@ Given /^I am logged in as mpog_admin$/ do fill_in("Username", :with => user.login) fill_in("Password", :with => '123456') click_button("Log in") -end \ No newline at end of file +end + diff --git a/test/unit/gov_user_person_test.rb b/test/unit/gov_user_person_test.rb index b959c97..0c58478 100644 --- a/test/unit/gov_user_person_test.rb +++ b/test/unit/gov_user_person_test.rb @@ -15,6 +15,7 @@ class SoftwareCommunitiesPluginPersonTest < ActiveSupport::TestCase "user@email.com", "123456", "123456", + "user2@email.com", "Any State", "Some City" ) diff --git a/test/unit/institution_test.rb b/test/unit/institution_test.rb index cda237c..c4c77e5 100644 --- a/test/unit/institution_test.rb +++ b/test/unit/institution_test.rb @@ -29,34 +29,35 @@ class InstitutionTest < ActiveSupport::TestCase end should "not save institutions without name" do @institution.name = nil - assert !@institution.save - assert @institution.errors.full_messages.include? "Name can't be blank" + assert_equal false, @institution.save + assert_equal true, @institution.errors.full_messages.include?("Name can't be blank") end should "not save if institution has invalid type" do invalid_msg = "Type invalid, only public and private institutions are allowed." @institution.type = "Other type" - assert !@institution.save, 'Invalid type' - assert @institution.errors.full_messages.include? invalid_msg + assert_equal false, @institution.save + assert_equal true, @institution.errors.full_messages.include?(invalid_msg) end should "not save without country" do @institution.community.country = nil - assert !@institution.save, "Country can't be blank" - assert @institution.errors.full_messages.include? "Country can't be blank" + assert_equal false, @institution.save + assert_equal true, @institution.errors.full_messages.include?("Country can't be blank") end should "not save without state" do @institution.community.state = nil - assert !@institution.save, "State can't be blank" - assert @institution.errors.full_messages.include? "State can't be blank" + assert_equal false, @institution.save + assert_equal true, @institution.errors.full_messages.include?("State can't be blank") end should "not save without city" do @institution.community.city = nil + @institution.community.state = "DF" - assert !@institution.save, "City can't be blank" - assert @institution.errors.full_messages.include? "City can't be blank" + assert_equal false, @institution.save + assert_equal true, @institution.errors.full_messages.include?("City can't be blank") end end -- libgit2 0.21.2