Permalink
Browse files

Fixed bug where Cmd + R fails in a Ruby-script (no matter if RSpec is…

… a dependency or not) when only single file is loaded (aka "standalone mode"). Closes #5.
  • Loading branch information...
1 parent 290062c commit df85d0cee8352faada65b80cf490b11d7e0a9530 @grimen grimen committed with Dec 3, 2009
Showing with 3 additions and 1 deletion.
  1. +2 −0 Support/lib/spec/mate.rb
  2. +1 −1 Support/lib/spec/mate/runner.rb
View
2 Support/lib/spec/mate.rb
@@ -1,7 +1,9 @@
# This is based on Florian Weber's TDDMate
require 'rubygems'
+ENV['TM_PROJECT_DIRECTORY'] ||= File.dirname(ENV['TM_FILEPATH'])
rspec_rails_plugin = File.join(ENV['TM_PROJECT_DIRECTORY'],'vendor','plugins','rspec','lib')
+
if File.directory?(rspec_rails_plugin)
$LOAD_PATH.unshift(rspec_rails_plugin)
elsif ENV['TM_RSPEC_HOME']
View
2 Support/lib/spec/mate/runner.rb
@@ -59,7 +59,7 @@ def last_remembered_single_file
end
def project_directory
- File.expand_path(ENV['TM_PROJECT_DIRECTORY'])
+ File.expand_path(ENV['TM_PROJECT_DIRECTORY']) rescue File.dirname(single_file)
end
end
end

0 comments on commit df85d0c

Please sign in to comment.