C0 code coverage information
Generated on Mon Feb 18 04:30:35 -0500 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 module FixtureReplacement
2 module ClassMethods
3 def attributes_for(fixture_name, options={}, fixture_attributes_class=FixtureReplacementController::AttributeCollection, &blk)
4 fixture_attributes_class.new(fixture_name, {
5 :class => options[:class],
6 :from => options[:from],
7 :attributes => blk
8 })
9 end
10
11 attr_writer :defaults_file
12
13 def defaults_file
14 @defaults_file ||= "#{rails_root}/db/example_data.rb"
15 end
16
17 def reset_excluded_environments!
18 @excluded_environments = ["production"]
19 end
20
21 def excluded_environments
22 @excluded_environments ||= ["production"]
23 end
24
25 attr_writer :excluded_environments
26
27 def included(included_mod)
28 raise_if_environment_is_in_excluded_environments
29 FixtureReplacementController::MethodGenerator.generate_methods
30 end
31
32 # Any user defined instance methods (as well as default_*) need the module's class scope to be
33 # accessible inside the block given to attributes_for
34 #
35 # Addresses bug #16858 (see CHANGELOG)
36 def method_added(method)
37 module_function method if method != :method_added
38 end
39
40 private
41
42 def raise_if_environment_is_in_excluded_environments
43 if environment_is_in_excluded_environments?
44 raise FixtureReplacement::InclusionError, "FixtureReplacement cannot be included in the #{Object.const_get(:RAILS_ENV)} environment!"
45 end
46 end
47
48 def environment_is_in_excluded_environments?
49 return false unless defined?(RAILS_ENV)
50 excluded_environments.include?(RAILS_ENV) ? true : false
51 end
52
53 def rails_root
54 defined?(RAILS_ROOT) ? RAILS_ROOT : nil
55 end
56 end
57 end
Generated using the rcov code coverage analysis tool for Ruby
version 0.8.1.2.