C0 code coverage information

Generated on Mon Feb 11 21:39:28 +0100 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.
Name Total lines Lines of code Total coverage Code coverage
lib/dst/models.rb 78 63
48.7% 
39.7% 
 1 require 'rubygems'
 2 require 'active_record'
 3 
 4 class Dst
 5   module Models
 6     class << self
 7       def schema(&block)
 8         @@schema = block if block_given?
 9         @@schema
10       end
11 
12       def establish_connection(options={})
13         ActiveRecord::Base.establish_connection({:adapter => 'sqlite3', :database => 'dst.db'}.merge(options))
14       end
15       
16       def create_tables_if_necessary(force=false)
17         ActiveRecord::Schema.define(&Dst::Models.schema) if force || !Task.table_exists?
18       end
19     end
20 
21     class Task < ActiveRecord::Base
22       belongs_to :context
23       belongs_to :project
24 
25       def self.unfinished(options={})
26         find(:all, :conditions => 'status = "f"', :include => [:context, :project], :order => 't1_r1')
27       end
28 
29       def self.toggle!(task_id)
30         task = find(task_id)
31         task.toggle!(:status)
32         task
33       end
34 
35       def status
36         read_attribute(:status) ? 'completed' : 'unfinished'  
37       end
38 
39       def to_s
40         "#{id} - #{context || ''}#{project || ''}#{description}"
41       end
42     end
43 
44     class Context < ActiveRecord::Base
45       has_many :tasks
46 
47       def to_s
48         name ? "@#{name} ": ""
49       end
50     end
51 
52     class Project < ActiveRecord::Base
53       has_many :tasks
54 
55       def to_s
56         name ? ":#{name} ": ""
57       end
58     end
59   end
60 end
61 
62 Dst::Models.schema do
63   create_table :tasks do |t|
64     t.string  :description
65     t.boolean :status, :default => false
66     t.integer :context_id
67     t.integer :project_id
68     t.timestamps
69   end
70 
71   create_table :contexts do |t|
72     t.string :name
73   end
74 
75   create_table :projects do |t|
76     t.string :name
77   end
78 end

Generated using the rcov code coverage analysis tool for Ruby version 0.8.1.2.

Valid XHTML 1.0! Valid CSS!