@@ -136,17 +136,16 @@ def self.has_many name
136
136
137
137
# todo: use 'files' gem instead
138
138
def create ( file , body = "hi" )
139
- file_path = File . join ( AnnotateModels . model_dir , file )
139
+ file_path = File . join ( AnnotateModels . model_dir [ 0 ] , file )
140
140
FileUtils . mkdir_p ( File . dirname ( file_path ) )
141
-
142
141
File . open ( file_path , "wb" ) do |f |
143
142
f . puts ( body )
144
143
end
145
144
file_path
146
145
end
147
146
148
147
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 ) )
150
149
151
150
expect ( klass ) . not_to eq ( nil )
152
151
expect ( klass . name ) . to eq ( class_name )
@@ -294,7 +293,7 @@ class LoadedClass < ActiveRecord::Base
294
293
CONSTANT = 1
295
294
end
296
295
EOS
297
- path = File . expand_path ( " #{ AnnotateModels . model_dir } /loaded_class" )
296
+ path = File . expand_path ( 'loaded_class' , AnnotateModels . model_dir [ 0 ] )
298
297
Kernel . load "#{ path } .rb"
299
298
expect ( Kernel ) . not_to receive ( :require ) . with ( path )
300
299
@@ -557,7 +556,7 @@ class User < ActiveRecord::Base
557
556
it "displays an error message" do
558
557
expect ( capturing ( :stdout ) {
559
558
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" )
561
560
end
562
561
563
562
it "displays the full stack trace with --trace" do
@@ -587,7 +586,7 @@ class User < ActiveRecord::Base
587
586
it "displays an error message" do
588
587
expect ( capturing ( :stdout ) {
589
588
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" )
591
590
end
592
591
593
592
it "displays the full stack trace" do
0 commit comments