@@ -136,17 +136,16 @@ def self.has_many name
136136
137137 # todo: use 'files' gem instead
138138 def create ( file , body = "hi" )
139- file_path = File . join ( AnnotateModels . model_dir , file )
139+ file_path = File . join ( AnnotateModels . model_dir [ 0 ] , file )
140140 FileUtils . mkdir_p ( File . dirname ( file_path ) )
141-
142141 File . open ( file_path , "wb" ) do |f |
143142 f . puts ( body )
144143 end
145144 file_path
146145 end
147146
148147 def check_class_name ( file , class_name )
149- klass = AnnotateModels . get_model_class ( file )
148+ klass = AnnotateModels . get_model_class ( File . join ( AnnotateModels . model_dir [ 0 ] , file ) )
150149
151150 expect ( klass ) . not_to eq ( nil )
152151 expect ( klass . name ) . to eq ( class_name )
@@ -294,7 +293,7 @@ class LoadedClass < ActiveRecord::Base
294293 CONSTANT = 1
295294 end
296295 EOS
297- path = File . expand_path ( " #{ AnnotateModels . model_dir } /loaded_class" )
296+ path = File . expand_path ( 'loaded_class' , AnnotateModels . model_dir [ 0 ] )
298297 Kernel . load "#{ path } .rb"
299298 expect ( Kernel ) . not_to receive ( :require ) . with ( path )
300299
@@ -557,7 +556,7 @@ class User < ActiveRecord::Base
557556 it "displays an error message" do
558557 expect ( capturing ( :stdout ) {
559558 AnnotateModels . do_annotations :model_dir => @model_dir , :is_rake => true
560- } ) . to include ( "Unable to annotate user.rb: oops" )
559+ } ) . to include ( "Unable to annotate #{ @model_dir } / user.rb: oops" )
561560 end
562561
563562 it "displays the full stack trace with --trace" do
@@ -587,7 +586,7 @@ class User < ActiveRecord::Base
587586 it "displays an error message" do
588587 expect ( capturing ( :stdout ) {
589588 AnnotateModels . remove_annotations :model_dir => @model_dir , :is_rake => true
590- } ) . to include ( "Unable to deannotate user.rb: oops" )
589+ } ) . to include ( "Unable to deannotate #{ @model_dir } / user.rb: oops" )
591590 end
592591
593592 it "displays the full stack trace" do
0 commit comments