Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactor specs:

 * runs on latest rspec (2.6.4)
 * spec_helpers for plugins are now much more straightforward
 * the gui thread is NOT started in specs (though the SWT classes are still loaded)
 * there is a master spec_helper in spec/, which loads the plugin spec_helpers
  • Loading branch information...
commit b690f7c33649f9289220b17ee90c92d73362a573 1 parent 9ddf501
@danlucraft danlucraft authored
Showing with 114 additions and 185 deletions.
  1. +2 −10 README.md
  2. +3 −35 Rakefile
  3. +11 −12 lib/redcar.rb
  4. +1 −1  plugins/application/spec/application/application_spec.rb
  5. +1 −1  plugins/application/spec/application/clipboard_spec.rb
  6. +1 −1  plugins/application/spec/application/command/executor_spec.rb
  7. +1 −1  plugins/application/spec/application/command/history_spec.rb
  8. +1 −1  plugins/application/spec/application/command_spec.rb
  9. +1 −1  plugins/application/spec/application/keymap/builder_spec.rb
  10. +1 −1  plugins/application/spec/application/menu/builder_spec.rb
  11. +1 −1  plugins/application/spec/application/menu/menu_item_spec.rb
  12. +1 −1  plugins/application/spec/application/menu_spec.rb
  13. +2 −0  plugins/application/spec/application/navigation_history_spec.rb
  14. +1 −1  plugins/application/spec/application/notebook_spec.rb
  15. +1 −1  plugins/application/spec/application/sensitive_spec.rb
  16. +1 −1  plugins/application/spec/application/speedbar_spec.rb
  17. +1 −1  plugins/application/spec/application/treebook_spec.rb
  18. +1 −1  plugins/application/spec/application/window_spec.rb
  19. +4 −6 plugins/application/spec/spec_helper.rb
  20. +1 −1  plugins/application_swt/spec/application_swt/gradient_spec.rb
  21. +1 −1  plugins/application_swt/spec/application_swt/menu/binding_translator_spec.rb
  22. +1 −1  plugins/application_swt/spec/application_swt/menu_spec.rb
  23. +1 −19 plugins/application_swt/spec/spec_helper.rb
  24. +1 −1  plugins/auto_indenter/spec/auto_indenter/analyzer_spec.rb
  25. +1 −5 plugins/auto_indenter/spec/spec_helper.rb
  26. +1 −1  plugins/core/spec/core/base_storage_spec.rb
  27. +1 −1  plugins/core/spec/core/gui_spec.rb
  28. +2 −1  plugins/core/spec/core/observable_spec.rb
  29. +1 −1  plugins/core/spec/core/persistent_cache_spec.rb
  30. +1 −1  plugins/core/spec/core/shared_storage_spec.rb
  31. +1 −1  plugins/core/spec/core/storage_spec.rb
  32. +1 −3 plugins/core/spec/core/task_queue_spec.rb
  33. +1 −4 plugins/core/spec/spec_helper.rb
  34. +1 −1  plugins/declarations/spec/declarations/file_spec.rb
  35. +1 −5 plugins/declarations/spec/spec_helper.rb
  36. +1 −1  plugins/edit_view/spec/edit_view/document/indentation_spec.rb
  37. +1 −1  plugins/edit_view/spec/edit_view/document_spec.rb
  38. +1 −4 plugins/edit_view/spec/spec_helper.rb
  39. +1 −1  plugins/edit_view_swt/spec/edit_view_swt/word_movement_spec.rb
  40. +1 −4 plugins/edit_view_swt/spec/spec_helper.rb
  41. +1 −1  plugins/macros/spec/macros/predictive/sequence_finder_spec.rb
  42. +1 −6 plugins/macros/spec/spec_helper.rb
  43. +1 −1  plugins/project/spec/project/adapters/remote_protocols/ftp_spec.rb
  44. +1 −1  plugins/project/spec/project/adapters/remote_protocols/sftp_spec.rb
  45. +1 −1  plugins/project/spec/project/adapters/remote_spec.rb
  46. +1 −1  plugins/project/spec/project/dir_mirror_spec.rb
  47. +1 −1  plugins/project/spec/project/file_list_spec.rb
  48. +2 −1  plugins/project/spec/project/file_mirror_spec.rb
  49. +1 −4 plugins/project/spec/spec_helper.rb
  50. +1 −1  plugins/project_search/spec/project_search/binary_data_detector_spec.rb
  51. +1 −1  plugins/project_search/spec/project_search/word_search_spec.rb
  52. +1 −4 plugins/project_search/spec/spec_helper.rb
  53. +1 −1  plugins/repl/spec/repl/repl_mirror_spec.rb
  54. +1 −4 plugins/repl/spec/spec_helper.rb
  55. +1 −1  plugins/ruby/spec/ruby/repl_mirror_spec.rb
  56. +1 −5 plugins/ruby/spec/spec_helper.rb
  57. +1 −1  plugins/runnables/spec/runnables/output_processor_spec.rb
  58. +1 −5 plugins/runnables/spec/spec_helper.rb
  59. +1 −5 plugins/test_runner/spec/spec_helper.rb
  60. +1 −4 plugins/todo_list/spec/spec_helper.rb
  61. +1 −1  plugins/todo_list/spec/todo_list/file_parser_spec.rb
  62. +34 −0 spec/spec_helper.rb
View
12 README.md
@@ -59,17 +59,9 @@ To run all specs and all features:
### Specs
-On OSX:
-
- $ jruby -J-XstartOnFirstThread -S spec plugins/#{plugin_name}/spec/
-
-On Linux/Windows:
-
- $ jruby -S spec plugins/#{plugin_name}/spec/
-
-To just run all specs:
+To run all specs:
- $ rake specs
+ $ rspec plugins/*/spec/
### Features
View
38 Rakefile
@@ -1,13 +1,8 @@
require 'bundler'
-REDCAR_VERSION = "0.12.0dev" # also change in lib/redcar.rb!
require 'fileutils'
-# explitely use rspec < 2.0
-gem 'rspec', '<2.0'
-require 'spec/rake/spectask'
require 'cucumber/rake/task'
-require "rake/gempackagetask"
-require "rake/rdoctask"
+
Dir[File.expand_path("../lib/tasks/*.rake", __FILE__)].each { |f| load f }
if RUBY_PLATFORM =~ /mswin|mingw/
@@ -136,13 +131,8 @@ task :default => ["specs", "cucumber"]
desc "Run all specs"
task :specs do
- files = Dir['plugins/*/spec/*/*_spec.rb'] + Dir['plugins/*/spec/*/*/*_spec.rb'] + Dir['plugins/*/spec/*/*/*/*_spec.rb']
- case Config::CONFIG["host_os"]
- when "darwin"
- sh("jruby -J-XstartOnFirstThread -S bundle exec spec -c #{files.join(" ")} && echo 'done'")
- else
- sh("jruby -S bundle exec spec -c #{files.join(" ")} && echo 'done'")
- end
+ plugin_spec_dirs = Dir["plugins/*/spec"]
+ sh("jruby -S bundle exec rspec -c #{plugin_spec_dirs.join(" ")}")
end
desc "Run all features"
@@ -191,28 +181,6 @@ task :run_ci do
contrl.run
end
-desc "Release gem"
-task :release => :gem do
- require 'aws/s3'
- credentials = YAML.load(File.read("/Users/danlucraft/.s3-creds.yaml"))
- AWS::S3::Base.establish_connection!(
- :access_key_id => credentials['access_key_id'],
- :secret_access_key => credentials["secret_access_key"]
- )
-
- redcar_bucket = AWS::S3::Bucket.find('redcar')
- s3_uploads = {
- "vendor/java-mateview/release/java-mateview.jar" => "java-mateview-#{REDCAR_VERSION}.jar",
- "plugins/application_swt/lib/dist/application_swt.jar" => "application_swt-#{REDCAR_VERSION}.jar",
- "pkg/redcar-#{REDCAR_VERSION}.gem" => "redcar-#{REDCAR_VERSION}.gem"
- }
-
- s3_uploads.each do |source, target|
- p [source, target]
- AWS::S3::S3Object.store(target, open(source), 'redcar', :access => :public_read)
- end
-end
-
namespace :redcar do
def hash_with_hash_default
Hash.new {|h,k| h[k] = hash_with_hash_default }
View
23 lib/redcar.rb
@@ -109,7 +109,7 @@ def self.add_plugin_sources(manager)
end
end
- def self.load_prerequisites
+ def self.load_prerequisites(options={})
exit if ARGV.include?("--quit-immediately")
require 'java'
@@ -130,18 +130,17 @@ def self.load_prerequisites
gem 'swt'
require 'swt/minimal'
+
+ unless no_gui_mode?
+ gui = Redcar::Gui.new("swt")
+ gui.register_event_loop(Swt::EventLoop.new)
+ gui.register_features_runner(Swt::CucumberRunner.new)
+ Redcar.gui = gui
- gui = Redcar::Gui.new("swt")
- gui.register_event_loop(Swt::EventLoop.new)
- gui.register_features_runner(Swt::CucumberRunner.new)
- Redcar.gui = gui
-
- plugin_manager.load("splash_screen")
+ plugin_manager.load("splash_screen")
+ end
end
- def self.load_useful_libraries
- end
-
def self.load_plugins
begin
exit if ARGV.include?("--quit-after-splash")
@@ -177,8 +176,8 @@ def self.load_threaded
end
end
- def self.load_unthreaded
- load_prerequisites
+ def self.load_unthreaded(options={})
+ load_prerequisites(options)
load_plugins
end
View
2  plugins/application/spec/application/application_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "..", "spec_helper")
+require "spec_helper"
describe Redcar::Application do
it "has a name" do
View
2  plugins/application/spec/application/clipboard_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "..", "spec_helper")
+require "spec_helper"
describe Redcar::Clipboard do
before do
View
2  plugins/application/spec/application/command/executor_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")
+require "spec_helper"
class Redcar::Command
describe Executor do
View
2  plugins/application/spec/application/command/history_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")
+require "spec_helper"
describe Redcar::Command::History do
class HistoryTestCommand1 < Redcar::Command
View
2  plugins/application/spec/application/command_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "..", "spec_helper")
+require "spec_helper"
describe Redcar::Command do
describe "a command" do
View
2  plugins/application/spec/application/keymap/builder_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")
+require "spec_helper"
describe "Redcar::Keymap::Builder DSL" do
it "creates a keymap" do
View
2  plugins/application/spec/application/menu/builder_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")
+require "spec_helper"
describe "Redcar::Menu::Builder DSL" do
it "creates a menu" do
View
2  plugins/application/spec/application/menu/menu_item_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")
+require "spec_helper"
describe Redcar::Menu::Item do
class DummyCommand; end
View
2  plugins/application/spec/application/menu_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "..", "spec_helper")
+require "spec_helper"
describe Redcar::Menu do
class DummyCommand; end
View
2  plugins/application/spec/application/navigation_history_spec.rb
@@ -1,3 +1,5 @@
+require "spec_helper"
+
describe Redcar::NavigationHistory do
module NavigationHistoryTest
class TestEditView
View
2  plugins/application/spec/application/notebook_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "..", "spec_helper")
+require "spec_helper"
describe Redcar::Notebook do
describe "with no tabs" do
View
2  plugins/application/spec/application/sensitive_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "..", "spec_helper")
+require "spec_helper"
describe Redcar::Sensitive do
class ExampleModel
View
2  plugins/application/spec/application/speedbar_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "..", "spec_helper")
+require "spec_helper"
describe Redcar::Speedbar do
it "should let you add labels" do
View
2  plugins/application/spec/application/treebook_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "..", "spec_helper")
+require "spec_helper"
describe Redcar::Treebook do
View
2  plugins/application/spec/application/window_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "..", "spec_helper")
+require "spec_helper"
describe Redcar::Window do
View
10 plugins/application/spec/spec_helper.rb
@@ -1,8 +1,4 @@
-$:.push File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
-require 'redcar'
-Redcar.environment = :test
-Redcar.no_gui_mode!
-Redcar.load_unthreaded
+
Dir[File.dirname(__FILE__) + "/application/controllers/*.rb"].each do |fn|
require fn
end
@@ -15,4 +11,6 @@ def initialize(title)
end
def focus; end
-end
+end
+
+Redcar.plugin_manager.load("application")
View
2  plugins/application_swt/spec/application_swt/gradient_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "..", "spec_helper")
+require "spec_helper"
describe Redcar::ApplicationSWT::Gradient do
View
2  plugins/application_swt/spec/application_swt/menu/binding_translator_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")
+require "spec_helper"
BindingTranslator = Redcar::ApplicationSWT::Menu::BindingTranslator
describe BindingTranslator do
View
2  plugins/application_swt/spec/application_swt/menu_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "..", "spec_helper")
+require "spec_helper"
describe Redcar::ApplicationSWT::Menu do
it "should" do
View
20 plugins/application_swt/spec/spec_helper.rb
@@ -1,20 +1,2 @@
-$:.push File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
-
-require 'redcar'
-Redcar.environment = :test
-Redcar.load_unthreaded
-
-Spec::Runner.configure do |config|
- config.before(:suite) do
- end
-
- config.before(:each) do
- end
-
- config.after(:each) do
- end
-
- config.after(:suite) do
- end
-end
+Redcar.plugin_manager.load("application_swt")
View
2  plugins/auto_indenter/spec/auto_indenter/analyzer_spec.rb
@@ -1,5 +1,5 @@
-require File.join(File.dirname(__FILE__), "..", "spec_helper")
+require "spec_helper"
include Redcar
View
6 plugins/auto_indenter/spec/spec_helper.rb
@@ -1,5 +1 @@
-$:.push File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
-
-require 'redcar'
-Redcar.environment = :test
-Redcar.load_unthreaded
+Redcar.plugin_manager.load("auto_indenter")
View
2  plugins/core/spec/core/base_storage_spec.rb
@@ -1,5 +1,5 @@
-require File.join(File.dirname(__FILE__), "..", "spec_helper")
+require "spec_helper"
describe Redcar::Plugin::BaseStorage do
View
2  plugins/core/spec/core/gui_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "..", "spec_helper")
+require "spec_helper"
describe Redcar::Gui do
before do
View
3  plugins/core/spec/core/observable_spec.rb
@@ -1,4 +1,5 @@
-require File.join(File.dirname(__FILE__), "..", "spec_helper")
+
+require "spec_helper"
describe Redcar::Observable do
class SeeMe
View
2  plugins/core/spec/core/persistent_cache_spec.rb
@@ -1,5 +1,5 @@
-require File.join(File.dirname(__FILE__), *%w".. .. lib core persistent_cache")
+require "spec_helper"
PersistentCache = Redcar::PersistentCache
View
2  plugins/core/spec/core/shared_storage_spec.rb
@@ -1,5 +1,5 @@
-require File.join(File.dirname(__FILE__), "..", "spec_helper")
+require "spec_helper"
describe Redcar::Plugin::SharedStorage do
View
2  plugins/core/spec/core/storage_spec.rb
@@ -1,5 +1,5 @@
-require File.join(File.dirname(__FILE__), "..", "spec_helper")
+require "spec_helper"
describe Redcar::Plugin::Storage do
View
4 plugins/core/spec/core/task_queue_spec.rb
@@ -1,7 +1,5 @@
-require 'java'
-
-require File.join(File.dirname(__FILE__), *%w".. spec_helper")
+require "spec_helper"
describe Redcar::TaskQueue do
before do
View
5 plugins/core/spec/spec_helper.rb
@@ -1,8 +1,5 @@
-$:.push File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
-require 'redcar'
-Redcar.environment = :test
-Redcar.load_unthreaded
+Redcar.plugin_manager.load("core")
class QuickTask < Redcar::Task
def initialize(id=nil)
View
2  plugins/declarations/spec/declarations/file_spec.rb
@@ -1,5 +1,5 @@
-require File.join(File.dirname(__FILE__), "..", "spec_helper")
+require "spec_helper"
module Redcar
describe Declarations::File do
View
6 plugins/declarations/spec/spec_helper.rb
@@ -1,5 +1 @@
-$:.push File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
-
-require 'redcar'
-Redcar.environment = :test
-Redcar.load_unthreaded
+Redcar.plugin_manager.load("declarations")
View
2  plugins/edit_view/spec/edit_view/document/indentation_spec.rb
@@ -1,5 +1,5 @@
-require File.join(File.dirname(__FILE__), %w".. .. spec_helper")
+require "spec_helper"
describe Redcar::Document::Indentation do
class MockDoc
View
2  plugins/edit_view/spec/edit_view/document_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "..", "spec_helper")
+require "spec_helper"
describe Redcar::Document do
class TestEditView
View
5 plugins/edit_view/spec/spec_helper.rb
@@ -1,5 +1,2 @@
-$:.push File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
-require 'redcar'
-Redcar.environment = :test
-Redcar.load_unthreaded
+Redcar.plugin_manager.load("edit_view")
View
2  plugins/edit_view_swt/spec/edit_view_swt/word_movement_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "..", "spec_helper")
+require "spec_helper"
describe Redcar::EditViewSWT::WordMoveListener do
before do
View
5 plugins/edit_view_swt/spec/spec_helper.rb
@@ -1,5 +1,2 @@
-$:.push File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
-require 'redcar'
-Redcar.environment = :test
-Redcar.load_unthreaded
+Redcar.plugin_manager.load("edit_view_swt")
View
2  plugins/macros/spec/macros/predictive/sequence_finder_spec.rb
@@ -1,5 +1,5 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
+require "spec_helper"
describe Redcar::Macros::Predictive::SequenceFinder do
SequenceFinder = Redcar::Macros::Predictive::SequenceFinder
View
7 plugins/macros/spec/spec_helper.rb
@@ -1,6 +1 @@
-
-$:.push File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
-require 'redcar'
-Redcar.environment = :test
-Redcar.no_gui_mode!
-Redcar.load_unthreaded
+Redcar.plugin_manager.load("macros")
View
2  plugins/project/spec/project/adapters/remote_protocols/ftp_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "..", "..", "..", "spec_helper")
+require "spec_helper"
require 'net/ssh'
require 'net/ftp'
View
2  plugins/project/spec/project/adapters/remote_protocols/sftp_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "..", "..", "..", "spec_helper")
+require "spec_helper"
require 'net/ssh'
require 'net/sftp'
View
2  plugins/project/spec/project/adapters/remote_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")
+require "spec_helper"
class Redcar::Project
# describe Adapters::Remote do
View
2  plugins/project/spec/project/dir_mirror_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), "..", "spec_helper")
+require "spec_helper"
class Redcar::Project
describe DirMirror do
View
2  plugins/project/spec/project/file_list_spec.rb
@@ -1,5 +1,5 @@
-require File.join(File.dirname(__FILE__), *%w".. spec_helper")
+require "spec_helper"
FileList = Redcar::Project::FileList
View
3  plugins/project/spec/project/file_mirror_spec.rb
@@ -1,4 +1,5 @@
-require File.join(File.dirname(__FILE__), "..", "spec_helper")
+
+require "spec_helper"
class Redcar::Project
describe FileMirror do
View
5 plugins/project/spec/spec_helper.rb
@@ -1,8 +1,5 @@
-$:.push File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
-require 'redcar'
-Redcar.environment = :test
-Redcar.load_unthreaded
+Redcar.plugin_manager.load("project")
require File.dirname(__FILE__) + "/fixture_helper"
View
2  plugins/project_search/spec/project_search/binary_data_detector_spec.rb
@@ -1,5 +1,5 @@
-require File.dirname(__FILE__) + '/../spec_helper'
+require "spec_helper"
describe ProjectSearch::BinaryDataDetector do
View
2  plugins/project_search/spec/project_search/word_search_spec.rb
@@ -1,5 +1,5 @@
-require File.dirname(__FILE__) + "/../spec_helper"
+require "spec_helper"
describe ProjectSearch::WordSearch do
after do
View
5 plugins/project_search/spec/spec_helper.rb
@@ -1,8 +1,5 @@
-$:.push File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
-require 'redcar'
-Redcar.environment = :test
-Redcar.load_unthreaded
+Redcar.plugin_manager.load("project_search")
class ImmediateTaskQueue
class Future
View
2  plugins/repl/spec/repl/repl_mirror_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), '..', 'spec_helper')
+require 'spec_helper'
class Redcar::REPL
describe ReplMirror do
View
5 plugins/repl/spec/spec_helper.rb
@@ -1,5 +1,2 @@
-$:.push File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
-require 'redcar'
-Redcar.environment = :test
-Redcar.load_unthreaded
+Redcar.plugin_manager.load("repl")
View
2  plugins/ruby/spec/ruby/repl_mirror_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), '..', 'spec_helper')
+require 'spec_helper'
class Redcar::Ruby
describe ReplMirror do
View
6 plugins/ruby/spec/spec_helper.rb
@@ -1,5 +1 @@
-$:.push File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
-
-require 'redcar'
-Redcar.environment = :test
-Redcar.load_unthreaded
+Redcar.plugin_manager.load("ruby")
View
2  plugins/runnables/spec/runnables/output_processor_spec.rb
@@ -1,4 +1,4 @@
-require File.join(File.dirname(__FILE__), '..', 'spec_helper')
+require 'spec_helper'
describe Redcar::Runnables::OutputProcessor do
before do
View
6 plugins/runnables/spec/spec_helper.rb
@@ -1,5 +1 @@
-$:.push File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
-
-require 'redcar'
-Redcar.environment = :test
-Redcar.load_unthreaded
+Redcar.plugin_manager.load("runnables")
View
6 plugins/test_runner/spec/spec_helper.rb
@@ -1,5 +1 @@
-$:.push File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
-
-require 'redcar'
-Redcar.environment = :test
-Redcar.load_unthreaded
+Redcar.plugin_manager.load("test_runner")
View
5 plugins/todo_list/spec/spec_helper.rb
@@ -1,6 +1,3 @@
-$:.push File.expand_path('../../../../lib', __FILE__)
require File.expand_path("../fixtures/settings", __FILE__)
-require 'redcar'
-Redcar.environment = :test
-Redcar.load_unthreaded
+Redcar.plugin_manager.load("todo_list")
View
2  plugins/todo_list/spec/todo_list/file_parser_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path("../../spec_helper", __FILE__)
+require "spec_helper"
describe Redcar::TodoList::FileParser do
before do
View
34 spec/spec_helper.rb
@@ -0,0 +1,34 @@
+puts "loading master spec_helper"
+
+class RedcarSpecEnvironment
+ def load_core
+ $:.push File.expand_path("../../lib", __FILE__)
+ require 'redcar'
+ Redcar.environment = :test
+ Redcar.no_gui_mode!
+ Redcar.load_prerequisites
+ end
+
+ def spec_helpers
+ spec_helpers = []
+ RSpec.configuration.files_to_run.each do |spec_file|
+ if spec_file =~ /plugins\/([^\/]+)\//
+ filename = "plugins/#{$1}/spec/spec_helper"
+ if File.exist?(filename + ".rb")
+ spec_helpers << filename unless spec_helpers.include?(filename)
+ end
+ end
+ end
+ spec_helpers
+ end
+end
+
+spec_environment = RedcarSpecEnvironment.new
+spec_environment.load_core
+spec_environment.spec_helpers.each do |spec_helper|
+ puts "loading #{spec_helper}"
+ require spec_helper
+end
+
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.