dchelimsky-rspec-rails 1.1.12 → 1.1.99.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/History.txt +29 -2
  2. data/License.txt +1 -1
  3. data/Manifest.txt +7 -6
  4. data/README.txt +5 -4
  5. data/Rakefile +14 -2
  6. data/TODO.txt +1 -0
  7. data/Upgrade.txt +30 -0
  8. data/generators/rspec/templates/rspec.rake +12 -10
  9. data/generators/rspec/templates/script/spec_server +10 -111
  10. data/generators/rspec_controller/rspec_controller_generator.rb +1 -5
  11. data/generators/rspec_scaffold/rspec_scaffold_generator.rb +9 -13
  12. data/generators/rspec_scaffold/templates/controller_spec.rb +25 -25
  13. data/generators/rspec_scaffold/templates/edit_erb_spec.rb +1 -1
  14. data/generators/rspec_scaffold/templates/helper_spec.rb +1 -1
  15. data/generators/rspec_scaffold/templates/index_erb_spec.rb +1 -1
  16. data/generators/rspec_scaffold/templates/new_erb_spec.rb +1 -1
  17. data/generators/rspec_scaffold/templates/routing_spec.rb +24 -20
  18. data/generators/rspec_scaffold/templates/show_erb_spec.rb +1 -1
  19. data/lib/spec/rails/example/controller_example_group.rb +46 -16
  20. data/lib/spec/rails/example/functional_example_group.rb +7 -22
  21. data/lib/spec/rails/example/helper_example_group.rb +6 -9
  22. data/lib/spec/rails/example/model_example_group.rb +1 -1
  23. data/lib/spec/rails/example/render_observer.rb +0 -26
  24. data/lib/spec/rails/example/view_example_group.rb +32 -34
  25. data/lib/spec/rails/example.rb +0 -2
  26. data/lib/spec/rails/extensions/active_support/test_case.rb +7 -0
  27. data/lib/spec/rails/extensions/spec/runner/configuration.rb +12 -44
  28. data/lib/spec/rails/extensions.rb +1 -1
  29. data/lib/spec/rails/matchers/ar_be_valid.rb +3 -0
  30. data/lib/spec/rails/matchers/have_text.rb +1 -1
  31. data/lib/spec/rails/matchers/include_text.rb +2 -2
  32. data/lib/spec/rails/matchers/redirect_to.rb +6 -14
  33. data/lib/spec/rails/matchers/render_template.rb +5 -1
  34. data/lib/spec/rails/spec_server.rb +86 -0
  35. data/lib/spec/rails/version.rb +2 -2
  36. data/lib/spec/rails.rb +10 -9
  37. data/rspec-rails.gemspec +12 -9
  38. data/spec/resources/controllers/controller_spec_controller.rb +1 -1
  39. data/spec/resources/controllers/render_spec_controller.rb +1 -1
  40. data/spec/resources/controllers/rjs_spec_controller.rb +1 -1
  41. data/spec/spec/rails/example/configuration_spec.rb +15 -29
  42. data/spec/spec/rails/example/{controller_spec_spec.rb → controller_example_group_spec.rb} +84 -60
  43. data/spec/spec/rails/example/cookies_proxy_spec.rb +32 -36
  44. data/spec/spec/rails/example/example_group_factory_spec.rb +5 -5
  45. data/spec/spec/rails/example/{helper_spec_spec.rb → helper_example_group_spec.rb} +8 -2
  46. data/spec/spec/rails/example/{model_spec_spec.rb → model_example_group_spec.rb} +3 -1
  47. data/spec/spec/rails/example/{view_spec_spec.rb → view_example_group_spec.rb} +33 -15
  48. data/spec/spec/rails/matchers/ar_be_valid_spec.rb +10 -0
  49. data/spec/spec/rails/matchers/assert_select_spec.rb +1 -0
  50. data/spec/spec/rails/matchers/have_text_spec.rb +12 -4
  51. data/spec/spec/rails/matchers/include_text_spec.rb +11 -13
  52. data/spec/spec/rails/matchers/redirect_to_spec.rb +221 -210
  53. data/spec/spec/rails/matchers/render_template_spec.rb +161 -158
  54. data/spec/spec/rails/spec_server_spec.rb +18 -7
  55. data/spec/spec_helper.rb +20 -9
  56. metadata +21 -10
  57. data/lib/spec/rails/example/rails_example_group.rb +0 -28
  58. data/lib/spec/rails/extensions/action_controller/base.rb +0 -14
data/History.txt CHANGED
@@ -1,10 +1,37 @@
1
1
  === Maintenance
2
2
 
3
- IMPORTANT: rspec-rails supports rails 2.0.2, 2.1.2 and 2.2.2. We are no longer supporting 1.x versions of rails.
3
+ IMPORTANT: This release includes the following backwards-compatibility-breaking changes.
4
4
 
5
- * 1 enhancement
5
+ * rspec-rails supports rails 2.0.2, 2.1.2 and 2.2.2.
6
+
7
+ * We are no longer supporting 1.x versions of rails.
8
+
9
+ * expect_render and stub_render have been removed.
10
+
11
+ * Both of these methods were deprecated in rspec-rails-1.1.5, released in Sept, 2008.
12
+
13
+ * { route_for(args).should == "/path" } now delegates to assert_generates (in rails)
14
+
15
+ * see Upgrade.txt for more information
16
+
17
+ * enhancements
6
18
 
7
19
  * Adding status codes to redirect_to matcher (Damian Janowski). Closes #570.
20
+ * Initialize current URL before executing any examples in a ViewExampleGroup (Wilson Bilkovich). Closes #654.
21
+ * Support query strings in params_from (Wilson Bilkovich). Closes #652.
22
+ * delegate route_for to assert_recognizes (less brittle)
23
+ * it { should be_valid } (Kakutani). Closes #665.
24
+ * controller is implicit subject in controller specs (Joe Ferris). #686.
25
+ * template is implicit subject in view specs (Joe Ferris). #686.
26
+ * redirect_to and render_template matchers can accept controller or response (Joe Ferris). Closes #686.
27
+ * generated specs use declarative docstrings
28
+ * rspec_scaffold generator generates layout and stylesheet (per Rails-2.3)
29
+
30
+ * bug fixes
31
+
32
+ * you no longer *have* to load ActionMailer to get specs to run. Closes #650.
33
+ * query_params are now parsed by Rack::Utils.parse_query in redirect_to matcher. Closes #684.
34
+ * cleaned up spec_server (there was a bunch of pre-rails 2.0 material). Closes #685.
8
35
 
9
36
  === Version 1.1.12 / 2009-01-11
10
37
 
data/License.txt CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ====================================================================
4
4
  ==== RSpec, RSpec-Rails
5
- Copyright (c) 2005-2008 The RSpec Development Team
5
+ Copyright (c) 2005-2009 The RSpec Development Team
6
6
  ====================================================================
7
7
  ==== ARTS
8
8
  Copyright (c) 2006 Kevin Clark, Jake Howerton
data/Manifest.txt CHANGED
@@ -4,6 +4,7 @@ Manifest.txt
4
4
  README.txt
5
5
  Rakefile
6
6
  TODO.txt
7
+ Upgrade.txt
7
8
  features/step_definitions/people.rb
8
9
  features/support/env.rb
9
10
  features/transactions/transactions_should_rollback.feature
@@ -45,15 +46,14 @@ lib/spec/rails/example/cookies_proxy.rb
45
46
  lib/spec/rails/example/functional_example_group.rb
46
47
  lib/spec/rails/example/helper_example_group.rb
47
48
  lib/spec/rails/example/model_example_group.rb
48
- lib/spec/rails/example/rails_example_group.rb
49
49
  lib/spec/rails/example/render_observer.rb
50
50
  lib/spec/rails/example/view_example_group.rb
51
51
  lib/spec/rails/extensions.rb
52
- lib/spec/rails/extensions/action_controller/base.rb
53
52
  lib/spec/rails/extensions/action_controller/rescue.rb
54
53
  lib/spec/rails/extensions/action_controller/test_response.rb
55
54
  lib/spec/rails/extensions/action_view/base.rb
56
55
  lib/spec/rails/extensions/active_record/base.rb
56
+ lib/spec/rails/extensions/active_support/test_case.rb
57
57
  lib/spec/rails/extensions/spec/matchers/have.rb
58
58
  lib/spec/rails/extensions/spec/runner/configuration.rb
59
59
  lib/spec/rails/interop/testcase.rb
@@ -66,6 +66,7 @@ lib/spec/rails/matchers/include_text.rb
66
66
  lib/spec/rails/matchers/redirect_to.rb
67
67
  lib/spec/rails/matchers/render_template.rb
68
68
  lib/spec/rails/mocks.rb
69
+ lib/spec/rails/spec_server.rb
69
70
  lib/spec/rails/story_adapter.rb
70
71
  lib/spec/rails/version.rb
71
72
  rspec-rails.gemspec
@@ -130,15 +131,15 @@ spec/resources/views/view_spec/template_with_partial_using_collection.rhtml
130
131
  spec/resources/views/view_spec/template_with_partial_with_array.rhtml
131
132
  spec/spec/rails/example/assigns_hash_proxy_spec.rb
132
133
  spec/spec/rails/example/configuration_spec.rb
134
+ spec/spec/rails/example/controller_example_group_spec.rb
133
135
  spec/spec/rails/example/controller_isolation_spec.rb
134
- spec/spec/rails/example/controller_spec_spec.rb
135
136
  spec/spec/rails/example/cookies_proxy_spec.rb
136
137
  spec/spec/rails/example/example_group_factory_spec.rb
137
- spec/spec/rails/example/helper_spec_spec.rb
138
- spec/spec/rails/example/model_spec_spec.rb
138
+ spec/spec/rails/example/helper_example_group_spec.rb
139
+ spec/spec/rails/example/model_example_group_spec.rb
139
140
  spec/spec/rails/example/shared_behaviour_spec.rb
140
141
  spec/spec/rails/example/test_unit_assertion_accessibility_spec.rb
141
- spec/spec/rails/example/view_spec_spec.rb
142
+ spec/spec/rails/example/view_example_group_spec.rb
142
143
  spec/spec/rails/extensions/action_controller_rescue_action_spec.rb
143
144
  spec/spec/rails/extensions/action_view_base_spec.rb
144
145
  spec/spec/rails/extensions/active_record_spec.rb
data/README.txt CHANGED
@@ -2,15 +2,16 @@
2
2
 
3
3
  * http://rspec.info
4
4
  * http://rubyforge.org/projects/rspec
5
- * http://github.com/dchelimsky/rspec-rails/wikis
5
+ * http://github.com/dchelimsky/rspec-rails
6
+ * http://wiki.github.com/dchelimsky/rspec/rails
6
7
  * mailto:rspec-devel@rubyforge.org
7
8
 
8
9
  == DESCRIPTION:
9
10
 
10
11
  Behaviour Driven Development for Ruby on Rails.
11
12
 
12
- Spec::Rails (a.k.a. RSpec on Rails) is an RSpec extension that allows you
13
- to drive the development of your RoR application using RSpec.
13
+ rspec-rails is an RSpec extension that allows you to drive the development of
14
+ Ruby on Rails applications with RSpec.
14
15
 
15
16
  == FEATURES:
16
17
 
@@ -41,4 +42,4 @@ expectations you can set on responses and models, etc.
41
42
 
42
43
  == INSTALL
43
44
 
44
- * Visit http://github.com/dchelimsky/rspec-rails/wikis for installation instructions.
45
+ * Visit http://wiki.github.com/dchelimsky/rspec/rails for installation instructions.
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ Hoe.new('rspec-rails', Spec::Rails::VERSION::STRING) do |p|
20
20
  p.description = "Behaviour Driven Development for Ruby on Rails."
21
21
  p.rubyforge_name = 'rspec'
22
22
  p.developer('RSpec Development Team', 'rspec-devel@rubyforge.org')
23
- p.extra_deps = [["rspec","1.1.12"]]
23
+ p.extra_deps = [["rspec","1.1.99.1"],["rack",">=0.4.0"]]
24
24
  p.extra_dev_deps = [["cucumber",">= 0.1.13"]]
25
25
  p.remote_rdoc_dir = "rspec-rails/#{Spec::Rails::VERSION::STRING}"
26
26
  end
@@ -48,4 +48,16 @@ Spec::Rake::SpecTask.new
48
48
 
49
49
  Cucumber::Rake::Task.new
50
50
 
51
- task :default => [:features]
51
+ task :default => [:features]
52
+
53
+ namespace :update do
54
+ desc "update the manfest"
55
+ task :manifest do
56
+ system %q[touch Manifest.txt; rake check_manifest | grep -v "(in " | patch]
57
+ end
58
+
59
+ desc "update the gemspec"
60
+ task :gemspec do
61
+ system %q[rake debug_gem | grep -v "(in " | grep -v "s.add_dependency(%q<hoe" | grep -v "s.add_dependency(%q<cuc" > `basename \\`pwd\\``.gemspec]
62
+ end
63
+ end
data/TODO.txt CHANGED
@@ -0,0 +1 @@
1
+ * delegate params_from to assert_recognizes
data/Upgrade.txt ADDED
@@ -0,0 +1,30 @@
1
+ === Upgrade to rspec-rails ????
2
+
3
+ == route_for
4
+
5
+ After a change to edge rails broke our monkey-patched #route_for method, I
6
+ decided to just delegate to rails' #assert_generates method. For most cases,
7
+ this will not present a problem, but for some it might. You'll know if you
8
+ upgrade and see any newly failing, route-related examples. Here are the things
9
+ that you might need to change.
10
+
11
+ * Make sure IDs are strings
12
+
13
+ If you had :id => 1 before, you need to change that to :id => "1"
14
+
15
+ #old
16
+ route_for(:controller => 'things', :action => 'show', :id => 1).should == "/things/1"
17
+
18
+ #new
19
+ route_for(:controller => 'things', :action => 'show', :id => "1").should == "/things/1"
20
+
21
+ * Convert paths for non-get methods to hashes
22
+
23
+ If you had an example with a route that requires post, put, or delete, you'll
24
+ need to declare that explicitly.
25
+
26
+ #old
27
+ route_for(:controller => 'things', :action => 'create').should == "/things"
28
+
29
+ #new
30
+ route_for(:controller => 'things', :action => 'create').should == {:path => "/things", :method => :post}
@@ -108,14 +108,14 @@ begin
108
108
  end
109
109
 
110
110
  namespace :server do
111
- daemonized_server_pid = File.expand_path("spec_server.pid", RAILS_ROOT + "/tmp")
112
-
111
+ daemonized_server_pid = File.expand_path("#{RAILS_ROOT}/tmp/spec_server.pid")
112
+
113
113
  desc "start spec_server."
114
114
  task :start do
115
115
  if File.exist?(daemonized_server_pid)
116
116
  $stderr.puts "spec_server is already running."
117
117
  else
118
- $stderr.puts "Starting up spec server."
118
+ $stderr.puts %Q{Starting up spec_server ...}
119
119
  system("ruby", "script/spec_server", "--daemon", "--pid", daemonized_server_pid)
120
120
  end
121
121
  end
@@ -125,19 +125,21 @@ begin
125
125
  unless File.exist?(daemonized_server_pid)
126
126
  $stderr.puts "No server running."
127
127
  else
128
- $stderr.puts "Shutting down spec_server."
128
+ $stderr.puts "Shutting down spec_server ..."
129
129
  system("kill", "-s", "TERM", File.read(daemonized_server_pid).strip) &&
130
130
  File.delete(daemonized_server_pid)
131
131
  end
132
132
  end
133
133
 
134
- desc "reload spec_server."
135
- task :restart do
136
- unless File.exist?(daemonized_server_pid)
137
- $stderr.puts "No server running."
134
+ desc "restart spec_server."
135
+ task :restart => [:stop, :start]
136
+
137
+ desc "check if spec server is running"
138
+ task :status do
139
+ if File.exist?(daemonized_server_pid)
140
+ $stderr.puts %Q{spec_server is running (PID: #{File.read(daemonized_server_pid).gsub("\n","")})}
138
141
  else
139
- $stderr.puts "Reloading down spec_server."
140
- system("kill", "-s", "USR2", File.read(daemonized_server_pid).strip)
142
+ $stderr.puts "No server running."
141
143
  end
142
144
  end
143
145
  end
@@ -1,125 +1,24 @@
1
1
  #!/usr/bin/env ruby
2
- $LOAD_PATH.unshift File.dirname(__FILE__) + '/../vendor/plugins/rspec/lib' # For rspec installed as plugin
2
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../vendor/plugins/rspec-rails/lib' # For rspec installed as plugin
3
3
  require 'rubygems'
4
- require 'drb/drb'
5
- require 'rbconfig'
6
- require 'spec'
7
4
  require 'optparse'
5
+ require 'spec/rails/spec_server'
8
6
 
9
- # This is based on Florian Weber's TDDMate
10
- module Spec
11
- module Runner
12
- class RailsSpecServer
13
- def run(argv, stderr, stdout)
14
- $stdout = stdout
15
- $stderr = stderr
16
-
17
- unless ActiveRecord::Base.respond_to?(:clear_reloadable_connections!)
18
- base = ActiveRecord::Base
19
- def base.clear_reloadable_connections!
20
- active_connections.each do |name, conn|
21
- if conn.requires_reloading?
22
- conn.disconnect!
23
- active_connections.delete(name)
24
- end
25
- end
26
- end
27
- end
28
-
29
- ActiveRecord::Base.clear_reloadable_connections!
30
-
31
- if ActionController.const_defined?(:Dispatcher)
32
- dispatcher = ::ActionController::Dispatcher.new($stdout)
33
- dispatcher.cleanup_application
34
- elsif ::Dispatcher.respond_to?(:reset_application!)
35
- ::Dispatcher.reset_application!
36
- else
37
- raise "Application reloading failed"
38
- end
39
- if Object.const_defined?(:Fixtures) && Fixtures.respond_to?(:reset_cache)
40
- Fixtures.reset_cache
41
- end
42
-
43
- if ::ActiveSupport.const_defined?(:Dependencies)
44
- ::ActiveSupport::Dependencies.mechanism = :load
45
- else
46
- ::Dependencies.mechanism = :load
47
- end
48
-
49
- require_dependency('application.rb') unless Object.const_defined?(:ApplicationController)
50
- load File.dirname(__FILE__) + '/../spec/spec_helper.rb'
51
-
52
- if in_memory_database?
53
- load "#{RAILS_ROOT}/db/schema.rb" # use db agnostic schema by default
54
- ActiveRecord::Migrator.up('db/migrate') # use migrations
55
- end
56
-
57
- ::Spec::Runner::CommandLine.run(
58
- ::Spec::Runner::OptionParser.parse(
59
- argv,
60
- $stderr,
61
- $stdout
62
- )
63
- )
64
- end
65
-
66
- def in_memory_database?
67
- ENV["RAILS_ENV"] == "test" and
68
- ::ActiveRecord::Base.connection.class.to_s == "ActiveRecord::ConnectionAdapters::SQLite3Adapter" and
69
- ::Rails::Configuration.new.database_configuration['test']['database'] == ':memory:'
70
- end
71
- end
72
- end
73
- end
74
7
  puts "Loading Rails environment"
75
8
 
76
9
  ENV["RAILS_ENV"] = "test"
77
10
  require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
78
- require 'dispatcher'
79
-
80
- def restart_test_server
81
- puts "restarting"
82
- config = ::Config::CONFIG
83
- ruby = File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT']
84
- command_line = [ruby, $0, ARGV].flatten.join(' ')
85
- exec(command_line)
86
- end
87
-
88
- def daemonize(pid_file = nil)
89
- return yield if $DEBUG
90
- pid = Process.fork{
91
- Process.setsid
92
- Dir.chdir(RAILS_ROOT)
93
- trap("SIGINT"){ exit! 0 }
94
- trap("SIGTERM"){ exit! 0 }
95
- trap("SIGHUP"){ restart_test_server }
96
- File.open("/dev/null"){|f|
97
- STDERR.reopen f
98
- STDIN.reopen f
99
- STDOUT.reopen f
100
- }
101
- yield
102
- }
103
- puts "spec_server launched. (PID: %d)" % pid
104
- File.open(pid_file,"w"){|f| f.puts pid } if pid_file
105
- exit! 0
106
- end
107
11
 
108
12
  options = Hash.new
109
- opts = OptionParser.new
110
- opts.on("-d", "--daemon"){|v| options[:daemon] = true }
111
- opts.on("-p", "--pid PIDFILE"){|v| options[:pid] = v }
112
- opts.parse!(ARGV)
113
-
114
- puts "Ready"
115
- exec_server = lambda {
116
- trap("USR2") { restart_test_server } if Signal.list.has_key?("USR2")
117
- DRb.start_service("druby://127.0.0.1:8989", Spec::Runner::RailsSpecServer.new)
118
- DRb.thread.join
119
- }
13
+ parser = OptionParser.new
14
+ parser.on("-d", "--daemon") {|ignore| options[:daemon] = true }
15
+ parser.on("-p", "--pid PIDFILE"){|pid| options[:pid] = pid }
16
+ parser.parse!(ARGV)
120
17
 
121
18
  if options[:daemon]
122
- daemonize(options[:pid], &exec_server)
19
+ ::Spec::Rails::SpecServer.daemonize(options[:pid])
123
20
  else
124
- exec_server.call
21
+ ::Spec::Rails::SpecServer.run
125
22
  end
23
+
24
+ puts "Ready"
@@ -15,11 +15,7 @@ class RspecControllerGenerator < ControllerGenerator
15
15
  m.directory File.join('spec/helpers', class_path)
16
16
  m.directory File.join('spec/views', class_path, file_name)
17
17
 
18
- if Rails::VERSION::STRING < "2.0.0"
19
- @default_file_extension = "rhtml"
20
- else
21
- @default_file_extension = "html.erb"
22
- end
18
+ @default_file_extension = "html.erb"
23
19
 
24
20
  # Controller spec, class, and helper.
25
21
  m.template 'controller_spec.rb',
@@ -30,19 +30,8 @@ class RspecScaffoldGenerator < Rails::Generator::NamedBase
30
30
  @controller_class_name = "#{@controller_class_nesting}::#{@controller_class_name_without_nesting}"
31
31
  end
32
32
 
33
- if Rails::VERSION::STRING < "2.0.0"
34
- @resource_generator = "scaffold_resource"
35
- @default_file_extension = "rhtml"
36
- else
37
- @resource_generator = "scaffold"
38
- @default_file_extension = "html.erb"
39
- end
40
-
41
- if ActionController::Base.respond_to?(:resource_action_separator)
42
- @resource_edit_path = "/edit"
43
- else
44
- @resource_edit_path = ";edit"
45
- end
33
+ @resource_generator = "scaffold"
34
+ @default_file_extension = "html.erb"
46
35
  end
47
36
 
48
37
  def manifest
@@ -57,12 +46,19 @@ class RspecScaffoldGenerator < Rails::Generator::NamedBase
57
46
  m.directory(File.join('app/controllers', controller_class_path))
58
47
  m.directory(File.join('app/helpers', controller_class_path))
59
48
  m.directory(File.join('app/views', controller_class_path, controller_file_name))
49
+ m.directory(File.join('app/views/layouts', controller_class_path))
50
+ m.directory(File.join('public/stylesheets', class_path))
51
+
60
52
  m.directory(File.join('spec/controllers', controller_class_path))
61
53
  m.directory(File.join('spec/models', class_path))
62
54
  m.directory(File.join('spec/helpers', class_path))
63
55
  m.directory File.join('spec/fixtures', class_path)
64
56
  m.directory File.join('spec/views', controller_class_path, controller_file_name)
65
57
 
58
+ # Layout and stylesheet.
59
+ m.template("#{@resource_generator}:layout.html.erb", File.join('app/views/layouts', controller_class_path, "#{controller_file_name}.html.erb"))
60
+ m.template("#{@resource_generator}:style.css", 'public/stylesheets/scaffold.css')
61
+
66
62
  # Controller spec, class, and helper.
67
63
  m.template 'rspec_scaffold:routing_spec.rb',
68
64
  File.join('spec/controllers', controller_class_path, "#{controller_file_name}_routing_spec.rb")
@@ -6,9 +6,9 @@ describe <%= controller_class_name %>Controller do
6
6
  @mock_<%= file_name %> ||= mock_model(<%= class_name %>, stubs)
7
7
  end
8
8
 
9
- describe "responding to GET index" do
9
+ describe "GET index" do
10
10
 
11
- it "should expose all <%= table_name.pluralize %> as @<%= table_name.pluralize %>" do
11
+ it "exposes all <%= table_name.pluralize %> as @<%= table_name.pluralize %>" do
12
12
  <%= class_name %>.should_receive(:find).with(:all).and_return([mock_<%= file_name %>])
13
13
  get :index
14
14
  assigns[:<%= table_name %>].should == [mock_<%= file_name %>]
@@ -16,7 +16,7 @@ describe <%= controller_class_name %>Controller do
16
16
 
17
17
  describe "with mime type of xml" do
18
18
 
19
- it "should render all <%= table_name.pluralize %> as xml" do
19
+ it "renders all <%= table_name.pluralize %> as xml" do
20
20
  request.env["HTTP_ACCEPT"] = "application/xml"
21
21
  <%= class_name %>.should_receive(:find).with(:all).and_return(<%= file_name.pluralize %> = mock("Array of <%= class_name.pluralize %>"))
22
22
  <%= file_name.pluralize %>.should_receive(:to_xml).and_return("generated XML")
@@ -28,9 +28,9 @@ describe <%= controller_class_name %>Controller do
28
28
 
29
29
  end
30
30
 
31
- describe "responding to GET show" do
31
+ describe "GET show" do
32
32
 
33
- it "should expose the requested <%= file_name %> as @<%= file_name %>" do
33
+ it "exposes the requested <%= file_name %> as @<%= file_name %>" do
34
34
  <%= class_name %>.should_receive(:find).with("37").and_return(mock_<%= file_name %>)
35
35
  get :show, :id => "37"
36
36
  assigns[:<%= file_name %>].should equal(mock_<%= file_name %>)
@@ -38,7 +38,7 @@ describe <%= controller_class_name %>Controller do
38
38
 
39
39
  describe "with mime type of xml" do
40
40
 
41
- it "should render the requested <%= file_name %> as xml" do
41
+ it "renders the requested <%= file_name %> as xml" do
42
42
  request.env["HTTP_ACCEPT"] = "application/xml"
43
43
  <%= class_name %>.should_receive(:find).with("37").and_return(mock_<%= file_name %>)
44
44
  mock_<%= file_name %>.should_receive(:to_xml).and_return("generated XML")
@@ -50,9 +50,9 @@ describe <%= controller_class_name %>Controller do
50
50
 
51
51
  end
52
52
 
53
- describe "responding to GET new" do
53
+ describe "GET new" do
54
54
 
55
- it "should expose a new <%= file_name %> as @<%= file_name %>" do
55
+ it "exposes a new <%= file_name %> as @<%= file_name %>" do
56
56
  <%= class_name %>.should_receive(:new).and_return(mock_<%= file_name %>)
57
57
  get :new
58
58
  assigns[:<%= file_name %>].should equal(mock_<%= file_name %>)
@@ -60,9 +60,9 @@ describe <%= controller_class_name %>Controller do
60
60
 
61
61
  end
62
62
 
63
- describe "responding to GET edit" do
63
+ describe "GET edit" do
64
64
 
65
- it "should expose the requested <%= file_name %> as @<%= file_name %>" do
65
+ it "exposes the requested <%= file_name %> as @<%= file_name %>" do
66
66
  <%= class_name %>.should_receive(:find).with("37").and_return(mock_<%= file_name %>)
67
67
  get :edit, :id => "37"
68
68
  assigns[:<%= file_name %>].should equal(mock_<%= file_name %>)
@@ -70,17 +70,17 @@ describe <%= controller_class_name %>Controller do
70
70
 
71
71
  end
72
72
 
73
- describe "responding to POST create" do
73
+ describe "POST create" do
74
74
 
75
75
  describe "with valid params" do
76
76
 
77
- it "should expose a newly created <%= file_name %> as @<%= file_name %>" do
77
+ it "exposes a newly created <%= file_name %> as @<%= file_name %>" do
78
78
  <%= class_name %>.should_receive(:new).with({'these' => 'params'}).and_return(mock_<%= file_name %>(:save => true))
79
79
  post :create, :<%= file_name %> => {:these => 'params'}
80
80
  assigns(:<%= file_name %>).should equal(mock_<%= file_name %>)
81
81
  end
82
82
 
83
- it "should redirect to the created <%= file_name %>" do
83
+ it "redirects to the created <%= file_name %>" do
84
84
  <%= class_name %>.stub!(:new).and_return(mock_<%= file_name %>(:save => true))
85
85
  post :create, :<%= file_name %> => {}
86
86
  response.should redirect_to(<%= table_name.singularize %>_url(mock_<%= file_name %>))
@@ -90,13 +90,13 @@ describe <%= controller_class_name %>Controller do
90
90
 
91
91
  describe "with invalid params" do
92
92
 
93
- it "should expose a newly created but unsaved <%= file_name %> as @<%= file_name %>" do
93
+ it "exposes a newly created but unsaved <%= file_name %> as @<%= file_name %>" do
94
94
  <%= class_name %>.stub!(:new).with({'these' => 'params'}).and_return(mock_<%= file_name %>(:save => false))
95
95
  post :create, :<%= file_name %> => {:these => 'params'}
96
96
  assigns(:<%= file_name %>).should equal(mock_<%= file_name %>)
97
97
  end
98
98
 
99
- it "should re-render the 'new' template" do
99
+ it "re-renders the 'new' template" do
100
100
  <%= class_name %>.stub!(:new).and_return(mock_<%= file_name %>(:save => false))
101
101
  post :create, :<%= file_name %> => {}
102
102
  response.should render_template('new')
@@ -106,23 +106,23 @@ describe <%= controller_class_name %>Controller do
106
106
 
107
107
  end
108
108
 
109
- describe "responding to PUT udpate" do
109
+ describe "PUT udpate" do
110
110
 
111
111
  describe "with valid params" do
112
112
 
113
- it "should update the requested <%= file_name %>" do
113
+ it "updates the requested <%= file_name %>" do
114
114
  <%= class_name %>.should_receive(:find).with("37").and_return(mock_<%= file_name %>)
115
115
  mock_<%= file_name %>.should_receive(:update_attributes).with({'these' => 'params'})
116
116
  put :update, :id => "37", :<%= file_name %> => {:these => 'params'}
117
117
  end
118
118
 
119
- it "should expose the requested <%= file_name %> as @<%= file_name %>" do
119
+ it "exposes the requested <%= file_name %> as @<%= file_name %>" do
120
120
  <%= class_name %>.stub!(:find).and_return(mock_<%= file_name %>(:update_attributes => true))
121
121
  put :update, :id => "1"
122
122
  assigns(:<%= file_name %>).should equal(mock_<%= file_name %>)
123
123
  end
124
124
 
125
- it "should redirect to the <%= file_name %>" do
125
+ it "redirects to the <%= file_name %>" do
126
126
  <%= class_name %>.stub!(:find).and_return(mock_<%= file_name %>(:update_attributes => true))
127
127
  put :update, :id => "1"
128
128
  response.should redirect_to(<%= table_name.singularize %>_url(mock_<%= file_name %>))
@@ -132,19 +132,19 @@ describe <%= controller_class_name %>Controller do
132
132
 
133
133
  describe "with invalid params" do
134
134
 
135
- it "should update the requested <%= file_name %>" do
135
+ it "updates the requested <%= file_name %>" do
136
136
  <%= class_name %>.should_receive(:find).with("37").and_return(mock_<%= file_name %>)
137
137
  mock_<%= file_name %>.should_receive(:update_attributes).with({'these' => 'params'})
138
138
  put :update, :id => "37", :<%= file_name %> => {:these => 'params'}
139
139
  end
140
140
 
141
- it "should expose the <%= file_name %> as @<%= file_name %>" do
141
+ it "exposes the <%= file_name %> as @<%= file_name %>" do
142
142
  <%= class_name %>.stub!(:find).and_return(mock_<%= file_name %>(:update_attributes => false))
143
143
  put :update, :id => "1"
144
144
  assigns(:<%= file_name %>).should equal(mock_<%= file_name %>)
145
145
  end
146
146
 
147
- it "should re-render the 'edit' template" do
147
+ it "re-renders the 'edit' template" do
148
148
  <%= class_name %>.stub!(:find).and_return(mock_<%= file_name %>(:update_attributes => false))
149
149
  put :update, :id => "1"
150
150
  response.should render_template('edit')
@@ -154,15 +154,15 @@ describe <%= controller_class_name %>Controller do
154
154
 
155
155
  end
156
156
 
157
- describe "responding to DELETE destroy" do
157
+ describe "DELETE destroy" do
158
158
 
159
- it "should destroy the requested <%= file_name %>" do
159
+ it "destroys the requested <%= file_name %>" do
160
160
  <%= class_name %>.should_receive(:find).with("37").and_return(mock_<%= file_name %>)
161
161
  mock_<%= file_name %>.should_receive(:destroy)
162
162
  delete :destroy, :id => "37"
163
163
  end
164
164
 
165
- it "should redirect to the <%= table_name %> list" do
165
+ it "redirects to the <%= table_name %> list" do
166
166
  <%= class_name %>.stub!(:find).and_return(mock_<%= file_name %>(:destroy => true))
167
167
  delete :destroy, :id => "1"
168
168
  response.should redirect_to(<%= table_name %>_url)
@@ -13,7 +13,7 @@ describe "/<%= table_name %>/edit.<%= default_file_extension %>" do
13
13
  )
14
14
  end
15
15
 
16
- it "should render edit form" do
16
+ it "renders the edit <%= file_name %> form" do
17
17
  render "/<%= table_name %>/edit.<%= default_file_extension %>"
18
18
 
19
19
  response.should have_tag("form[action=#{<%= file_name %>_path(@<%= file_name %>)}][method=post]") do
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_dep
3
3
  describe <%= controller_class_name %>Helper do
4
4
 
5
5
  #Delete this example and add some real ones or delete this file
6
- it "should be included in the object returned by #helper" do
6
+ it "is included in the helper object" do
7
7
  included_modules = (class << helper; self; end).send :included_modules
8
8
  included_modules.should include(<%= controller_class_name %>Helper)
9
9
  end
@@ -18,7 +18,7 @@ describe "/<%= table_name %>/index.<%= default_file_extension %>" do
18
18
  ]
19
19
  end
20
20
 
21
- it "should render list of <%= table_name %>" do
21
+ it "renders a list of <%= table_name %>" do
22
22
  render "/<%= table_name %>/index.<%= default_file_extension %>"
23
23
  <% for attribute in output_attributes -%>
24
24
  response.should have_tag("tr>td", <%= attribute.default_value %>.to_s, 2)
@@ -13,7 +13,7 @@ describe "/<%= table_name %>/new.<%= default_file_extension %>" do
13
13
  )
14
14
  end
15
15
 
16
- it "should render new form" do
16
+ it "renders new <%= file_name %> form" do
17
17
  render "/<%= table_name %>/new.<%= default_file_extension %>"
18
18
 
19
19
  response.should have_tag("form[action=?][method=post]", <%= table_name %>_path) do