Skip to content

Commit 8658247

Browse files
pirjJonRowe
authored andcommitted
Merge pull request #2399 from ThHareau/feat/ticket-2375
Improve controller template when no action
1 parent 80c82f3 commit 8658247

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/generators/rspec/controller/templates/request_spec.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
require 'rails_helper'
22

33
RSpec.describe "<%= class_name.pluralize %>", <%= type_metatag(:request) %> do
4-
<% namespaced_path = regular_class_path.join('/') %>
4+
<% namespaced_path = regular_class_path.join('/') -%>
5+
<% if actions.empty? -%>
6+
describe "GET /index" do
7+
pending "add some examples (or delete) #{__FILE__}"
8+
end
9+
<% end -%>
510
<% for action in actions -%>
611
describe "GET /<%= action %>" do
712
it "returns http success" do

spec/generators/rspec/controller/controller_generator_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
it { is_expected.to exist }
1818
it { is_expected.to contain(/require 'rails_helper'/) }
1919
it { is_expected.to contain(/^RSpec.describe "Posts", #{type_metatag(:request)}/) }
20+
it { is_expected.to contain('pending') }
2021
end
2122
end
2223

0 commit comments

Comments
 (0)