rspec-rails 1.2.6 → 1.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/History.rdoc +27 -2
  2. data/Manifest.txt +3 -2
  3. data/Rakefile +5 -6
  4. data/TODO.txt +17 -0
  5. data/Upgrade.rdoc +11 -0
  6. data/generators/integration_spec/integration_spec_generator.rb +10 -0
  7. data/generators/integration_spec/templates/integration_spec.rb +4 -0
  8. data/generators/rspec/templates/rcov.opts +1 -1
  9. data/generators/rspec/templates/rspec.rake +27 -12
  10. data/generators/rspec/templates/spec_helper.rb +5 -1
  11. data/generators/rspec_controller/templates/helper_spec.rb +1 -1
  12. data/generators/rspec_controller/templates/view_spec.rb +1 -1
  13. data/generators/rspec_default_values.rb +11 -2
  14. data/generators/rspec_model/templates/model_spec.rb +1 -3
  15. data/generators/rspec_scaffold/rspec_scaffold_generator.rb +7 -3
  16. data/generators/rspec_scaffold/templates/controller_spec.rb +8 -8
  17. data/generators/rspec_scaffold/templates/edit_erb_spec.rb +2 -4
  18. data/generators/rspec_scaffold/templates/helper_spec.rb +2 -2
  19. data/generators/rspec_scaffold/templates/index_erb_spec.rb +1 -2
  20. data/generators/rspec_scaffold/templates/new_erb_spec.rb +2 -4
  21. data/generators/rspec_scaffold/templates/routing_spec.rb +16 -16
  22. data/generators/rspec_scaffold/templates/show_erb_spec.rb +0 -1
  23. data/lib/autotest/discover.rb +5 -1
  24. data/lib/spec/rails.rb +0 -2
  25. data/lib/spec/rails/example.rb +1 -0
  26. data/lib/spec/rails/example/controller_example_group.rb +22 -2
  27. data/lib/spec/rails/example/functional_example_group.rb +22 -0
  28. data/lib/spec/rails/example/integration_example_group.rb +16 -0
  29. data/lib/spec/rails/example/render_observer.rb +15 -2
  30. data/lib/spec/rails/extensions/spec/matchers/have.rb +4 -4
  31. data/lib/spec/rails/matchers/ar_be_valid.rb +33 -31
  32. data/lib/spec/rails/matchers/change.rb +9 -7
  33. data/lib/spec/rails/matchers/render_template.rb +10 -1
  34. data/lib/spec/rails/spec_server.rb +3 -0
  35. data/lib/spec/rails/version.rb +4 -3
  36. data/spec/resources/controllers/controller_spec_controller.rb +5 -2
  37. data/spec/spec/rails/example/controller_isolation_spec.rb +7 -1
  38. data/spec/spec/rails/extensions/action_view_base_spec.rb +42 -16
  39. data/spec/spec/rails/matchers/errors_on_spec.rb +14 -2
  40. data/spec/spec/rails/matchers/have_text_spec.rb +0 -1
  41. data/spec/spec/rails/matchers/render_template_spec.rb +11 -1
  42. data/spec/spec/rails/spec_server_spec.rb +2 -1
  43. metadata +12 -11
  44. data/features/step_definitions/people.rb +0 -6
  45. data/features/support/env.rb +0 -13
@@ -1,3 +1,26 @@
1
+ === Version 1.2.7 / 2009-06-22
2
+
3
+ * enhancements
4
+ * alias :stub!, :stub so rspec-rails extensions of rspec stubs can use the
5
+ same syntax as rspec (core)
6
+ * integration specs (Ben Mabey and David Chelimsky)
7
+ * added support for references and belongs_to generated model specs (José
8
+ Valim). Closes #792.
9
+ * add discovery for autotest-rails to keep compatible with ZenTest-4.0.0
10
+ (Ryan Davis). Closes #838.
11
+ * controller specs in isolation mode don't care whether the file exists
12
+ anymore!
13
+
14
+ * bug fixes
15
+ * allow rspec-rails to work without ActiveRecord. Closes #810.
16
+ * fix bug with have() matcher failure message (Dave Giunta). Closes #818.
17
+ * fix bug where render_template('new') would pass if 'newer' was rendered
18
+ (or anything that started with 'new')
19
+
20
+ * deprecations
21
+ * spec_server is now deprecated - use spork instead (gem install spork).
22
+ Closes #827.
23
+
1
24
  === Version 1.2.6 / 2009-04-30
2
25
 
3
26
  * bug fixes
@@ -13,7 +36,8 @@
13
36
  * Fixed a small typo that makes rake stats fail (José Valim). Closes #802.
14
37
  * link_to and friends are available to ViewExampleGroup again
15
38
  (J.B. Rainsberger). Closes #787.
16
- * spec_server works correctly with rails 2.3 again (Neil Buckley). Closes #759.
39
+ * spec_server works correctly with rails 2.3 again (Neil Buckley). Closes
40
+ #759.
17
41
 
18
42
  === Version 1.2.4 / 2009-03-13
19
43
 
@@ -40,7 +64,8 @@ See Upgrade.rdoc for information about upgrading to rspec-rails-1.2.1
40
64
  * more cleanup of internals (reducing dependency on rspec-core)
41
65
  * don't require config/environments more than once
42
66
  * autotest includes spec/routing directory (Matt Peterson). Closes #739.
43
- * display helpful messages when installing rspec-rails running script/generate rspec
67
+ * display helpful messages when installing rspec-rails running
68
+ script/generate rspec
44
69
  * thanks for Dr Nic for the pointers
45
70
  * restored require 'rubygems' where needed
46
71
  * export NO_RUBYGEMS=true if you don't use rubygems
@@ -6,8 +6,8 @@ README.rdoc
6
6
  Rakefile
7
7
  TODO.txt
8
8
  Upgrade.rdoc
9
- features/step_definitions/people.rb
10
- features/support/env.rb
9
+ generators/integration_spec/integration_spec_generator.rb
10
+ generators/integration_spec/templates/integration_spec.rb
11
11
  generators/rspec/CHANGES
12
12
  generators/rspec/rspec_generator.rb
13
13
  generators/rspec/templates/previous_failures.txt
@@ -45,6 +45,7 @@ lib/spec/rails/example/controller_example_group.rb
45
45
  lib/spec/rails/example/cookies_proxy.rb
46
46
  lib/spec/rails/example/functional_example_group.rb
47
47
  lib/spec/rails/example/helper_example_group.rb
48
+ lib/spec/rails/example/integration_example_group.rb
48
49
  lib/spec/rails/example/model_example_group.rb
49
50
  lib/spec/rails/example/render_observer.rb
50
51
  lib/spec/rails/example/routing_example_group.rb
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  # -*- ruby -*-
2
- gem 'hoe', '>=1.9.0'
2
+ gem 'hoe', '>=2.0.0'
3
3
  require 'hoe'
4
4
  require './lib/spec/rails/version'
5
5
  require 'cucumber/rake/task'
@@ -8,13 +8,14 @@ $:.unshift(File.join(File.dirname(__FILE__), "/../rspec/lib"))
8
8
 
9
9
  require 'spec/rake/spectask'
10
10
 
11
- Hoe.new('rspec-rails', Spec::Rails::VERSION::STRING) do |p|
11
+ Hoe.spec('rspec-rails') do |p|
12
+ p.version = Spec::Rails::VERSION::STRING
12
13
  p.summary = Spec::Rails::VERSION::SUMMARY
13
14
  p.description = "Behaviour Driven Development for Ruby on Rails."
14
15
  p.rubyforge_name = 'rspec'
15
16
  p.developer('RSpec Development Team', 'rspec-devel@rubyforge.org')
16
- p.extra_deps = [["rspec","1.2.6"],["rack",">=0.4.0"]]
17
- p.extra_dev_deps = [["cucumber",">= 0.2.2"]]
17
+ p.extra_deps = [["rspec",">=1.2.7"],["rack",">=0.4.0"]]
18
+ p.extra_dev_deps = [["cucumber",">= 0.3.11"]]
18
19
  p.remote_rdoc_dir = "rspec-rails/#{Spec::Rails::VERSION::STRING}"
19
20
  p.history_file = 'History.rdoc'
20
21
  p.readme_file = 'README.rdoc'
@@ -58,8 +59,6 @@ task :release => [:clean, :package] do |t|
58
59
  end
59
60
  end
60
61
 
61
- Spec::Rake::SpecTask.new
62
-
63
62
  Cucumber::Rake::Task.new
64
63
 
65
64
  task :default => [:features]
data/TODO.txt CHANGED
@@ -1 +1,18 @@
1
1
  * delegate params_from to assert_recognizes
2
+ * wiki
3
+ * need a matrix of which rspec-rails versions support which rails versions
4
+ * CI
5
+ * need a robust CI setup that runs
6
+ * Multiple rubies
7
+ * MRI: 1.8.6
8
+ * MRI: 1.8.9
9
+ * MRI: 1.9.1
10
+ * JRuby
11
+ * IronRuby??? (perhaps using mono)
12
+ * Multiple rails-es
13
+ * 2.0.5
14
+ * 2.1.2
15
+ * 2.2.2
16
+ * 2.3.2
17
+ * 3.0 (once available)
18
+ * With and without ActiveRecord
@@ -1,3 +1,14 @@
1
+ = Upgrade to 1.2.7
2
+
3
+ == What's changed
4
+
5
+ === spec_server is deprecated
6
+
7
+ spec_server is deprecated in favor of Tim Harper's new spork library
8
+ (http://github.com/timcharper/spork). Get it. Use it. Love it.
9
+
10
+ gem install spork
11
+
1
12
  = Upgrade to 1.2.0-1.2.6
2
13
 
3
14
  == What's changed
@@ -0,0 +1,10 @@
1
+ require File.dirname(__FILE__) + '/../rspec_default_values'
2
+
3
+ class IntegrationSpecGenerator < ModelGenerator
4
+ def manifest
5
+ record do |m|
6
+ m.class_collisions class_path, class_name
7
+ m.template 'integration_spec.rb', File.join('spec/integration', class_path, "#{class_name.tableize}_spec.rb")
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,4 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper')
2
+
3
+ describe "<%= class_name.pluralize %>" do
4
+ end
@@ -1,2 +1,2 @@
1
- --exclude "spec/*,gems/*"
1
+ --exclude "spec/*,gems/*"
2
2
  --rails
@@ -1,6 +1,19 @@
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
2
6
  rspec_plugin_dir = File.expand_path(File.dirname(__FILE__) + '/../../vendor/plugins/rspec')
3
- $LOAD_PATH.unshift("#{rspec_plugin_dir}/lib") if File.exist?(rspec_plugin_dir)
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
4
17
 
5
18
  # Don't load rspec if running "rake gems:*"
6
19
  unless ARGV.any? {|a| a =~ /^gems/}
@@ -44,14 +57,14 @@ task :stats => "spec:statsetup"
44
57
  desc "Run all specs in spec directory (excluding plugin specs)"
45
58
  Spec::Rake::SpecTask.new(:spec => spec_prereq) do |t|
46
59
  t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
47
- t.spec_files = FileList['spec/**/*/*_spec.rb']
60
+ t.spec_files = FileList['spec/**/*_spec.rb']
48
61
  end
49
62
 
50
63
  namespace :spec do
51
64
  desc "Run all specs in spec directory with RCov (excluding plugin specs)"
52
65
  Spec::Rake::SpecTask.new(:rcov) do |t|
53
66
  t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
54
- t.spec_files = FileList['spec/**/*/*_spec.rb']
67
+ t.spec_files = FileList['spec/**/*_spec.rb']
55
68
  t.rcov = true
56
69
  t.rcov_opts = lambda do
57
70
  IO.readlines("#{RAILS_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
@@ -61,16 +74,16 @@ namespace :spec do
61
74
  desc "Print Specdoc for all specs (excluding plugin specs)"
62
75
  Spec::Rake::SpecTask.new(:doc) do |t|
63
76
  t.spec_opts = ["--format", "specdoc", "--dry-run"]
64
- t.spec_files = FileList['spec/**/*/*_spec.rb']
77
+ t.spec_files = FileList['spec/**/*_spec.rb']
65
78
  end
66
79
 
67
80
  desc "Print Specdoc for all plugin examples"
68
81
  Spec::Rake::SpecTask.new(:plugin_doc) do |t|
69
82
  t.spec_opts = ["--format", "specdoc", "--dry-run"]
70
- t.spec_files = FileList['vendor/plugins/**/spec/**/*/*_spec.rb'].exclude('vendor/plugins/rspec/*')
83
+ t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*')
71
84
  end
72
85
 
73
- [:models, :controllers, :views, :helpers, :lib].each do |sub|
86
+ [:models, :controllers, :views, :helpers, :lib, :integration].each do |sub|
74
87
  desc "Run the code examples in spec/#{sub}"
75
88
  Spec::Rake::SpecTask.new(sub => spec_prereq) do |t|
76
89
  t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
@@ -81,14 +94,14 @@ namespace :spec do
81
94
  desc "Run the code examples in vendor/plugins (except RSpec's own)"
82
95
  Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t|
83
96
  t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
84
- t.spec_files = FileList['vendor/plugins/**/spec/**/*/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*")
97
+ t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*")
85
98
  end
86
99
 
87
100
  namespace :plugins do
88
101
  desc "Runs the examples for rspec_on_rails"
89
102
  Spec::Rake::SpecTask.new(:rspec_on_rails) do |t|
90
103
  t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
91
- t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*/*_spec.rb']
104
+ t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*_spec.rb']
92
105
  end
93
106
  end
94
107
 
@@ -101,12 +114,14 @@ namespace :spec do
101
114
  ::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers')
102
115
  ::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib')
103
116
  ::STATS_DIRECTORIES << %w(Routing\ specs spec/routing) if File.exist?('spec/routing')
117
+ ::STATS_DIRECTORIES << %w(Integration\ specs spec/integration) if File.exist?('spec/integration')
104
118
  ::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models')
105
119
  ::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views')
106
120
  ::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers')
107
121
  ::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers')
108
122
  ::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib')
109
123
  ::CodeStatistics::TEST_TYPES << "Routing specs" if File.exist?('spec/routing')
124
+ ::CodeStatistics::TEST_TYPES << "Integration specs" if File.exist?('spec/integration')
110
125
  end
111
126
 
112
127
  namespace :db do
@@ -116,7 +131,7 @@ namespace :spec do
116
131
  ActiveRecord::Base.establish_connection(Rails.env)
117
132
  base_dir = File.join(Rails.root, 'spec', 'fixtures')
118
133
  fixtures_dir = ENV['FIXTURES_DIR'] ? File.join(base_dir, ENV['FIXTURES_DIR']) : base_dir
119
-
134
+
120
135
  require 'active_record/fixtures'
121
136
  (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/).map {|f| File.join(fixtures_dir, f) } : Dir.glob(File.join(fixtures_dir, '*.{yml,csv}'))).each do |fixture_file|
122
137
  Fixtures.create_fixtures(File.dirname(fixture_file), File.basename(fixture_file, '.*'))
@@ -127,7 +142,7 @@ namespace :spec do
127
142
 
128
143
  namespace :server do
129
144
  daemonized_server_pid = File.expand_path("#{RAILS_ROOT}/tmp/pids/spec_server.pid")
130
-
145
+
131
146
  desc "start spec_server."
132
147
  task :start do
133
148
  if File.exist?(daemonized_server_pid)
@@ -145,14 +160,14 @@ namespace :spec do
145
160
  $stderr.puts "No server running."
146
161
  else
147
162
  $stderr.puts "Shutting down spec_server ..."
148
- system("kill", "-s", "TERM", File.read(daemonized_server_pid).strip) &&
163
+ system("kill", "-s", "TERM", File.read(daemonized_server_pid).strip) &&
149
164
  File.delete(daemonized_server_pid)
150
165
  end
151
166
  end
152
167
 
153
168
  desc "restart spec_server."
154
169
  task :restart => [:stop, :start]
155
-
170
+
156
171
  desc "check if spec server is running"
157
172
  task :status do
158
173
  if File.exist?(daemonized_server_pid)
@@ -5,6 +5,10 @@ require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_
5
5
  require 'spec/autorun'
6
6
  require 'spec/rails'
7
7
 
8
+ # Requires supporting files with custom matchers and macros, etc,
9
+ # in ./support/ and its subdirectories.
10
+ Dir["#{File.dirname(__FILE)}/support/**/*.rb"].each {|f| require f}
11
+
8
12
  Spec::Runner.configure do |config|
9
13
  # If you're not using ActiveRecord you should remove these
10
14
  # lines, delete config/database.yml and disable :active_record
@@ -42,6 +46,6 @@ Spec::Runner.configure do |config|
42
46
  # config.mock_with :rr
43
47
  #
44
48
  # == Notes
45
- #
49
+ #
46
50
  # For more information take a look at Spec::Runner::Configuration and Spec::Runner
47
51
  end
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper')
2
2
 
3
3
  describe <%= class_name %>Helper do
4
-
4
+
5
5
  #Delete this example and add some real ones or delete this file
6
6
  it "should be included in the object returned by #helper" do
7
7
  included_modules = (class << helper; self; end).send :included_modules
@@ -4,7 +4,7 @@ describe "/<%= class_name.underscore %>/<%= action %>" do
4
4
  before(:each) do
5
5
  render '<%= class_name.underscore %>/<%= action %>'
6
6
  end
7
-
7
+
8
8
  #Delete this example and add some real ones or delete this file
9
9
  it "should tell you where to find the file" do
10
10
  response.should have_tag('p', %r[Find me in app/views/<%= class_name.underscore %>/<%= action %>])
@@ -10,10 +10,19 @@ module Rails
10
10
  when :date then "Date.today"
11
11
  when :string, :text then "\"value for #{@name}\""
12
12
  when :boolean then "false"
13
+ when :belongs_to, :references then "1"
13
14
  else
14
15
  ""
15
- end
16
+ end
17
+ end
18
+
19
+ def name_or_reference
20
+ if ::Rails::VERSION::STRING >= '2.2'
21
+ reference? ? :"#{name}_id" : name
22
+ else
23
+ name
24
+ end
16
25
  end
17
26
  end
18
27
  end
19
- end
28
+ end
@@ -3,9 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_dep
3
3
  describe <%= class_name %> do
4
4
  before(:each) do
5
5
  @valid_attributes = {
6
- <% attributes.each_with_index do |attribute, attribute_index| -%>
7
- :<%= attribute.name %> => <%= attribute.default_value %><%= attribute_index == attributes.length - 1 ? '' : ','%>
8
- <% end -%>
6
+ <%= attributes.map{|a| ":#{a.name_or_reference} => #{a.default_value}" }.join(",\n ") %>
9
7
  }
10
8
  end
11
9
 
@@ -54,6 +54,7 @@ class RspecScaffoldGenerator < Rails::Generator::NamedBase
54
54
  m.directory(File.join('spec/helpers', class_path))
55
55
  m.directory File.join('spec/fixtures', class_path)
56
56
  m.directory File.join('spec/views', controller_class_path, controller_file_name)
57
+ m.directory File.join('spec/integration', class_path)
57
58
 
58
59
  # Layout and stylesheet.
59
60
  m.template("scaffold:layout.html.erb", File.join('app/views/layouts', controller_class_path, "#{controller_file_name}.html.erb"))
@@ -83,9 +84,9 @@ class RspecScaffoldGenerator < Rails::Generator::NamedBase
83
84
  end
84
85
 
85
86
  # Model class, unit test, and fixtures.
86
- m.template 'model:model.rb', File.join('app/models', class_path, "#{file_name}.rb")
87
- m.template 'model:fixtures.yml', File.join('spec/fixtures', class_path, "#{table_name}.yml")
88
- m.template 'rspec_model:model_spec.rb', File.join('spec/models', class_path, "#{file_name}_spec.rb")
87
+ m.template 'model:model.rb', File.join('app/models', class_path, "#{file_name}.rb")
88
+ m.template 'model:fixtures.yml', File.join('spec/fixtures', class_path, "#{table_name}.yml")
89
+ m.template 'rspec_model:model_spec.rb', File.join('spec/models', class_path, "#{file_name}_spec.rb")
89
90
 
90
91
  # View specs
91
92
  m.template "rspec_scaffold:edit_erb_spec.rb",
@@ -97,6 +98,9 @@ class RspecScaffoldGenerator < Rails::Generator::NamedBase
97
98
  m.template "rspec_scaffold:show_erb_spec.rb",
98
99
  File.join('spec/views', controller_class_path, controller_file_name, "show.#{default_file_extension}_spec.rb")
99
100
 
101
+ # Integration
102
+ m.template 'integration_spec:integration_spec.rb', File.join('spec/integration', class_path, "#{table_name}_spec.rb")
103
+
100
104
  unless options[:skip_migration]
101
105
  m.migration_template(
102
106
  'model:migration.rb', 'db/migrate',
@@ -5,7 +5,7 @@ describe <%= controller_class_name %>Controller do
5
5
  def mock_<%= file_name %>(stubs={})
6
6
  @mock_<%= file_name %> ||= mock_model(<%= class_name %>, stubs)
7
7
  end
8
-
8
+
9
9
  describe "GET index" do
10
10
  it "assigns all <%= table_name.pluralize %> as @<%= table_name.pluralize %>" do
11
11
  <%= class_name %>.stub!(:find).with(:all).and_return([mock_<%= file_name %>])
@@ -39,7 +39,7 @@ describe <%= controller_class_name %>Controller do
39
39
  end
40
40
 
41
41
  describe "POST create" do
42
-
42
+
43
43
  describe "with valid params" do
44
44
  it "assigns a newly created <%= file_name %> as @<%= file_name %>" do
45
45
  <%= class_name %>.stub!(:new).with({'these' => 'params'}).and_return(mock_<%= file_name %>(:save => true))
@@ -53,7 +53,7 @@ describe <%= controller_class_name %>Controller do
53
53
  response.should redirect_to(<%= table_name.singularize %>_url(mock_<%= file_name %>))
54
54
  end
55
55
  end
56
-
56
+
57
57
  describe "with invalid params" do
58
58
  it "assigns a newly created but unsaved <%= file_name %> as @<%= file_name %>" do
59
59
  <%= class_name %>.stub!(:new).with({'these' => 'params'}).and_return(mock_<%= file_name %>(:save => false))
@@ -67,11 +67,11 @@ describe <%= controller_class_name %>Controller do
67
67
  response.should render_template('new')
68
68
  end
69
69
  end
70
-
70
+
71
71
  end
72
72
 
73
73
  describe "PUT update" do
74
-
74
+
75
75
  describe "with valid params" do
76
76
  it "updates the requested <%= file_name %>" do
77
77
  <%= class_name %>.should_receive(:find).with("37").and_return(mock_<%= file_name %>)
@@ -91,7 +91,7 @@ describe <%= controller_class_name %>Controller do
91
91
  response.should redirect_to(<%= table_name.singularize %>_url(mock_<%= file_name %>))
92
92
  end
93
93
  end
94
-
94
+
95
95
  describe "with invalid params" do
96
96
  it "updates the requested <%= file_name %>" do
97
97
  <%= class_name %>.should_receive(:find).with("37").and_return(mock_<%= file_name %>)
@@ -111,7 +111,7 @@ describe <%= controller_class_name %>Controller do
111
111
  response.should render_template('edit')
112
112
  end
113
113
  end
114
-
114
+
115
115
  end
116
116
 
117
117
  describe "DELETE destroy" do
@@ -120,7 +120,7 @@ describe <%= controller_class_name %>Controller do
120
120
  mock_<%= file_name %>.should_receive(:destroy)
121
121
  delete :destroy, :id => "37"
122
122
  end
123
-
123
+
124
124
  it "redirects to the <%= table_name %> list" do
125
125
  <%= class_name %>.stub!(:find).and_return(mock_<%= file_name %>(:destroy => true))
126
126
  delete :destroy, :id => "1"