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 == 2.4.1 2009-11-20
* Annotates thoughtbot's factory_girl factories (test/factories/<model>_factory.rb) * 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 ...@@ -7,7 +7,7 @@ Add a comment summarizing the current schema to the top or bottom of each of you
* Tests and Specs * Tests and Specs
* Object Daddy exemplars * Object Daddy exemplars
* Machinist blueprints * 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: The schema comment looks like this:
......
--- ---
:major: 2 :major: 2
:minor: 4 :minor: 4
:patch: 1 :patch: 2
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = %q{annotate} 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.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Cuong Tran", "Alex Chaffee", "Marcos Piccinini"] s.authors = ["Cuong Tran", "Alex Chaffee", "Marcos Piccinini"]
......
...@@ -15,7 +15,8 @@ module AnnotateModels ...@@ -15,7 +15,8 @@ module AnnotateModels
# Machinist http://github.com/notahat/machinist # Machinist http://github.com/notahat/machinist
BLUEPRINTS_DIR = File.join("test", "blueprints") BLUEPRINTS_DIR = File.join("test", "blueprints")
# Factory Girl http://github.com/thoughtbot/factory_girl # 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 def model_dir
@model_dir || "app/models" @model_dir || "app/models"
...@@ -195,7 +196,8 @@ module AnnotateModels ...@@ -195,7 +196,8 @@ module AnnotateModels
unless ENV['exclude_factories'] 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| ].each do |file|
annotate_one_file(file, info, options_with_position(options, :position_in_factory)) annotate_one_file(file, info, options_with_position(options, :position_in_factory))
end end
...@@ -319,7 +321,8 @@ module AnnotateModels ...@@ -319,7 +321,8 @@ module AnnotateModels
remove_annotation_of_file(file) if File.exist?(file) remove_annotation_of_file(file) if File.exist?(file)
end 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) remove_annotation_of_file(file) if File.exist?(file)
end 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