Commit 14b5fb22 by Nathan Brazil Committed by Robert Wahler

Add support for spec/factories/<model>_factory.rb files.

parent 5457d2bd
== 2.4.2 2009-11-21
* Annotates (spec|test)/factories/<model>_factory.rb files
== 2.4.1 2009-11-20
* Annotates thoughtbot's factory_girl factories (test/factories/<model>_factory.rb)
......
......@@ -7,7 +7,7 @@ Add a comment summarizing the current schema to the top or bottom of each of you
* Tests and Specs
* Object Daddy exemplars
* Machinist blueprints
* Thoughtbot's factory_girl factories (test/factories/<model>_factory.rb files)
* Thoughtbot's factory_girl factories, i.e. the (spec|test)/factories/<model>_factory.rb files
The schema comment looks like this:
......
---
:major: 2
:minor: 4
:patch: 1
:patch: 2
......@@ -5,7 +5,7 @@
Gem::Specification.new do |s|
s.name = %q{annotate}
s.version = "2.4.1"
s.version = "2.4.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Cuong Tran", "Alex Chaffee", "Marcos Piccinini"]
......
......@@ -15,7 +15,8 @@ module AnnotateModels
# Machinist http://github.com/notahat/machinist
BLUEPRINTS_DIR = File.join("test", "blueprints")
# Factory Girl http://github.com/thoughtbot/factory_girl
FACTORIES_DIR = File.join("test", "factories")
SPEC_FACTORIES_DIR = File.join("spec", "factories")
TEST_FACTORIES_DIR = File.join("test", "factories")
def model_dir
@model_dir || "app/models"
......@@ -195,7 +196,8 @@ module AnnotateModels
unless ENV['exclude_factories']
[
File.join(FACTORIES_DIR, "#{model_name}_factory.rb"), # test/factories
File.join(SPEC_FACTORIES_DIR, "#{model_name}_factory.rb"), # spec/factories
File.join(TEST_FACTORIES_DIR, "#{model_name}_factory.rb"), # test/factories
].each do |file|
annotate_one_file(file, info, options_with_position(options, :position_in_factory))
end
......@@ -319,7 +321,8 @@ module AnnotateModels
remove_annotation_of_file(file) if File.exist?(file)
end
[ File.join(FACTORIES_DIR, "#{klass.name.underscore}_factory.rb")].each do |file|
[ File.join(SPEC_FACTORIES_DIR, "#{klass.name.underscore}_factory.rb"),
File.join(TEST_FACTORIES_DIR, "#{klass.name.underscore}_factory.rb")].each do |file|
remove_annotation_of_file(file) if File.exist?(file)
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment