Permalink
Browse files

Remove handler and template engine from file names in generated view

specs.

- This eliminates deprecation warnings from rails 3.2, and still works
  with earlier 3.x versions.
  • Loading branch information...
1 parent 13b699f commit 1ccb17cfea27fe189c97cb88619b236e851b6fb9 @dchelimsky dchelimsky committed Dec 20, 2011
@@ -1,7 +1,7 @@
require 'spec_helper'
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
-describe "<%= ns_table_name %>/edit.html.<%= options[:template_engine] %>" do
+describe "<%= ns_table_name %>/edit" do
before(:each) do
@<%= ns_file_name %> = assign(:<%= ns_file_name %>, stub_model(<%= class_name %><%= output_attributes.empty? ? '))' : ',' %>
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
@@ -1,7 +1,7 @@
require 'spec_helper'
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
-describe "<%= ns_table_name %>/index.html.<%= options[:template_engine] %>" do
+describe "<%= ns_table_name %>/index" do
before(:each) do
assign(:<%= table_name %>, [
<% [1,2].each_with_index do |id, model_index| -%>
@@ -1,7 +1,7 @@
require 'spec_helper'
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
-describe "<%= ns_table_name %>/new.html.<%= options[:template_engine] %>" do
+describe "<%= ns_table_name %>/new" do
before(:each) do
assign(:<%= ns_file_name %>, stub_model(<%= class_name %><%= output_attributes.empty? ? ').as_new_record)' : ',' %>
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
@@ -1,7 +1,7 @@
require 'spec_helper'
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
-describe "<%= ns_table_name %>/show.html.<%= options[:template_engine] %>" do
+describe "<%= ns_table_name %>/show" do
before(:each) do
@<%= ns_file_name %> = assign(:<%= ns_file_name %>, stub_model(<%= class_name %><%= output_attributes.empty? ? '))' : ',' %>
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
@@ -1,5 +1,5 @@
require 'spec_helper'
-describe "<%= file_path %>/<%= @action %>.html.<%= options[:template_engine] %>" do
+describe "<%= file_path %>/<%= @action %>" do
pending "add some examples to (or delete) #{__FILE__}"
end
@@ -35,31 +35,31 @@
subject { file("spec/views/posts/edit.html.erb_spec.rb") }
it { should exist }
it { should contain /require 'spec_helper'/ }
- it { should contain /describe "(.*)\/edit.html.erb"/ }
+ it { should contain /describe "(.*)\/edit"/ }
it { should contain /it "renders the edit (.*) form"/ }
end
describe 'index' do
subject { file("spec/views/posts/index.html.erb_spec.rb") }
it { should exist }
it { should contain /require 'spec_helper'/ }
- it { should contain /describe "(.*)\/index.html.erb"/ }
+ it { should contain /describe "(.*)\/index"/ }
it { should contain /it "renders a list of (.*)"/ }
end
describe 'new' do
subject { file("spec/views/posts/new.html.erb_spec.rb") }
it { should exist }
it { should contain /require 'spec_helper'/ }
- it { should contain /describe "(.*)\/new.html.erb"/ }
+ it { should contain /describe "(.*)\/new"/ }
it { should contain /it "renders new (.*) form"/ }
end
describe 'show' do
subject { file("spec/views/posts/show.html.erb_spec.rb") }
it { should exist }
it { should contain /require 'spec_helper'/ }
- it { should contain /describe "(.*)\/show.html.erb"/ }
+ it { should contain /describe "(.*)\/show"/ }
it { should contain /it "renders attributes in <p>"/ }
end
end
@@ -14,7 +14,7 @@
run_generator %w(posts index)
file('spec/views/posts/index.html.erb_spec.rb').tap do |f|
f.should contain /require 'spec_helper'/
- f.should contain /describe "posts\/index.html.erb"/
+ f.should contain /describe "posts\/index"/
end
end
@@ -23,18 +23,18 @@
run_generator %w(admin/posts index)
file('spec/views/admin/posts/index.html.erb_spec.rb').tap do |f|
f.should contain /require 'spec_helper'/
- f.should contain /describe "admin\/posts\/index.html.erb"/
+ f.should contain /describe "admin\/posts\/index"/
end
end
end
end
- describe 'haml' do
+ describe 'with a specified template engine' do
it 'generates a spec for the supplied action' do
run_generator %w(posts index --template_engine haml)
file('spec/views/posts/index.html.haml_spec.rb').tap do |f|
f.should contain /require 'spec_helper'/
- f.should contain /describe "posts\/index.html.haml"/
+ f.should contain /describe "posts\/index"/
end
end
end

0 comments on commit 1ccb17c

Please sign in to comment.