C0 code coverage information
Generated on Wed Dec 24 11:03:27 -0600 2008 with rcov 0.8.1.2
Code reported as executed by Ruby looks like this...
and this: this line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this,
and this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not executed.
1 class Test::Unit::TestCase
2 class << self
3 # Test::Unit uses ObjectSpace to figure out what Test::Unit:TestCase instances are running
4 # Contexts are not named and therefore sometimes get garbage collected.
5 # Think of #context_list as the shelter for nameless contexts
6 attr_accessor :context_list
7
8 def context_name #:nodoc:
9 @context_name ||= ""
10 if superclass.respond_to?(:context_name)
11 return "#{superclass.context_name} #{@context_name}".gsub(/^\s+/, "")
12 end
13 end
14
15 def context_name=(val) #:nodoc:
16 @context_name = val
17 end
18
19 # Add a context to a set of tests.
20 #
21 # context "A new account" do
22 # it "should not have users"
23 # assert Account.new.users.empty?
24 # end
25 # end
26 #
27 # The context name is prepended to the test name, so failures look like this:
28 #
29 # 1) Failure:
30 # test_a_new_account_should_not_have_users() [./test/test_accounts.rb:4]:
31 # <false> is not true.
32 #
33 # Contexts can also be nested like so:
34 #
35 # context "A new account" do
36 # context "created by the web application" do
37 # it "should have web as its vendor" do
38 # assert_equal "web", users(:web_user).vendor
39 # end
40 # end
41 # end
42 #
43 # Since contexts create a singleton instance of a class, each one must have its own before/after blocks. This
44 # will be tweaked in future releases to allow you to chain these blocks from its parent contexts.
45 #
46 def context(name, &block)
47 cls = Class.new(self)
48 cls.context_name = name
49 # puts "Creating context #{cls.context_name}"
50 cls.class_eval(&block)
51 (self.context_list ||= []) << cls
52
53 const_set("Test#{name.to_class_name}#{cls.object_id.abs}", cls)
54 cls
55 end
56
57 %w(contexts describe describes group specify specifies).each {|m| alias_method m, :context}
58 end
59 end
Generated using the rcov code coverage analysis tool for Ruby
version 0.8.1.2.