Created
April 28, 2009 18:04
-
-
Save dce/103291 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test::Unit::TestCase | |
def self.should_sum_total_ratings | |
klass = model_class | |
context "finding total ratings" do | |
setup do | |
@ratable = Factory(klass.to_s.downcase) | |
end | |
should "have zero total ratings if no rated talks" do | |
assert_equal 0, @ratable.total_ratings | |
end | |
should "have one total rating if one delivery & content rating" do | |
talk = block_given? ? yield(@ratable) : @ratable | |
Factory(:content_rating, :talk => talk) | |
Factory(:delivery_rating, :talk => talk) | |
assert_equal 1, @ratable.reload.total_ratings | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment