Skip to content

Commit

Permalink
Strip out non-ascii characters in the folder directory.
Browse files Browse the repository at this point in the history
The big offender being "::" being in the resource description as it
treats the folder like a URI. "Namespace::Model" => "namespace::model/".

Closes zipmark#93
  • Loading branch information
oestrich committed Oct 15, 2013
1 parent 65f4075 commit 76bfc0e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
34 changes: 34 additions & 0 deletions features/folder_structure.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Feature: Folder Structure
Background:
Given a file named "app.rb" with:
"""
class App
def self.call(env)
[200, {}, ["hello"]]
end
end
"""
And a file named "app_spec.rb" with:
"""
require "rspec_api_documentation"
require "rspec_api_documentation/dsl"
RspecApiDocumentation.configure do |config|
config.app = App
end
resource "Namespace::Greetings" do
get "/greetings" do
example_request "Greeting your favorite gem" do
expect(status).to eq(200)
end
end
end
"""
When I run `rspec app_spec.rb --require ./app.rb --format RspecApiDocumentation::ApiFormatter`

Scenario: Folder structure does not contain ::
When I open the index
And I navigate to "Greeting your favorite gem"

Then I should see the route is "GET /greetings"
2 changes: 1 addition & 1 deletion lib/rspec_api_documentation/views/markup_example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def respond_to?(method, include_private = false)
end

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

def filename
Expand Down

0 comments on commit 76bfc0e

Please sign in to comment.