diff --git a/plugins/communities_ratings/test/unit/community_rating_test.rb b/plugins/communities_ratings/test/unit/community_rating_test.rb index efebd78..684b780 100644 --- a/plugins/communities_ratings/test/unit/community_rating_test.rb +++ b/plugins/communities_ratings/test/unit/community_rating_test.rb @@ -2,22 +2,46 @@ require 'test_helper' class CommunityRatingTest < ActiveSupport::TestCase test "The value must be between 1 and 5" do - cr1 = CommunityRating.new :value => -1 - cr2 = CommunityRating.new :value => 6 + community_rating1 = CommunityRating.new :value => -1 + community_rating2 = CommunityRating.new :value => 6 - assert_equal false, cr1.valid? - assert_equal false, cr2.valid? + assert_equal false, community_rating1.valid? + assert_equal false, community_rating2.valid? - assert_equal true, cr1.errors[:value].include?("must be between 1 and 5") - assert_equal true, cr2.errors[:value].include?("must be between 1 and 5") + assert_equal true, community_rating1.errors[:value].include?("must be between 1 and 5") + assert_equal true, community_rating2.errors[:value].include?("must be between 1 and 5") - cr1.value = 1 - cr1.valid? + community_rating1.value = 1 + community_rating1.valid? - cr2.value = 5 - cr2.valid? + community_rating2.value = 5 + community_rating2.valid? - assert_equal false, cr1.errors[:value].include?("must be between 1 and 5") - assert_equal false, cr2.errors[:value].include?("must be between 1 and 5") + assert_equal false, community_rating1.errors[:value].include?("must be between 1 and 5") + assert_equal false, community_rating2.errors[:value].include?("must be between 1 and 5") + end + + test "Create task for create a rating comment" do + person = create_user('molly').person + person.email = "person@email.com" + person.save! + + community = fast_create(Community) + community.add_admin(person) + + community_rating = CommunityRating.create!( + :value => 3, + :person => person, + :community => community + ) + + create_community_rating_comment = CreateCommunityRatingComment.create!( + :requestor => person, + :source => community, + :community_rating => community_rating, + :organization => community + ) + + assert community.tasks.include?(create_community_rating_comment) end end -- libgit2 0.21.2