Skip to content

Commit a6329e1

Browse files
benoittgtsebjacobs
authored andcommitted
Merge pull request rspec#2034 from jekuta/fix-1877
[Fixes rspec#1877] Do not duplicate namespace in the path name
1 parent a151246 commit a6329e1

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

lib/generators/rspec/feature/feature_generator.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ def template_name
1919

2020
def filename
2121
if options[:singularize]
22-
"#{table_name.singularize}_spec.rb"
22+
"#{file_name.singularize}_spec.rb"
2323
else
24-
"#{table_name}_spec.rb"
24+
"#{file_name}_spec.rb"
2525
end
2626
end
2727
end

spec/generators/rspec/feature/feature_generator_spec.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,21 @@
2424
end
2525
end
2626

27+
describe 'are generated with the correct namespace' do
28+
before do
29+
run_generator %w(folder/posts)
30+
end
31+
describe 'the spec' do
32+
subject(:feature_spec) { file('spec/features/folder/posts_spec.rb') }
33+
it "exists" do
34+
expect(feature_spec).to exist
35+
end
36+
it "contains the feature" do
37+
expect(feature_spec).to contain(/^RSpec.feature \"Folder::Posts\", #{type_metatag(:feature)}/)
38+
end
39+
end
40+
end
41+
2742
describe 'are singularized appropriately with the --singularize flag' do
2843
before do
2944
run_generator %w(posts --singularize)

0 commit comments

Comments
 (0)