Skip to content

[Fixes #1877] Do not duplicate namespace in the path name #2034

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/generators/rspec/feature/feature_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ def template_name

def filename
if options[:singularize]
"#{table_name.singularize}_spec.rb"
"#{file_name.singularize}_spec.rb"
else
"#{table_name}_spec.rb"
"#{file_name}_spec.rb"
end
end
end
Expand Down
15 changes: 15 additions & 0 deletions spec/generators/rspec/feature/feature_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@
end
end

describe 'are generated with the correct namespace' do
before do
run_generator %w(folder/posts)
end
describe 'the spec' do
subject(:feature_spec) { file('spec/features/folder/posts_spec.rb') }
it "exists" do
expect(feature_spec).to exist
end
it "contains the feature" do
expect(feature_spec).to contain(/^RSpec.feature \"Folder::Posts\", #{type_metatag(:feature)}/)
end
end
end

describe 'are singularized appropriately with the --singularize flag' do
before do
run_generator %w(posts --singularize)
Expand Down