public
Description: Symbiot's open source documentation system
Clone URL: git://github.com/mando/chronicle.git
Search Repo:
Forgot to run script/generate rspec :(
mando (author)
Mon May 12 18:08:09 -0700 2008
commit  c67bca48db08354ceffab9453dcc278f0219b919
tree    818e75a7f7535de26f3bad627ec0dd546e66de72
parent  6e5f50985a367db70f32d07f3623ff1e1388d49a
...
 
 
 
 
...
1
2
3
4
0
@@ -1 +1,5 @@
0
+#!/usr/bin/env ruby
0
+$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../vendor/plugins/rspec/lib"))
0
+require 'spec'
0
+exit ::Spec::Runner::CommandLine.run(::Spec::Runner::OptionParser.parse(ARGV, STDERR, STDOUT))
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
0
@@ -1 +1,103 @@
0
+#!/usr/bin/env ruby
0
+$LOAD_PATH.unshift File.dirname(__FILE__) + '/../../rspec/lib' # For svn
0
+$LOAD_PATH.unshift File.dirname(__FILE__) + '/../vendor/plugins/rspec/lib' # For rspec installed as plugin
0
+require 'rubygems'
0
+require 'drb/drb'
0
+require 'rbconfig'
0
+require 'spec'
0
+require 'optparse'
0
+
0
+# This is based on Florian Weber's TDDMate
0
+module Spec
0
+ module Runner
0
+ class RailsSpecServer
0
+ def run(argv, stderr, stdout)
0
+ $stdout = stdout
0
+ $stderr = stderr
0
+
0
+ base = ActiveRecord::Base
0
+ def base.clear_reloadable_connections!
0
+ active_connections.each do |name, conn|
0
+ if conn.requires_reloading?
0
+ conn.disconnect!
0
+ active_connections.delete(name)
0
+ end
0
+ end
0
+ end
0
+
0
+ if ActionController.const_defined?(:Dispatcher)
0
+ dispatcher = ::ActionController::Dispatcher.new($stdout)
0
+ dispatcher.cleanup_application(true)
0
+ elsif ::Dispatcher.respond_to?(:reset_application!)
0
+ ::Dispatcher.reset_application!
0
+ else
0
+ raise "Application reloading failed"
0
+ end
0
+ ::Dependencies.mechanism = :load
0
+ require_dependency('application.rb') unless Object.const_defined?(:ApplicationController)
0
+ load File.dirname(__FILE__) + '/../spec/spec_helper.rb'
0
+
0
+ ::Spec::Runner::CommandLine.run(
0
+ ::Spec::Runner::OptionParser.parse(
0
+ argv,
0
+ $stderr,
0
+ $stdout
0
+ )
0
+ )
0
+ end
0
+ end
0
+ end
0
+end
0
+puts "Loading Rails environment"
0
+
0
+ENV["RAILS_ENV"] = "test"
0
+require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
0
+require 'dispatcher'
0
+
0
+def restart_test_server
0
+ puts "restarting"
0
+ config = ::Config::CONFIG
0
+ ruby = File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT']
0
+ command_line = [ruby, $0, ARGV].flatten.join(' ')
0
+ exec(command_line)
0
+end
0
+
0
+def daemonize(pid_file = nil)
0
+ return yield if $DEBUG
0
+ pid = Process.fork{
0
+ Process.setsid
0
+ Dir.chdir(RAILS_ROOT)
0
+ trap("SIGINT"){ exit! 0 }
0
+ trap("SIGTERM"){ exit! 0 }
0
+ trap("SIGHUP"){ restart_test_server }
0
+ File.open("/dev/null"){|f|
0
+ STDERR.reopen f
0
+ STDIN.reopen f
0
+ STDOUT.reopen f
0
+ }
0
+ yield
0
+ }
0
+ puts "spec_server launched. (PID: %d)" % pid
0
+ File.open(pid_file,"w"){|f| f.puts pid } if pid_file
0
+ exit! 0
0
+end
0
+
0
+options = Hash.new
0
+opts = OptionParser.new
0
+opts.on("-d", "--daemon"){|v| options[:daemon] = true }
0
+opts.on("-p", "--pid PIDFILE"){|v| options[:pid] = v }
0
+opts.parse!(ARGV)
0
+
0
+puts "Ready"
0
+exec_server = lambda {
0
+ trap("USR2") { restart_test_server } if Signal.list.has_key?("USR2")
0
+ DRb.start_service("druby://localhost:8989", Spec::Runner::RailsSpecServer.new)
0
+ DRb.thread.join
0
+}
0
+
0
+if options[:daemon]
0
+ daemonize(options[:pid], &exec_server)
0
+else
0
+ exec_server.call
0
+end
...
 
 
...
1
2
0
@@ -1 +1,3 @@
0
+--exclude "spec/*,gems/*"
0
+--rails
...
 
 
 
 
...
1
2
3
4
0
@@ -1 +1,5 @@
0
+--colour
0
+--format progress
0
+--loadby mtime
0
+--reverse
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
0
@@ -1 +1,40 @@
0
+# This file is copied to ~/spec when you run 'ruby script/generate rspec'
0
+# from the project root directory.
0
+ENV["RAILS_ENV"] = "test"
0
+require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
0
+require 'spec'
0
+require 'spec/rails'
0
+
0
+Spec::Runner.configure do |config|
0
+ # If you're not using ActiveRecord you should remove these
0
+ # lines, delete config/database.yml and disable :active_record
0
+ # in your config/boot.rb
0
+ config.use_transactional_fixtures = true
0
+ config.use_instantiated_fixtures = false
0
+ config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
0
+
0
+ # == Fixtures
0
+ #
0
+ # You can declare fixtures for each example_group like this:
0
+ # describe "...." do
0
+ # fixtures :table_a, :table_b
0
+ #
0
+ # Alternatively, if you prefer to declare them only once, you can
0
+ # do so right here. Just uncomment the next line and replace the fixture
0
+ # names with your fixtures.
0
+ #
0
+ # config.global_fixtures = :table_a, :table_b
0
+ #
0
+ # If you declare global fixtures, be aware that they will be declared
0
+ # for all of your examples, even those that don't use them.
0
+ #
0
+ # == Mock Framework
0
+ #
0
+ # RSpec uses it's own mocking framework by default. If you prefer to
0
+ # use mocha, flexmock or RR, uncomment the appropriate line:
0
+ #
0
+ # config.mock_with :mocha
0
+ # config.mock_with :flexmock
0
+ # config.mock_with :rr
0
+end
...
 
 
 
 
...
1
2
3
4
0
@@ -1 +1,5 @@
0
+dir = File.dirname(__FILE__)
0
+Dir[File.expand_path("#{dir}/**/*.rb")].uniq.each do |file|
0
+ require file
0
+end
...
 
 
 
...
1
2
3
0
@@ -1 +1,4 @@
0
+ENV["RAILS_ENV"] = "test"
0
+require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
0
+require 'spec/rails/story_adapter'

Comments

    No one has commented yet.