Skip to content

Commit 76bfc0e

Browse files
committed
Strip out non-ascii characters in the folder directory.
The big offender being "::" being in the resource description as it treats the folder like a URI. "Namespace::Model" => "namespace::model/". Closes #93
1 parent 65f4075 commit 76bfc0e

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

features/folder_structure.feature

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Feature: Folder Structure
2+
Background:
3+
Given a file named "app.rb" with:
4+
"""
5+
class App
6+
def self.call(env)
7+
[200, {}, ["hello"]]
8+
end
9+
end
10+
"""
11+
And a file named "app_spec.rb" with:
12+
"""
13+
require "rspec_api_documentation"
14+
require "rspec_api_documentation/dsl"
15+
16+
RspecApiDocumentation.configure do |config|
17+
config.app = App
18+
end
19+
20+
resource "Namespace::Greetings" do
21+
get "/greetings" do
22+
example_request "Greeting your favorite gem" do
23+
expect(status).to eq(200)
24+
end
25+
end
26+
end
27+
"""
28+
When I run `rspec app_spec.rb --require ./app.rb --format RspecApiDocumentation::ApiFormatter`
29+
30+
Scenario: Folder structure does not contain ::
31+
When I open the index
32+
And I navigate to "Greeting your favorite gem"
33+
34+
Then I should see the route is "GET /greetings"

lib/rspec_api_documentation/views/markup_example.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def respond_to?(method, include_private = false)
1818
end
1919

2020
def dirname
21-
resource_name.downcase.gsub(/\s+/, '_')
21+
resource_name.downcase.gsub(/[^0-9a-z.\-]+/, '_')
2222
end
2323

2424
def filename

0 commit comments

Comments
 (0)