rspec-rails 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/.document CHANGED
@@ -1,7 +1,7 @@
1
1
  lib/**/*.rb
2
- History.txt
2
+ History.rdoc
3
3
  License.txt
4
- README.txt
5
- Upgrade.markdown
4
+ README.rdoc
5
+ Upgrade.rdoc
6
6
  features/**/*.feature
7
7
 
@@ -1,10 +1,33 @@
1
- === Version 1.1.99.x (in git)
1
+ === Version 1.2.1 / 2009-03-22
2
2
 
3
- IMPORTANT: See Upgrade.markdown for information about upgrading to rspec-rails-1.1.99.4
3
+ IMPORTANT: See Upgrade.rdoc for information about upgrading to rspec-rails-1.2.1
4
+
5
+ * enhancements
6
+
7
+ * more cleanup of internals (reducing dependency on rspec-core)
8
+ * don't require config/environments more than once
9
+ * autotest includes spec/routing directory (Matt Peterson). Closes #739.
10
+ * display helpful messages when installing rspec-rails running script/generate rspec
11
+ * thanks for Dr Nic for the pointers
12
+ * restored require 'rubygems' where needed
13
+ * export NO_RUBYGEMS=true if you don't use rubygems
14
+
15
+ * bug fixes
16
+
17
+ * fix scoping issues in rspec-rails' own suite for ruby 1.9.1 (Matthias
18
+ Hennemeyer). Closes #717.
19
+ * rake stats no longer hides test directories. Closes #748.
20
+ * fixed regression that was introduced in 1.2 in which controller_name
21
+ failed to override the controller class passed to describe() (patches from
22
+ Aaron Gibralter and Zach Dennis). Closes #732.
23
+
24
+ === Version 1.2.0 / 2009-03-15
25
+
26
+ IMPORTANT: See Upgrade.rdoc for information about upgrading to rspec-rails-1.2.0
4
27
 
5
28
  IMPORTANT: This release includes the following backwards-compatibility-breaking changes.
6
29
 
7
- * rspec-rails supports rails 2.0.2, 2.1.2 and 2.2.2.
30
+ * rspec-rails supports rails 2.0.2, 2.1.2, 2.2.2 and 2.3.2
8
31
 
9
32
  * We are no longer supporting 1.x versions of rails.
10
33
 
@@ -1,11 +1,11 @@
1
1
  .document
2
- History.txt
2
+ History.rdoc
3
3
  License.txt
4
4
  Manifest.txt
5
- README.txt
5
+ README.rdoc
6
6
  Rakefile
7
7
  TODO.txt
8
- Upgrade.markdown
8
+ Upgrade.rdoc
9
9
  features/step_definitions/people.rb
10
10
  features/support/env.rb
11
11
  features/transactions/transactions_should_rollback.feature
File without changes
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
- require 'rubygems'
1
+ # -*- ruby -*-
2
+ gem 'hoe', '>=1.9.0'
2
3
  require 'hoe'
3
4
  require './lib/spec/rails/version'
4
5
  require 'cucumber/rake/task'
@@ -7,22 +8,32 @@ $:.unshift(File.join(File.dirname(__FILE__), "/../rspec/lib"))
7
8
 
8
9
  require 'spec/rake/spectask'
9
10
 
10
- class Hoe
11
- def extra_deps
12
- @extra_deps.reject! { |x| Array(x).first == 'hoe' }
13
- @extra_deps
14
- end
15
- end
16
-
17
11
  Hoe.new('rspec-rails', Spec::Rails::VERSION::STRING) do |p|
18
12
  p.summary = Spec::Rails::VERSION::SUMMARY
19
13
  p.url = 'http://rspec.info/'
20
14
  p.description = "Behaviour Driven Development for Ruby on Rails."
21
15
  p.rubyforge_name = 'rspec'
22
16
  p.developer('RSpec Development Team', 'rspec-devel@rubyforge.org')
23
- p.extra_deps = [["rspec","1.2.0"],["rack",">=0.4.0"]]
24
- p.extra_dev_deps = [["cucumber",">= 0.1.13"]]
17
+ p.extra_deps = [["rspec","1.2.1"],["rack",">=0.4.0"]]
18
+ p.extra_dev_deps = [["cucumber",">= 0.1.16"]]
25
19
  p.remote_rdoc_dir = "rspec-rails/#{Spec::Rails::VERSION::STRING}"
20
+ p.history_file = 'History.rdoc'
21
+ p.readme_file = 'README.rdoc'
22
+ p.post_install_message = <<-POST_INSTALL_MESSAGE
23
+ #{'*'*50}
24
+
25
+ Thank you for installing rspec-rails-#{Spec::Rails::VERSION::STRING}
26
+
27
+ If you are upgrading, do this in each of your rails apps
28
+ that you want to upgrade:
29
+
30
+ $ ruby script/generate rspec
31
+
32
+ Please be sure to read History.rdoc and Upgrade.rdoc
33
+ for useful information about this release.
34
+
35
+ #{'*'*50}
36
+ POST_INSTALL_MESSAGE
26
37
  end
27
38
 
28
39
  ['audit','test','test_deps','default','post_blog', 'release'].each do |task|
@@ -1,8 +1,8 @@
1
- # Upgrade to rspec-rails-1.1.99.x (pre rspec-rails-1.2)
1
+ = Upgrade to 1.2.0
2
2
 
3
- ## What's changed
3
+ == What's changed
4
4
 
5
- ### Supported Rails Versions
5
+ === Supported Rails Versions
6
6
 
7
7
  This release supports the following versions of rails:
8
8
 
@@ -11,7 +11,7 @@ This release supports the following versions of rails:
11
11
  * 2.2.2
12
12
  * 2.3.1
13
13
 
14
- ### update generated files
14
+ === update generated files
15
15
 
16
16
  Be sure to run "script/generate rspec" and allow the following files to be overwritten:
17
17
 
@@ -19,20 +19,20 @@ Be sure to run "script/generate rspec" and allow the following files to be overw
19
19
  * script/spec
20
20
  * script/spec_server
21
21
 
22
- ### ``controller.use_rails_error_handling!`` is deprecated
22
+ === controller.use_rails_error_handling! is deprecated
23
23
 
24
- Use ``rescue_action_in_public!`` instead. It comes directly from rails and does
24
+ Use <tt>rescue_action_in_public!</tt> instead. It comes directly from rails and does
25
25
  exactly the same thing
26
26
 
27
- ### route_for
27
+ === route_for
28
28
 
29
- After a change to edge rails broke our monkey-patched ``route_for`` method, I
30
- decided to just delegate to rails' ``assert_generates`` method. For most cases,
29
+ After a change to edge rails broke our monkey-patched <tt>route_for</tt> method, I
30
+ decided to just delegate to rails' <tt>assert_generates</tt> method. For most cases,
31
31
  this will not present a problem, but for some it might. You'll know if you
32
32
  upgrade and see any newly failing, route-related examples. Here are the things
33
33
  that you might need to change.
34
34
 
35
- #### Make sure IDs are strings
35
+ ==== Make sure IDs are strings
36
36
 
37
37
  If you had :id => 1 before, you need to change that to :id => "1"
38
38
 
@@ -42,7 +42,7 @@ If you had :id => 1 before, you need to change that to :id => "1"
42
42
  #new
43
43
  route_for(:controller => 'things', :action => 'show', :id => "1").should == "/things/1"
44
44
 
45
- #### Convert paths for non-get methods to hashes
45
+ ==== Convert paths for non-get methods to hashes
46
46
 
47
47
  If you had an example with a route that requires post, put, or delete, you'll
48
48
  need to declare that explicitly.
@@ -53,23 +53,23 @@ need to declare that explicitly.
53
53
  #new
54
54
  route_for(:controller => 'things', :action => 'create').should == {:path => "/things", :method => :post}
55
55
 
56
- ### Controller/template isolation
56
+ === Controller/template isolation
57
57
 
58
58
  Even though controller specs do not render views by default (use
59
- ``integrate_views`` to get them to render views), the way this works has
59
+ <tt>integrate_views</tt> to get them to render views), the way this works has
60
60
  changed in this version.
61
61
 
62
62
  It used to be that the view template need not even exist, but due to changes
63
63
  in rails it became much more difficult to manage that for all the different
64
64
  versions of rails that rspec-rails supports. So now the template must exist,
65
- but it still won't be rendered unless you declare ``integrate_views``.
65
+ but it still won't be rendered unless you declare <tt>integrate_views</tt>.
66
66
 
67
- ## What's new
67
+ == What's new
68
68
 
69
- ### render no longer requires a path
69
+ === render no longer requires a path
70
70
 
71
- The ``render()`` method in view specs will infer the path from the
72
- first argument passed to ``describe()``.
71
+ The <tt>render()</tt> method in view specs will infer the path from the
72
+ first argument passed to <tt>describe()</tt>.
73
73
 
74
74
  describe "players/show" do
75
75
  it "does something" do
@@ -78,16 +78,16 @@ first argument passed to ``describe()``.
78
78
  end
79
79
  end
80
80
 
81
- ### routing specs live in spec/routing
81
+ === routing specs live in spec/routing
82
82
 
83
- ``script/generate rspec_scaffold`` now generates its routing spec in
84
- ``spec/routing/``.
83
+ <tt>script/generate rspec_scaffold</tt> now generates its routing spec in
84
+ <tt>spec/routing/</tt>.
85
85
 
86
- ### bypass_rescue
86
+ === bypass_rescue
87
87
 
88
- Added a new ``bypass_rescue()`` declaration for controller specs. Use this
88
+ Added a new <tt>bypass_rescue()</tt> declaration for controller specs. Use this
89
89
  when you want to specify that an error is raised by an action, even if that
90
- error is later captured by a ``rescue_from()`` declaration.
90
+ error is later captured by a <tt>rescue_from()</tt> declaration.
91
91
 
92
92
  describe AccountController do
93
93
  describe "GET @account" do
@@ -6,6 +6,23 @@ class RspecGenerator < Rails::Generator::Base
6
6
  Config::CONFIG['ruby_install_name'])
7
7
 
8
8
  def initialize(runtime_args, runtime_options = {})
9
+ if test ?f, 'spec/spec_helper.rb'
10
+
11
+ puts <<-HELPFUL_INSTRUCTIONS
12
+
13
+ It looks like you are upgrading rspec-rails in this application. Please let
14
+ this script overwrite everything it wants to with the following exceptions,
15
+ *if* you have customized any of these files:
16
+
17
+ * spec/spec.opts
18
+ * spec/rcov.opts
19
+ * spec/spec_helper.rb
20
+
21
+ If you have customized spec/spec_helper.rb, please set aside a copy of that
22
+ file so that it can be updated and you can manually restore your changes.
23
+
24
+ HELPFUL_INSTRUCTIONS
25
+ end
9
26
  Dir.mkdir('lib/tasks') unless File.directory?('lib/tasks')
10
27
  super
11
28
  end
@@ -1,19 +1,4 @@
1
1
  gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
2
- rspec_gem_dir = nil
3
- Dir["#{RAILS_ROOT}/vendor/gems/*"].each do |subdir|
4
- rspec_gem_dir = subdir if subdir.gsub("#{RAILS_ROOT}/vendor/gems/","") =~ /^(\w+-)?rspec-(\d+)/ && File.exist?("#{subdir}/lib/spec/rake/spectask.rb")
5
- end
6
- rspec_plugin_dir = File.expand_path(File.dirname(__FILE__) + '/../../vendor/plugins/rspec')
7
-
8
- if rspec_gem_dir && (test ?d, rspec_plugin_dir)
9
- raise "\n#{'*'*50}\nYou have rspec installed in both vendor/gems and vendor/plugins\nPlease pick one and dispose of the other.\n#{'*'*50}\n\n"
10
- end
11
-
12
- if rspec_gem_dir
13
- $LOAD_PATH.unshift("#{rspec_gem_dir}/lib")
14
- elsif File.exist?(rspec_plugin_dir)
15
- $LOAD_PATH.unshift("#{rspec_plugin_dir}/lib")
16
- end
17
2
 
18
3
  # Don't load rspec if running "rake gems:*"
19
4
  unless ARGV.any? {|a| a =~ /^gems/}
@@ -120,7 +105,6 @@ namespace :spec do
120
105
  ::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers')
121
106
  ::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib')
122
107
  ::CodeStatistics::TEST_TYPES << "Routing specs" if File.exist?('spec/routing')
123
- ::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/}
124
108
  end
125
109
 
126
110
  namespace :db do
@@ -1,22 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
- gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
3
- rails_root = File.expand_path(File.dirname(__FILE__) + "/..")
4
- rspec_gem_dir = nil
5
- Dir["#{rails_root}/vendor/gems/*"].each do |subdir|
6
- rspec_gem_dir = subdir if subdir.gsub("#{rails_root}/vendor/gems/","") =~ /^(\w+-)?rspec-(\d+)/ && File.exist?("#{subdir}/lib/spec/rake/spectask.rb")
2
+ if ARGV.any? {|arg| %w[--drb -X --generate-options -G --help -h --version -v].include?(arg)}
3
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
4
+ else
5
+ gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
6
+ ENV["RAILS_ENV"] ||= 'test'
7
+ require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
7
8
  end
8
- rspec_plugin_dir = File.expand_path("#{rails_root}/vendor/plugins/rspec")
9
-
10
- if rspec_gem_dir && (test ?d, rspec_plugin_dir)
11
- raise "\n#{'*'*50}\nYou have rspec installed in both vendor/gems and vendor/plugins\nPlease pick one and dispose of the other.\n#{'*'*50}\n\n"
12
- end
13
-
14
- if rspec_gem_dir
15
- $LOAD_PATH.unshift("#{rspec_gem_dir}/lib")
16
- elsif File.exist?(rspec_plugin_dir)
17
- $LOAD_PATH.unshift("#{rspec_plugin_dir}/lib")
18
- end
19
-
20
-
21
9
  require 'spec/autorun'
22
10
  exit ::Spec::Runner::CommandLine.run
@@ -1,52 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
  gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
3
- rails_root = File.expand_path(File.dirname(__FILE__) + "/..")
4
- rspec_rails_gem_dir = nil
5
- Dir["#{rails_root}/vendor/gems/*"].each do |subdir|
6
- rspec_rails_gem_dir = subdir if subdir.gsub("#{rails_root}/vendor/gems/","") =~ /^(\w+-)?rspec-rails-(\d+)/
7
- end
8
- rspec_rails_plugin_dir = File.expand_path("#{rails_root}/vendor/plugins/rspec-rails")
9
3
 
10
- if rspec_rails_gem_dir && (test ?d, rspec_rails_plugin_dir)
11
- raise "\n#{'*'*50}\nYou have rspec installed in both vendor/gems and vendor/plugins\nPlease pick one and dispose of the other.\n#{'*'*50}\n\n"
12
- end
13
-
14
- if rspec_rails_gem_dir
15
- $LOAD_PATH.unshift("#{rspec_rails_gem_dir}/lib")
16
- elsif File.exist?(rspec_rails_plugin_dir)
17
- $LOAD_PATH.unshift("#{rspec_rails_plugin_dir}/lib")
18
- end
4
+ puts "Loading Rails environment"
5
+ ENV["RAILS_ENV"] ||= 'test'
6
+ require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
19
7
 
20
8
  require 'optparse'
21
9
  require 'spec/rails/spec_server'
22
-
23
- puts "Loading Rails environment"
24
-
25
- ENV["RAILS_ENV"] = "test"
26
- require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
27
-
28
- if Rails::VERSION::STRING >= '2.2' && Rails.configuration.cache_classes
29
- warn <<-MESSAGE
30
-
31
- #{'*'*50}
32
-
33
- spec_server won't reload your classes if config.cache_classes
34
- is set to true. Please modify environment/test.rb:
35
-
36
- config.cache_classes = false
37
-
38
- #{'*'*50}
39
- MESSAGE
40
- end
41
-
42
- options = Hash.new
43
- parser = OptionParser.new
44
- parser.on("-d", "--daemon") {|ignore| options[:daemon] = true }
45
- parser.on("-p", "--pid PIDFILE"){|pid| options[:pid] = pid }
46
- parser.parse!(ARGV)
47
-
48
- if options[:daemon]
49
- ::Spec::Rails::SpecServer.daemonize(options[:pid])
50
- else
51
- ::Spec::Rails::SpecServer.run
52
- end
@@ -1,7 +1,7 @@
1
1
  # This file is copied to ~/spec when you run 'ruby script/generate rspec'
2
2
  # from the project root directory.
3
- ENV["RAILS_ENV"] = "test"
4
- require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
3
+ ENV["RAILS_ENV"] ||= 'test'
4
+ require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
5
5
  require 'spec/autorun'
6
6
  require 'spec/rails'
7
7
 
@@ -35,7 +35,7 @@ Autotest.add_hook :initialize do |at|
35
35
  at.add_mapping(%r%^(test|spec)/fixtures/(.*).yml$%) { |_, m|
36
36
  ["spec/models/#{m[2].singularize}_spec.rb"] + at.files_matching(%r%^spec\/views\/#{m[2]}/.*_spec\.rb$%)
37
37
  }
38
- at.add_mapping(%r%^spec/(models|controllers|views|helpers|lib)/.*rb$%) { |filename, _|
38
+ at.add_mapping(%r%^spec/(models|controllers|routing|views|helpers|lib)/.*rb$%) { |filename, _|
39
39
  filename
40
40
  }
41
41
  at.add_mapping(%r%^app/models/(.*)\.rb$%) { |_, m|
@@ -59,13 +59,13 @@ Autotest.add_hook :initialize do |at|
59
59
  end
60
60
  }
61
61
  at.add_mapping(%r%^config/routes\.rb$%) {
62
- at.files_matching %r%^spec/(controllers|views|helpers)/.*_spec\.rb$%
62
+ at.files_matching %r%^spec/(controllers|routing|views|helpers)/.*_spec\.rb$%
63
63
  }
64
64
  at.add_mapping(%r%^config/database\.yml$%) { |_, m|
65
65
  at.files_matching %r%^spec/models/.*_spec\.rb$%
66
66
  }
67
67
  at.add_mapping(%r%^(spec/(spec_helper|shared/.*)|config/(boot|environment(s/test)?))\.rb$%) {
68
- at.files_matching %r%^spec/(models|controllers|views|helpers)/.*_spec\.rb$%
68
+ at.files_matching %r%^spec/(models|controllers|routing|views|helpers)/.*_spec\.rb$%
69
69
  }
70
70
  at.add_mapping(%r%^lib/(.*)\.rb$%) { |_, m|
71
71
  ["spec/lib/#{m[1]}_spec.rb"]
@@ -22,7 +22,7 @@ require 'spec/rails/interop/testcase'
22
22
 
23
23
  Spec::Example::ExampleGroupFactory.default(ActiveSupport::TestCase)
24
24
 
25
- if ActionView::Base.respond_to?(:cache_template_extension)
25
+ if ActionView::Base.respond_to?(:cache_template_extensions)
26
26
  ActionView::Base.cache_template_extensions = false
27
27
  end
28
28
 
@@ -66,11 +66,16 @@ module Spec
66
66
  klass.subject { controller }
67
67
  super
68
68
  end
69
-
69
+
70
70
  def set_description(*args) # :nodoc:
71
71
  super
72
72
  if described_class && described_class.ancestors.include?(ActionController::Base)
73
- tests described_class
73
+ controller_klass = if superclass.controller_class.ancestors.include?(ActionController::Base)
74
+ superclass.controller_class
75
+ else
76
+ described_class
77
+ end
78
+ tests controller_klass
74
79
  end
75
80
  end
76
81
 
@@ -111,17 +116,16 @@ end
111
116
  MESSAGE
112
117
  end
113
118
  @controller.extend ControllerInstanceMethods
114
- @controller.integrate_views! if @integrate_views
119
+ @controller.integrate_views! if integrate_views?
115
120
  @controller.session = session
116
121
  end
117
122
 
118
123
  attr_reader :response, :request, :controller
119
-
120
- def initialize(defined_description, options={}, &implementation) #:nodoc:
121
- super
122
- @integrate_views = self.class.integrate_views?
123
- end
124
124
 
125
+ def integrate_views?
126
+ @integrate_views || self.class.integrate_views?
127
+ end
128
+
125
129
  # Bypasses any error rescues defined with rescue_from. Useful
126
130
  # in cases in which you want to specify errors coming out of
127
131
  # actions that might be caught by a rescue_from clause that is
@@ -5,8 +5,8 @@ module Spec #:nodoc:
5
5
  class Have #:nodoc:
6
6
 
7
7
  def failure_message_for_should_with_errors_on_extensions
8
- return "expected #{relativities[@relativity]}#{@expected} errors on :#{@args[0]}, got #{@given}" if @collection_name == :errors_on
9
- return "expected #{relativities[@relativity]}#{@expected} error on :#{@args[0]}, got #{@given}" if @collection_name == :error_on
8
+ return "expected #{relativities[@relativity]}#{@expected} errors on :#{@args[0]}, got #{@actual}" if @collection_name == :errors_on
9
+ return "expected #{relativities[@relativity]}#{@expected} error on :#{@args[0]}, got #{@actual}" if @collection_name == :error_on
10
10
  return failure_message_without_errors_on_extensions
11
11
  end
12
12
  alias_method_chain :failure_message_for_should, :errors_on_extensions
@@ -1,3 +1,21 @@
1
+ if Rails::VERSION::STRING >= '2.2' && Rails.configuration.cache_classes
2
+ raise <<-MESSAGE
3
+
4
+ #{'*'*65}
5
+
6
+ Rails.configuration.cache_classes == true
7
+
8
+ This means that spec_server won't reload your classes when
9
+ you change them, which defeats the purpose of spec_server.
10
+
11
+ Please set 'config.cache_classes = false' (it's probably
12
+ set to true in config/environments/test.rb) and give it
13
+ another try.
14
+
15
+ #{'*'*65}
16
+ MESSAGE
17
+ end
18
+
1
19
  require 'drb/drb'
2
20
  require 'rbconfig'
3
21
 
@@ -95,3 +113,15 @@ module Spec
95
113
  end
96
114
  end
97
115
  end
116
+
117
+ options = Hash.new
118
+ parser = OptionParser.new
119
+ parser.on("-d", "--daemon") {|ignore| options[:daemon] = true }
120
+ parser.on("-p", "--pid PIDFILE"){|pid| options[:pid] = pid }
121
+ parser.parse!(ARGV)
122
+
123
+ if options[:daemon]
124
+ ::Spec::Rails::SpecServer.daemonize(options[:pid])
125
+ else
126
+ ::Spec::Rails::SpecServer.run
127
+ end
@@ -1,16 +1,15 @@
1
- module Spec
2
- module Rails
3
- module VERSION #:nodoc:
1
+ module Spec # :nodoc:
2
+ module Rails # :nodoc:
3
+ module VERSION # :nodoc:
4
4
  unless defined? MAJOR
5
5
  MAJOR = 1
6
6
  MINOR = 2
7
- TINY = 0
8
- MINESCULE = nil
7
+ TINY = 1
9
8
 
10
- STRING = [MAJOR, MINOR, TINY, MINESCULE].compact.join('.')
9
+ STRING = [MAJOR, MINOR, TINY].compact.join('.')
11
10
 
12
11
  SUMMARY = "rspec-rails #{STRING}"
13
12
  end
14
13
  end
15
14
  end
16
- end
15
+ end
@@ -33,4 +33,54 @@ describe Autotest::RailsRspec, "file mapping" do
33
33
  to('app/views/things/index.html.erb')
34
34
  end
35
35
 
36
+ describe "between routes.rb and things which depend on routes" do
37
+ it "should map routes.rb to controllers" do
38
+ @autotest.should map_specs(['spec/controllers/things_controller_spec.rb']).
39
+ to('config/routes.rb')
40
+ end
41
+
42
+ it "should map routes.rb to views" do
43
+ @autotest.should map_specs(['spec/views/things/action.html.erb_spec.rb']).
44
+ to('config/routes.rb')
45
+ end
46
+
47
+ it "should map routes.rb to helpers" do
48
+ @autotest.should map_specs(['spec/helpers/things_helper_spec.rb']).
49
+ to('config/routes.rb')
50
+ end
51
+
52
+ it "should map routing example to routes" do
53
+ @autotest.should map_specs(['spec/routing/thing_spec.rb']).
54
+ to('config/routes.rb')
55
+ end
56
+ end
57
+
58
+ describe "between the config and specs" do
59
+ ['spec/controllers/things_controller_spec.rb',
60
+ 'spec/views/things/action.html.erb_spec.rb',
61
+ 'spec/helpers/things_helper_spec.rb',
62
+ 'spec/routing/thing_spec.rb',
63
+ 'spec/models/thing_spec.rb'].each do |file_path|
64
+
65
+ it "should map environment.rb to #{file_path}" do
66
+ @autotest.should map_specs([file_path]).
67
+ to('config/environment.rb')
68
+ end
69
+
70
+ it "should map environments/test.rb to #{file_path}" do
71
+ @autotest.should map_specs([file_path]).
72
+ to('config/environments/test.rb')
73
+ end
74
+
75
+ it "should map boot.rb to #{file_path}" do
76
+ @autotest.should map_specs([file_path]).
77
+ to('config/boot.rb')
78
+ end
79
+
80
+ it "should map spec_helper.rb to #{file_path}" do
81
+ @autotest.should map_specs([file_path]).
82
+ to('spec/spec_helper.rb')
83
+ end
84
+ end
85
+ end
36
86
  end
@@ -265,6 +265,25 @@ end
265
265
  module Spec
266
266
  module Rails
267
267
  module Example
268
+ describe ApplicationController, :type => :controller do
269
+ describe "controller_name" do
270
+ controller_name :controller_spec
271
+ it "overrides the controller class submitted to the outermost group" do
272
+ subject.should be_an_instance_of(ControllerSpecController)
273
+ end
274
+ describe "in a nested group" do
275
+ it "overrides the controller class submitted to the outermost group" do
276
+ subject.should be_an_instance_of(ControllerSpecController)
277
+ end
278
+ describe "(doubly nested)" do
279
+ it "overrides the controller class submitted to the outermost group" do
280
+ subject.should be_an_instance_of(ControllerSpecController)
281
+ end
282
+ end
283
+ end
284
+ end
285
+ end
286
+
268
287
  describe ControllerExampleGroup do
269
288
  it "should clear its name from the description" do
270
289
  group = describe("foo", :type => :controller) do
@@ -10,30 +10,30 @@ module Spec
10
10
  example_group.superclass.should == Spec::Rails::Example::ModelExampleGroup
11
11
  end
12
12
 
13
- it "should return a ModelExampleGroup when given :spec_path => '/blah/spec/models/'" do
13
+ it "should return a ModelExampleGroup when given :location => '/blah/spec/models/'" do
14
14
  example_group = Spec::Example::ExampleGroupFactory.create_example_group(
15
- "name", :spec_path => '/blah/spec/models/blah.rb'
15
+ "name", :location => '/blah/spec/models/blah.rb'
16
16
  ) {}
17
17
  example_group.superclass.should == Spec::Rails::Example::ModelExampleGroup
18
18
  end
19
19
 
20
- it "should return a ModelExampleGroup when given :spec_path => '\\blah\\spec\\models\\' (windows format)" do
20
+ it "should return a ModelExampleGroup when given :location => '\\blah\\spec\\models\\' (windows format)" do
21
21
  example_group = Spec::Example::ExampleGroupFactory.create_example_group(
22
- "name", :spec_path => '\\blah\\spec\\models\\blah.rb'
22
+ "name", :location => '\\blah\\spec\\models\\blah.rb'
23
23
  ) {}
24
24
  example_group.superclass.should == Spec::Rails::Example::ModelExampleGroup
25
25
  end
26
26
 
27
- it "should return an ActiveSupport::TestCase when given :spec_path => '/blah/spec/foo/' (anything other than controllers, views and helpers)" do
27
+ it "should return an ActiveSupport::TestCase when given :location => '/blah/spec/foo/' (anything other than controllers, views and helpers)" do
28
28
  example_group = Spec::Example::ExampleGroupFactory.create_example_group(
29
- "name", :spec_path => '/blah/spec/foo/blah.rb'
29
+ "name", :location => '/blah/spec/foo/blah.rb'
30
30
  ) {}
31
31
  example_group.superclass.should == ActiveSupport::TestCase
32
32
  end
33
33
 
34
- it "should return an ActiveSupport::TestCase when given :spec_path => '\\blah\\spec\\foo\\' (windows format) (anything other than controllers, views and helpers)" do
34
+ it "should return an ActiveSupport::TestCase when given :location => '\\blah\\spec\\foo\\' (windows format) (anything other than controllers, views and helpers)" do
35
35
  example_group = Spec::Example::ExampleGroupFactory.create_example_group(
36
- "name", :spec_path => '\\blah\\spec\\foo\\blah.rb'
36
+ "name", :location => '\\blah\\spec\\foo\\blah.rb'
37
37
  ) {}
38
38
  example_group.superclass.should == ActiveSupport::TestCase
39
39
  end
@@ -45,16 +45,16 @@ module Spec
45
45
  example_group.superclass.should == Spec::Rails::Example::ViewExampleGroup
46
46
  end
47
47
 
48
- it "should return a ViewExampleGroup when given :spec_path => '/blah/spec/views/'" do
48
+ it "should return a ViewExampleGroup when given :location => '/blah/spec/views/'" do
49
49
  example_group = Spec::Example::ExampleGroupFactory.create_example_group(
50
- "name", :spec_path => '/blah/spec/views/blah.rb'
50
+ "name", :location => '/blah/spec/views/blah.rb'
51
51
  ) {}
52
52
  example_group.superclass.should == Spec::Rails::Example::ViewExampleGroup
53
53
  end
54
54
 
55
- it "should return a ModelExampleGroup when given :spec_path => '\\blah\\spec\\views\\' (windows format)" do
55
+ it "should return a ModelExampleGroup when given :location => '\\blah\\spec\\views\\' (windows format)" do
56
56
  example_group = Spec::Example::ExampleGroupFactory.create_example_group(
57
- "name", :spec_path => '\\blah\\spec\\views\\blah.rb'
57
+ "name", :location => '\\blah\\spec\\views\\blah.rb'
58
58
  ) {}
59
59
  example_group.superclass.should == Spec::Rails::Example::ViewExampleGroup
60
60
  end
@@ -66,16 +66,16 @@ module Spec
66
66
  example_group.superclass.should == Spec::Rails::Example::HelperExampleGroup
67
67
  end
68
68
 
69
- it "should return a HelperExampleGroup when given :spec_path => '/blah/spec/helpers/'" do
69
+ it "should return a HelperExampleGroup when given :location => '/blah/spec/helpers/'" do
70
70
  example_group = Spec::Example::ExampleGroupFactory.create_example_group(
71
- "name", :spec_path => '/blah/spec/helpers/blah.rb'
71
+ "name", :location => '/blah/spec/helpers/blah.rb'
72
72
  ) {}
73
73
  example_group.superclass.should == Spec::Rails::Example::HelperExampleGroup
74
74
  end
75
75
 
76
- it "should return a ModelExampleGroup when given :spec_path => '\\blah\\spec\\helpers\\' (windows format)" do
76
+ it "should return a ModelExampleGroup when given :location => '\\blah\\spec\\helpers\\' (windows format)" do
77
77
  example_group = Spec::Example::ExampleGroupFactory.create_example_group(
78
- "name", :spec_path => '\\blah\\spec\\helpers\\blah.rb'
78
+ "name", :location => '\\blah\\spec\\helpers\\blah.rb'
79
79
  ) {}
80
80
  example_group.superclass.should == Spec::Rails::Example::HelperExampleGroup
81
81
  end
@@ -87,23 +87,23 @@ module Spec
87
87
  example_group.superclass.should == Spec::Rails::Example::ControllerExampleGroup
88
88
  end
89
89
 
90
- it "should return a ControllerExampleGroup when given :spec_path => '/blah/spec/controllers/'" do
90
+ it "should return a ControllerExampleGroup when given :location => '/blah/spec/controllers/'" do
91
91
  example_group = Spec::Example::ExampleGroupFactory.create_example_group(
92
- "name", :spec_path => '/blah/spec/controllers/blah.rb'
92
+ "name", :location => '/blah/spec/controllers/blah.rb'
93
93
  ) {}
94
94
  example_group.superclass.should == Spec::Rails::Example::ControllerExampleGroup
95
95
  end
96
96
 
97
- it "should return a ModelExampleGroup when given :spec_path => '\\blah\\spec\\controllers\\' (windows format)" do
97
+ it "should return a ModelExampleGroup when given :location => '\\blah\\spec\\controllers\\' (windows format)" do
98
98
  example_group = Spec::Example::ExampleGroupFactory.create_example_group(
99
- "name", :spec_path => '\\blah\\spec\\controllers\\blah.rb'
99
+ "name", :location => '\\blah\\spec\\controllers\\blah.rb'
100
100
  ) {}
101
101
  example_group.superclass.should == Spec::Rails::Example::ControllerExampleGroup
102
102
  end
103
103
 
104
- it "should favor the :type over the :spec_path" do
104
+ it "should favor the :type over the :location" do
105
105
  example_group = Spec::Example::ExampleGroupFactory.create_example_group(
106
- "name", :spec_path => '/blah/spec/models/blah.rb', :type => :controller
106
+ "name", :location => '/blah/spec/models/blah.rb', :type => :controller
107
107
  ) {}
108
108
  example_group.superclass.should == Spec::Rails::Example::ControllerExampleGroup
109
109
  end
@@ -1,8 +1,7 @@
1
- share_as :RoutingExampleGroupSpec do
2
-
3
- class CustomRouteSpecController < ActionController::Base; end
4
- class RspecOnRailsSpecsController < ActionController::Base; end
1
+ class CustomRouteSpecController < ActionController::Base; end
2
+ class RspecOnRailsSpecsController < ActionController::Base; end
5
3
 
4
+ share_as :RoutingExampleGroupSpec do
6
5
  it "support custom routes" do
7
6
  route_for(:controller => "custom_route_spec", :action => "custom_route").
8
7
  should == "/custom_route"
@@ -312,7 +312,7 @@ module Spec
312
312
 
313
313
  it "should clear ActionView::Base.base_view_path on teardown" do
314
314
  group = describe("base_view_path_cleared flag", :type => :view) {}
315
- example = group.new("example",{}) {}
315
+ example = group.new(Spec::Example::ExampleProxy.new) {}
316
316
 
317
317
  ActionView::Base.should_receive(:base_view_path=).with(nil)
318
318
  example.run_after_each
@@ -61,9 +61,9 @@ module AssertSelectSpecHelpers
61
61
  end
62
62
 
63
63
  def first_non_rspec_line_in_backtrace_of(error)
64
- rspec_path = File.join('rspec', 'lib', 'spec')
64
+ rlocation = File.join('rspec', 'lib', 'spec')
65
65
  error.backtrace.reject { |line|
66
- line =~ /#{rspec_path}/
66
+ line =~ /#{rlocation}/
67
67
  }.first
68
68
  end
69
69
 
@@ -1,6 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/../../spec_helper'
2
2
 
3
- describe "script/spec_server file", :shared => true do
3
+ shared_examples_for "script/spec_server file" do
4
4
  attr_accessor :tmbundle_install_directory, :tmbundle_source_directory
5
5
  attr_reader :animals_yml_path, :original_animals_content
6
6
 
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.0
4
+ version: 1.2.1
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-03-15 00:00:00 -05:00
12
+ date: 2009-03-22 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.0
23
+ version: 1.2.1
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rack
@@ -40,7 +40,7 @@ dependencies:
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: 0.1.13
43
+ version: 0.1.16
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: 1.10.0
53
+ version: 1.11.0
54
54
  version:
55
55
  description: Behaviour Driven Development for Ruby on Rails.
56
56
  email:
@@ -60,21 +60,19 @@ executables: []
60
60
  extensions: []
61
61
 
62
62
  extra_rdoc_files:
63
- - History.txt
64
63
  - License.txt
65
64
  - Manifest.txt
66
- - README.txt
67
65
  - TODO.txt
68
66
  - generators/rspec/templates/previous_failures.txt
69
67
  files:
70
68
  - .document
71
- - History.txt
69
+ - History.rdoc
72
70
  - License.txt
73
71
  - Manifest.txt
74
- - README.txt
72
+ - README.rdoc
75
73
  - Rakefile
76
74
  - TODO.txt
77
- - Upgrade.markdown
75
+ - Upgrade.rdoc
78
76
  - features/step_definitions/people.rb
79
77
  - features/support/env.rb
80
78
  - features/transactions/transactions_should_rollback.feature
@@ -235,10 +233,24 @@ files:
235
233
  - spec/spec_helper.rb
236
234
  has_rdoc: true
237
235
  homepage: http://rspec.info/
238
- post_install_message:
236
+ post_install_message: |
237
+ **************************************************
238
+
239
+ Thank you for installing rspec-rails-1.2.1
240
+
241
+ If you are upgrading, do this in each of your rails apps
242
+ that you want to upgrade:
243
+
244
+ $ ruby script/generate rspec
245
+
246
+ Please be sure to read History.rdoc and Upgrade.rdoc
247
+ for useful information about this release.
248
+
249
+ **************************************************
250
+
239
251
  rdoc_options:
240
252
  - --main
241
- - README.txt
253
+ - README.rdoc
242
254
  require_paths:
243
255
  - lib
244
256
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -259,6 +271,6 @@ rubyforge_project: rspec
259
271
  rubygems_version: 1.3.1
260
272
  signing_key:
261
273
  specification_version: 2
262
- summary: rspec-rails 1.2.0
274
+ summary: rspec-rails 1.2.1
263
275
  test_files: []
264
276