rspec-rails 1.2.7.1 → 1.2.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Contribute.rdoc +4 -0
- data/History.rdoc +26 -1
- data/Manifest.txt +2 -3
- data/Rakefile +16 -15
- data/TODO.txt +2 -3
- data/Upgrade.rdoc +34 -0
- data/generators/integration_spec/templates/integration_spec.rb +1 -1
- data/generators/rspec/rspec_generator.rb +0 -1
- data/generators/rspec/templates/rspec.rake +1 -39
- data/generators/rspec/templates/spec_helper.rb +5 -2
- data/generators/rspec_controller/rspec_controller_generator.rb +2 -0
- data/generators/rspec_controller/templates/controller_spec.rb +1 -1
- data/generators/rspec_controller/templates/helper_spec.rb +1 -1
- data/generators/rspec_controller/templates/view_spec.rb +1 -1
- data/generators/rspec_model/templates/model_spec.rb +1 -1
- data/generators/rspec_scaffold/templates/controller_spec.rb +1 -1
- data/generators/rspec_scaffold/templates/edit_erb_spec.rb +1 -1
- data/generators/rspec_scaffold/templates/helper_spec.rb +1 -1
- data/generators/rspec_scaffold/templates/index_erb_spec.rb +1 -1
- data/generators/rspec_scaffold/templates/new_erb_spec.rb +1 -1
- data/generators/rspec_scaffold/templates/routing_spec.rb +16 -46
- data/generators/rspec_scaffold/templates/show_erb_spec.rb +1 -1
- data/lib/spec/rails/example/controller_example_group.rb +12 -1
- data/lib/spec/rails/example/routing_helpers.rb +16 -20
- data/lib/spec/rails/extensions/action_controller/rescue.rb +2 -2
- data/lib/spec/rails/extensions/action_controller/test_case.rb +1 -1
- data/lib/spec/rails/matchers.rb +1 -0
- data/lib/spec/rails/matchers/render_template.rb +8 -2
- data/lib/spec/rails/matchers/route_to.rb +149 -0
- data/lib/spec/rails/version.rb +3 -3
- data/spec/autotest/mappings_spec.rb +1 -1
- data/spec/resources/controllers/controller_spec_controller.rb +5 -1
- data/spec/resources/controllers/render_spec_controller.rb +4 -0
- data/spec/spec/rails/example/assigns_hash_proxy_spec.rb +1 -1
- data/spec/spec/rails/example/configuration_spec.rb +1 -1
- data/spec/spec/rails/example/controller_example_group_spec.rb +15 -7
- data/spec/spec/rails/example/controller_isolation_spec.rb +22 -9
- data/spec/spec/rails/example/cookies_proxy_spec.rb +1 -1
- data/spec/spec/rails/example/error_handling_spec.rb +1 -1
- data/spec/spec/rails/example/example_group_factory_spec.rb +1 -1
- data/spec/spec/rails/example/helper_example_group_spec.rb +2 -2
- data/spec/spec/rails/example/model_example_group_spec.rb +1 -1
- data/spec/spec/rails/example/routing_example_group_spec.rb +3 -2
- data/spec/spec/rails/example/shared_routing_example_group_examples.rb +224 -31
- data/spec/spec/rails/example/test_unit_assertion_accessibility_spec.rb +1 -1
- data/spec/spec/rails/example/view_example_group_spec.rb +1 -1
- data/spec/spec/rails/extensions/action_view_base_spec.rb +1 -1
- data/spec/spec/rails/extensions/active_record_spec.rb +1 -1
- data/spec/spec/rails/interop/testcase_spec.rb +1 -1
- data/spec/spec/rails/matchers/ar_be_valid_spec.rb +11 -37
- data/spec/spec/rails/matchers/assert_select_spec.rb +1 -1
- data/spec/spec/rails/matchers/errors_on_spec.rb +1 -1
- data/spec/spec/rails/matchers/have_text_spec.rb +1 -1
- data/spec/spec/rails/matchers/include_text_spec.rb +1 -1
- data/spec/spec/rails/matchers/redirect_to_spec.rb +1 -1
- data/spec/spec/rails/matchers/render_template_spec.rb +8 -1
- data/spec/spec/rails/matchers/should_change_spec.rb +1 -1
- data/spec/spec/rails/mocks/mock_model_spec.rb +1 -1
- data/spec/spec/rails/mocks/stub_model_spec.rb +1 -1
- data/spec/spec/rails/sample_modified_fixture.rb +1 -1
- data/spec/spec/rails/sample_spec.rb +1 -1
- data/spec/spec/rails/spec_spec.rb +1 -1
- data/spec/spec_helper.rb +23 -24
- metadata +11 -12
- data/generators/rspec/templates/script/spec_server +0 -9
- data/lib/spec/rails/spec_server.rb +0 -135
- data/spec/spec/rails/spec_server_spec.rb +0 -108
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
[:response, :controller].each do |subject_method|
|
4
4
|
['isolation','integration'].each do |mode|
|
@@ -69,6 +69,13 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|
69
69
|
should render_template('non_existent_template')
|
70
70
|
end.should fail_with(/expected \"non_existent_template\", got \"render_spec\/some_action(\.html\.erb)?\"/)
|
71
71
|
end
|
72
|
+
|
73
|
+
it "fails when redirected" do
|
74
|
+
post :action_with_redirect
|
75
|
+
lambda do
|
76
|
+
should render_template(:some_action)
|
77
|
+
end.should fail_with(/expected \"some_action\", got redirected to \"http:\/\/test.host\/render_spec\/some_action\"/)
|
78
|
+
end
|
72
79
|
|
73
80
|
it "fails when template is associated with a different controller but controller is not specified" do
|
74
81
|
post 'action_which_renders_template_from_other_controller'
|
data/spec/spec_helper.rb
CHANGED
@@ -1,36 +1,35 @@
|
|
1
|
-
|
2
|
-
$LOAD_PATH.unshift
|
3
|
-
$LOAD_PATH.unshift
|
4
|
-
$LOAD_PATH.unshift
|
5
|
-
require File.expand_path("#{dir}/../../../../spec/spec_helper")
|
6
|
-
require File.expand_path("#{dir}/resources/controllers/application")
|
7
|
-
require File.expand_path("#{dir}/resources/controllers/render_spec_controller")
|
8
|
-
require File.expand_path("#{dir}/resources/controllers/controller_spec_controller")
|
9
|
-
require File.expand_path("#{dir}/resources/controllers/rjs_spec_controller")
|
10
|
-
require File.expand_path("#{dir}/resources/controllers/redirect_spec_controller")
|
11
|
-
require File.expand_path("#{dir}/resources/controllers/action_view_base_spec_controller")
|
12
|
-
require File.expand_path("#{dir}/resources/helpers/addition_helper")
|
13
|
-
require File.expand_path("#{dir}/resources/helpers/explicit_helper")
|
14
|
-
require File.expand_path("#{dir}/resources/helpers/more_explicit_helper")
|
15
|
-
require File.expand_path("#{dir}/resources/helpers/view_spec_helper")
|
16
|
-
require File.expand_path("#{dir}/resources/helpers/plugin_application_helper")
|
1
|
+
$LOAD_PATH.unshift '../rspec/lib'
|
2
|
+
$LOAD_PATH.unshift '../../../'
|
3
|
+
$LOAD_PATH.unshift 'spec/resources/controllers'
|
4
|
+
$LOAD_PATH.unshift 'spec/resources/helpers'
|
17
5
|
|
18
|
-
require
|
19
|
-
require File.expand_path("#{dir}/resources/models/person")
|
20
|
-
require File.expand_path("#{dir}/resources/models/thing")
|
6
|
+
require '../../../spec/spec_helper'
|
21
7
|
|
22
|
-
|
8
|
+
require 'spec/resources/controllers/application'
|
9
|
+
require 'spec/resources/controllers/render_spec_controller'
|
10
|
+
require 'spec/resources/controllers/controller_spec_controller'
|
11
|
+
require 'spec/resources/controllers/rjs_spec_controller'
|
12
|
+
require 'spec/resources/controllers/redirect_spec_controller'
|
13
|
+
require 'spec/resources/controllers/action_view_base_spec_controller'
|
14
|
+
require 'spec/resources/helpers/addition_helper'
|
15
|
+
require 'spec/resources/helpers/explicit_helper'
|
16
|
+
require 'spec/resources/helpers/more_explicit_helper'
|
17
|
+
require 'spec/resources/helpers/view_spec_helper'
|
18
|
+
require 'spec/resources/helpers/plugin_application_helper'
|
19
|
+
require 'spec/resources/models/animal'
|
20
|
+
require 'spec/resources/models/person'
|
21
|
+
require 'spec/resources/models/thing'
|
23
22
|
|
24
|
-
unless ActionController::Routing.controller_paths.include?(
|
23
|
+
unless ActionController::Routing.controller_paths.include?('spec/resources/controllers')
|
25
24
|
ActionController::Routing.instance_eval {@possible_controllers = nil}
|
26
|
-
ActionController::Routing.controller_paths <<
|
25
|
+
ActionController::Routing.controller_paths << 'spec/resources/controllers'
|
27
26
|
end
|
28
27
|
|
29
28
|
module Spec
|
30
29
|
module Rails
|
31
30
|
module Example
|
32
31
|
class ViewExampleGroupController
|
33
|
-
prepend_view_path
|
32
|
+
prepend_view_path 'spec/resources/views'
|
34
33
|
end
|
35
34
|
end
|
36
35
|
end
|
@@ -56,7 +55,7 @@ ActionController::Routing::Routes.draw do |map|
|
|
56
55
|
|
57
56
|
map.resources :rspec_on_rails_specs
|
58
57
|
map.custom_route 'custom_route', :controller => 'custom_route_spec', :action => 'custom_route'
|
59
|
-
map.connect
|
58
|
+
map.connect ':controller/:action/:id'
|
60
59
|
end
|
61
60
|
|
62
61
|
module HelperMethods
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RSpec Development Team
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-10-05 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.2.
|
23
|
+
version: 1.2.9
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rack
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 1.0.0
|
34
34
|
version:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: cucumber
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 0.3.
|
43
|
+
version: 0.3.99
|
44
44
|
version:
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
46
|
name: hoe
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 2.
|
53
|
+
version: 2.3.3
|
54
54
|
version:
|
55
55
|
description: Behaviour Driven Development for Ruby on Rails.
|
56
56
|
email:
|
@@ -66,6 +66,7 @@ extra_rdoc_files:
|
|
66
66
|
- generators/rspec/templates/previous_failures.txt
|
67
67
|
files:
|
68
68
|
- .document
|
69
|
+
- Contribute.rdoc
|
69
70
|
- History.rdoc
|
70
71
|
- License.txt
|
71
72
|
- Manifest.txt
|
@@ -82,7 +83,6 @@ files:
|
|
82
83
|
- generators/rspec/templates/rspec.rake
|
83
84
|
- generators/rspec/templates/script/autospec
|
84
85
|
- generators/rspec/templates/script/spec
|
85
|
-
- generators/rspec/templates/script/spec_server
|
86
86
|
- generators/rspec/templates/spec.opts
|
87
87
|
- generators/rspec/templates/spec_helper.rb
|
88
88
|
- generators/rspec_controller/USAGE
|
@@ -136,8 +136,8 @@ files:
|
|
136
136
|
- lib/spec/rails/matchers/include_text.rb
|
137
137
|
- lib/spec/rails/matchers/redirect_to.rb
|
138
138
|
- lib/spec/rails/matchers/render_template.rb
|
139
|
+
- lib/spec/rails/matchers/route_to.rb
|
139
140
|
- lib/spec/rails/mocks.rb
|
140
|
-
- lib/spec/rails/spec_server.rb
|
141
141
|
- lib/spec/rails/version.rb
|
142
142
|
- spec/autotest/mappings_spec.rb
|
143
143
|
- spec/rails_suite.rb
|
@@ -228,7 +228,6 @@ files:
|
|
228
228
|
- spec/spec/rails/mocks/stub_model_spec.rb
|
229
229
|
- spec/spec/rails/sample_modified_fixture.rb
|
230
230
|
- spec/spec/rails/sample_spec.rb
|
231
|
-
- spec/spec/rails/spec_server_spec.rb
|
232
231
|
- spec/spec/rails/spec_spec.rb
|
233
232
|
- spec/spec_helper.rb
|
234
233
|
has_rdoc: true
|
@@ -238,7 +237,7 @@ licenses: []
|
|
238
237
|
post_install_message: |
|
239
238
|
**************************************************
|
240
239
|
|
241
|
-
Thank you for installing rspec-rails-1.2.
|
240
|
+
Thank you for installing rspec-rails-1.2.9
|
242
241
|
|
243
242
|
If you are upgrading, do this in each of your rails apps
|
244
243
|
that you want to upgrade:
|
@@ -270,9 +269,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
270
269
|
requirements: []
|
271
270
|
|
272
271
|
rubyforge_project: rspec
|
273
|
-
rubygems_version: 1.3.
|
272
|
+
rubygems_version: 1.3.5
|
274
273
|
signing_key:
|
275
274
|
specification_version: 3
|
276
|
-
summary: rspec-rails 1.2.
|
275
|
+
summary: rspec-rails 1.2.9
|
277
276
|
test_files: []
|
278
277
|
|
@@ -1,9 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
|
3
|
-
|
4
|
-
puts "Loading Rails environment"
|
5
|
-
ENV["RAILS_ENV"] ||= 'test'
|
6
|
-
require File.expand_path(File.dirname(__FILE__) + "/../config/environment") unless defined?(RAILS_ROOT)
|
7
|
-
|
8
|
-
require 'optparse'
|
9
|
-
require 'spec/rails/spec_server'
|
@@ -1,135 +0,0 @@
|
|
1
|
-
require 'spec/deprecation'
|
2
|
-
Spec.deprecate('spec_server', 'spork (gem install spork)')
|
3
|
-
|
4
|
-
if Rails::VERSION::STRING >= '2.2' && Rails.configuration.cache_classes
|
5
|
-
raise <<-MESSAGE
|
6
|
-
|
7
|
-
#{'*'*65}
|
8
|
-
|
9
|
-
Rails.configuration.cache_classes == true
|
10
|
-
|
11
|
-
This means that spec_server won't reload your classes when
|
12
|
-
you change them, which defeats the purpose of spec_server.
|
13
|
-
|
14
|
-
Please set 'config.cache_classes = false' (it's probably
|
15
|
-
set to true in config/environments/test.rb) and give it
|
16
|
-
another try.
|
17
|
-
|
18
|
-
#{'*'*65}
|
19
|
-
MESSAGE
|
20
|
-
end
|
21
|
-
|
22
|
-
require 'drb/drb'
|
23
|
-
require 'rbconfig'
|
24
|
-
|
25
|
-
# This is based on Florian Weber's TDDMate
|
26
|
-
module Spec
|
27
|
-
module Rails
|
28
|
-
class SpecServer
|
29
|
-
class << self
|
30
|
-
def restart_test_server
|
31
|
-
puts "restarting"
|
32
|
-
config = ::Config::CONFIG
|
33
|
-
ruby = File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT']
|
34
|
-
command_line = [ruby, $0, ARGV].flatten.join(' ')
|
35
|
-
exec(command_line)
|
36
|
-
end
|
37
|
-
|
38
|
-
def daemonize(pid_file = nil)
|
39
|
-
return yield if $DEBUG
|
40
|
-
pid = Process.fork{
|
41
|
-
Process.setsid
|
42
|
-
Dir.chdir(RAILS_ROOT)
|
43
|
-
trap("SIGINT"){ exit! 0 }
|
44
|
-
trap("SIGTERM"){ exit! 0 }
|
45
|
-
trap("SIGHUP"){ restart_test_server }
|
46
|
-
File.open("/dev/null"){|f|
|
47
|
-
STDERR.reopen f
|
48
|
-
STDIN.reopen f
|
49
|
-
STDOUT.reopen f
|
50
|
-
}
|
51
|
-
run
|
52
|
-
}
|
53
|
-
puts "spec_server launched (PID: %d)" % pid
|
54
|
-
File.open(pid_file,"w"){|f| f.puts pid } if pid_file
|
55
|
-
exit! 0
|
56
|
-
end
|
57
|
-
|
58
|
-
def run
|
59
|
-
trap("USR2") { ::Spec::Rails::SpecServer.restart_test_server } if Signal.list.has_key?("USR2")
|
60
|
-
DRb.start_service("druby://127.0.0.1:8989", ::Spec::Rails::SpecServer.new)
|
61
|
-
DRb.thread.join
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def run(argv, stderr, stdout)
|
66
|
-
$stdout = stdout
|
67
|
-
$stderr = stderr
|
68
|
-
|
69
|
-
::Rails::Configuration.extend Module.new {def cache_classes; false; end}
|
70
|
-
|
71
|
-
::ActiveSupport.const_defined?(:Dependencies) ?
|
72
|
-
::ActiveSupport::Dependencies.mechanism = :load :
|
73
|
-
::Dependencies.mechanism = :load
|
74
|
-
|
75
|
-
require 'action_controller/dispatcher'
|
76
|
-
dispatcher = ::ActionController::Dispatcher.new($stdout)
|
77
|
-
|
78
|
-
if ::ActionController::Dispatcher.respond_to?(:reload_application)
|
79
|
-
::ActionController::Dispatcher.reload_application
|
80
|
-
else
|
81
|
-
dispatcher.reload_application
|
82
|
-
end
|
83
|
-
|
84
|
-
if Object.const_defined?(:Fixtures) && Fixtures.respond_to?(:reset_cache)
|
85
|
-
Fixtures.reset_cache
|
86
|
-
end
|
87
|
-
|
88
|
-
unless Object.const_defined?(:ApplicationController)
|
89
|
-
%w(application_controller.rb application.rb).each do |name|
|
90
|
-
require_dependency(name) if File.exists?("#{RAILS_ROOT}/app/controllers/#{name}")
|
91
|
-
end
|
92
|
-
end
|
93
|
-
load "#{RAILS_ROOT}/spec/spec_helper.rb"
|
94
|
-
|
95
|
-
if in_memory_database?
|
96
|
-
load "#{RAILS_ROOT}/db/schema.rb"
|
97
|
-
ActiveRecord::Migrator.up('db/migrate')
|
98
|
-
end
|
99
|
-
|
100
|
-
::Spec::Runner::CommandLine.run(
|
101
|
-
::Spec::Runner::OptionParser.parse(
|
102
|
-
argv,
|
103
|
-
$stderr,
|
104
|
-
$stdout
|
105
|
-
)
|
106
|
-
)
|
107
|
-
|
108
|
-
if ::ActionController::Dispatcher.respond_to?(:cleanup_application)
|
109
|
-
::ActionController::Dispatcher.cleanup_application
|
110
|
-
else
|
111
|
-
dispatcher.cleanup_application
|
112
|
-
end
|
113
|
-
|
114
|
-
end
|
115
|
-
|
116
|
-
def in_memory_database?
|
117
|
-
ENV["RAILS_ENV"] == "test" and
|
118
|
-
::ActiveRecord::Base.connection.class.to_s == "ActiveRecord::ConnectionAdapters::SQLite3Adapter" and
|
119
|
-
::Rails::Configuration.new.database_configuration['test']['database'] == ':memory:'
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
options = Hash.new
|
126
|
-
parser = OptionParser.new
|
127
|
-
parser.on("-d", "--daemon") {|ignore| options[:daemon] = true }
|
128
|
-
parser.on("-p", "--pid PIDFILE"){|pid| options[:pid] = pid }
|
129
|
-
parser.parse!(ARGV)
|
130
|
-
|
131
|
-
if options[:daemon]
|
132
|
-
::Spec::Rails::SpecServer.daemonize(options[:pid])
|
133
|
-
else
|
134
|
-
::Spec::Rails::SpecServer.run
|
135
|
-
end
|
@@ -1,108 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
-
|
3
|
-
shared_examples_for "script/spec_server file" do
|
4
|
-
attr_accessor :tmbundle_install_directory, :tmbundle_source_directory
|
5
|
-
attr_reader :animals_yml_path, :original_animals_content
|
6
|
-
|
7
|
-
before do
|
8
|
-
@animals_yml_path = File.expand_path("#{RAILS_ROOT}/spec/fixtures/animals.yml")
|
9
|
-
@original_animals_content = File.read(animals_yml_path)
|
10
|
-
end
|
11
|
-
|
12
|
-
after do
|
13
|
-
File.open(animals_yml_path, "w") do |f|
|
14
|
-
f.write original_animals_content
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
after(:each) do
|
19
|
-
system "lsof -i tcp:8989 | sed /COMMAND/d | awk '{print $2}' | xargs kill"
|
20
|
-
end
|
21
|
-
|
22
|
-
it "runs a spec" do
|
23
|
-
dir = File.expand_path(File.dirname(__FILE__))
|
24
|
-
output = ""
|
25
|
-
Timeout.timeout(20) do
|
26
|
-
loop do
|
27
|
-
output = `#{RAILS_ROOT}/script/spec #{dir}/sample_spec.rb --drb 2>&1`
|
28
|
-
break unless output.include?("No server is running")
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
if $?.exitstatus != 0 || output !~ /0 failures/
|
33
|
-
flunk "command 'script/spec spec/sample_spec' failed\n#{output}"
|
34
|
-
end
|
35
|
-
|
36
|
-
fixtures = YAML.load(@original_animals_content)
|
37
|
-
fixtures['pig']['name'] = "Piggy"
|
38
|
-
|
39
|
-
File.open(animals_yml_path, "w") do |f|
|
40
|
-
f.write YAML.dump(fixtures)
|
41
|
-
end
|
42
|
-
|
43
|
-
Timeout.timeout(20) do
|
44
|
-
loop do
|
45
|
-
output = `#{RAILS_ROOT}/script/spec #{dir}/sample_modified_fixture.rb --drb 2>&1`
|
46
|
-
break unless output.include?("No server is running")
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
if $?.exitstatus != 0 || output !~ /0 failures/
|
51
|
-
flunk "command 'script/spec spec/sample_modified_fixture' failed\n#{output}"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def start_spec_server
|
56
|
-
dir = File.dirname(__FILE__)
|
57
|
-
|
58
|
-
Thread.start do
|
59
|
-
system "cd #{RAILS_ROOT}; CACHE_CLASSES=#{(Rails::VERSION::STRING < '2.2')} script/spec_server"
|
60
|
-
end
|
61
|
-
|
62
|
-
file_content = ""
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe "script/spec_server file without TextMate bundle" do
|
67
|
-
it_should_behave_like "script/spec_server file"
|
68
|
-
before(:each) do
|
69
|
-
start_spec_server
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
describe "script/spec_server file with TextMate bundle" do
|
74
|
-
it_should_behave_like "script/spec_server file"
|
75
|
-
def tmbundle_directory
|
76
|
-
current_directory = File.expand_path("#{File.dirname(__FILE__)}/../../../../../../")
|
77
|
-
directories = current_directory.split('/')
|
78
|
-
while directories.any?
|
79
|
-
current_directory = File.join(*directories)
|
80
|
-
bundle_directory = File.join(current_directory, @bundle_name)
|
81
|
-
return bundle_directory if File.directory?(bundle_directory)
|
82
|
-
directories.pop
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
before(:each) do
|
87
|
-
@tmbundle_install_directory = File.expand_path("#{Dir.tmpdir}/Library/Application Support/TextMate/Bundles")
|
88
|
-
@bundle_name = "RSpec.tmbundle"
|
89
|
-
@tmbundle_source_directory = tmbundle_directory
|
90
|
-
|
91
|
-
FileUtils.mkdir_p(tmbundle_install_directory)
|
92
|
-
File.directory?(tmbundle_source_directory).should be_true
|
93
|
-
unless system(%Q|ln -s #{tmbundle_source_directory} "#{tmbundle_install_directory}"|)
|
94
|
-
raise "Creating link to Textmate Bundle"
|
95
|
-
end
|
96
|
-
start_spec_server
|
97
|
-
end
|
98
|
-
|
99
|
-
after(:each) do
|
100
|
-
bundle_file_to_remove = "#{tmbundle_install_directory}/#{@bundle_name}"
|
101
|
-
if bundle_file_to_remove == "/"
|
102
|
-
raise "bundle file path resolved to '/' - could not call rm"
|
103
|
-
end
|
104
|
-
unless system(%Q|rm "#{bundle_file_to_remove}"|)
|
105
|
-
raise "Removing Textmate bundle link failed"
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|