Module FixtureReplacement::ClassMethods

  1. lib/fixture_replacement/class_methods.rb (view online)

Public instance methods

attributes_for (fixture_name, options={}, &block)
[show source]
   # File lib/fixture_replacement/class_methods.rb, line 3
3:     def attributes_for(fixture_name, options={}, &block)
4:       builder = AttributeBuilder.new(fixture_name, options, &block)
5:       MethodGenerator.new(builder, self).generate_methods
6:     end
load_example_data ()
[show source]
    # File lib/fixture_replacement/class_methods.rb, line 19
19:     def load_example_data
20:       load "#{rails_root}/db/example_data.rb"
21:     rescue LoadError
22:       # no-op.  If the file is not found, don't panic
23:     end
rails_root ()
[show source]
    # File lib/fixture_replacement/class_methods.rb, line 25
25:     def rails_root
26:       defined?(RAILS_ROOT) ? RAILS_ROOT : "."
27:     end
random_string (length=10)
[show source]
    # File lib/fixture_replacement/class_methods.rb, line 12
12:     def random_string(length=10)
13:       chars = ("a".."z").to_a
14:       string = ""
15:       1.upto(length) { |i| string << chars[rand(chars.size-1)]}
16:       string
17:     end
reload! ()
[show source]
    # File lib/fixture_replacement/class_methods.rb, line 29
29:     def reload!
30:       AttributeBuilder.clear_out_instances!
31:       load File.expand_path(File.dirname(__FILE__) + "/../fixture_replacement.rb")
32:     end
validate! ()
[show source]
    # File lib/fixture_replacement/class_methods.rb, line 8
 8:     def validate!
 9:       AttributeBuilder.validate_instances!
10:     end