spec/spec/rails/spec_server_spec.rb in dchelimsky-rspec-rails-1.1.12 vs spec/spec/rails/spec_server_spec.rb in dchelimsky-rspec-rails-1.1.99.1

- old
+ new

@@ -1,9 +1,9 @@ require File.dirname(__FILE__) + '/../../spec_helper' describe "script/spec_server file", :shared => true do - attr_accessor :tmbundle_install_directory + attr_accessor :tmbundle_install_directory, :tmbundle_source_directory attr_reader :animals_yml_path, :original_animals_content before do @animals_yml_path = File.expand_path("#{RAILS_ROOT}/spec/fixtures/animals.yml") @original_animals_content = File.read(animals_yml_path) @@ -20,11 +20,11 @@ end it "runs a spec" do dir = File.expand_path(File.dirname(__FILE__)) output = "" - Timeout.timeout(10) do + Timeout.timeout(20) do loop do output = `#{RAILS_ROOT}/script/spec #{dir}/sample_spec.rb --drb 2>&1` break unless output.include?("No server is running") end end @@ -38,11 +38,11 @@ File.open(animals_yml_path, "w") do |f| f.write YAML.dump(fixtures) end - Timeout.timeout(10) do + Timeout.timeout(20) do loop do output = `#{RAILS_ROOT}/script/spec #{dir}/sample_modified_fixture.rb --drb 2>&1` break unless output.include?("No server is running") end end @@ -69,17 +69,28 @@ end end describe "script/spec_server file with TextMate bundle" do it_should_behave_like "script/spec_server file" + def tmbundle_directory + current_directory = File.expand_path("#{File.dirname(__FILE__)}/../../../../../../") + directories = current_directory.split('/') + while directories.any? + current_directory = File.join(*directories) + bundle_directory = File.join(current_directory, @bundle_name) + return bundle_directory if File.directory?(bundle_directory) + directories.pop + end + end + before(:each) do - dir = File.dirname(__FILE__) @tmbundle_install_directory = File.expand_path("#{Dir.tmpdir}/Library/Application Support/TextMate/Bundles") @bundle_name = "RSpec.tmbundle" + @tmbundle_source_directory = tmbundle_directory + FileUtils.mkdir_p(tmbundle_install_directory) - bundle_dir = File.expand_path("#{dir}/../../../../../../#{@bundle_name}") - File.directory?(bundle_dir).should be_true - unless system(%Q|ln -s #{bundle_dir} "#{tmbundle_install_directory}"|) + File.directory?(tmbundle_source_directory).should be_true + unless system(%Q|ln -s #{tmbundle_source_directory} "#{tmbundle_install_directory}"|) raise "Creating link to Textmate Bundle" end start_spec_server end