Skip to content

Commit 1ccb17c

Browse files
committed
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.
1 parent 13b699f commit 1ccb17c

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

lib/generators/rspec/scaffold/templates/edit_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'spec_helper'
22

33
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
4-
describe "<%= ns_table_name %>/edit.html.<%= options[:template_engine] %>" do
4+
describe "<%= ns_table_name %>/edit" do
55
before(:each) do
66
@<%= ns_file_name %> = assign(:<%= ns_file_name %>, stub_model(<%= class_name %><%= output_attributes.empty? ? '))' : ',' %>
77
<% output_attributes.each_with_index do |attribute, attribute_index| -%>

lib/generators/rspec/scaffold/templates/index_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'spec_helper'
22

33
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
4-
describe "<%= ns_table_name %>/index.html.<%= options[:template_engine] %>" do
4+
describe "<%= ns_table_name %>/index" do
55
before(:each) do
66
assign(:<%= table_name %>, [
77
<% [1,2].each_with_index do |id, model_index| -%>

lib/generators/rspec/scaffold/templates/new_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'spec_helper'
22

33
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
4-
describe "<%= ns_table_name %>/new.html.<%= options[:template_engine] %>" do
4+
describe "<%= ns_table_name %>/new" do
55
before(:each) do
66
assign(:<%= ns_file_name %>, stub_model(<%= class_name %><%= output_attributes.empty? ? ').as_new_record)' : ',' %>
77
<% output_attributes.each_with_index do |attribute, attribute_index| -%>

lib/generators/rspec/scaffold/templates/show_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'spec_helper'
22

33
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
4-
describe "<%= ns_table_name %>/show.html.<%= options[:template_engine] %>" do
4+
describe "<%= ns_table_name %>/show" do
55
before(:each) do
66
@<%= ns_file_name %> = assign(:<%= ns_file_name %>, stub_model(<%= class_name %><%= output_attributes.empty? ? '))' : ',' %>
77
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require 'spec_helper'
22

3-
describe "<%= file_path %>/<%= @action %>.html.<%= options[:template_engine] %>" do
3+
describe "<%= file_path %>/<%= @action %>" do
44
pending "add some examples to (or delete) #{__FILE__}"
55
end

spec/generators/rspec/scaffold/scaffold_generator_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,31 +35,31 @@
3535
subject { file("spec/views/posts/edit.html.erb_spec.rb") }
3636
it { should exist }
3737
it { should contain /require 'spec_helper'/ }
38-
it { should contain /describe "(.*)\/edit.html.erb"/ }
38+
it { should contain /describe "(.*)\/edit"/ }
3939
it { should contain /it "renders the edit (.*) form"/ }
4040
end
4141

4242
describe 'index' do
4343
subject { file("spec/views/posts/index.html.erb_spec.rb") }
4444
it { should exist }
4545
it { should contain /require 'spec_helper'/ }
46-
it { should contain /describe "(.*)\/index.html.erb"/ }
46+
it { should contain /describe "(.*)\/index"/ }
4747
it { should contain /it "renders a list of (.*)"/ }
4848
end
4949

5050
describe 'new' do
5151
subject { file("spec/views/posts/new.html.erb_spec.rb") }
5252
it { should exist }
5353
it { should contain /require 'spec_helper'/ }
54-
it { should contain /describe "(.*)\/new.html.erb"/ }
54+
it { should contain /describe "(.*)\/new"/ }
5555
it { should contain /it "renders new (.*) form"/ }
5656
end
5757

5858
describe 'show' do
5959
subject { file("spec/views/posts/show.html.erb_spec.rb") }
6060
it { should exist }
6161
it { should contain /require 'spec_helper'/ }
62-
it { should contain /describe "(.*)\/show.html.erb"/ }
62+
it { should contain /describe "(.*)\/show"/ }
6363
it { should contain /it "renders attributes in <p>"/ }
6464
end
6565
end

spec/generators/rspec/view/view_generator_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
run_generator %w(posts index)
1515
file('spec/views/posts/index.html.erb_spec.rb').tap do |f|
1616
f.should contain /require 'spec_helper'/
17-
f.should contain /describe "posts\/index.html.erb"/
17+
f.should contain /describe "posts\/index"/
1818
end
1919
end
2020

@@ -23,18 +23,18 @@
2323
run_generator %w(admin/posts index)
2424
file('spec/views/admin/posts/index.html.erb_spec.rb').tap do |f|
2525
f.should contain /require 'spec_helper'/
26-
f.should contain /describe "admin\/posts\/index.html.erb"/
26+
f.should contain /describe "admin\/posts\/index"/
2727
end
2828
end
2929
end
3030
end
3131

32-
describe 'haml' do
32+
describe 'with a specified template engine' do
3333
it 'generates a spec for the supplied action' do
3434
run_generator %w(posts index --template_engine haml)
3535
file('spec/views/posts/index.html.haml_spec.rb').tap do |f|
3636
f.should contain /require 'spec_helper'/
37-
f.should contain /describe "posts\/index.html.haml"/
37+
f.should contain /describe "posts\/index"/
3838
end
3939
end
4040
end

0 commit comments

Comments
 (0)