Permalink
Browse files

Add api_name configuration option, fixes #37

  • Loading branch information...
1 parent 0ba4eb5 commit 7db5d1cdad9d2abd8dd651ce2f28feab61df9042 @oestrich committed May 31, 2012
@@ -40,4 +40,5 @@
#config.format = [:json, :html]
config.url_prefix = "/docs"
config.curl_host = 'http://localhost:3000'
+ config.api_name = "Example App API"
end
@@ -20,6 +20,7 @@ Feature: Generate HTML documentation from test examples
RspecApiDocumentation.configure do |config|
config.app = App
+ config.api_name = "Example API"
end
resource "Greetings" do
@@ -53,6 +54,7 @@ Feature: Generate HTML documentation from test examples
When I open the index
Then I should see the following resources:
| Greetings |
+ And I should see the api name "Example API"
Scenario: Example HTML documentation includes the parameters
When I open the index
@@ -45,3 +45,13 @@
Then /^I should see the following response body:$/ do |response_body|
page.should have_css("div.response.body", :text => response_body)
end
+
+Then /^I should see the api name "(.*?)"$/ do |name|
+ within("title") do
+ page.should have_content(name)
+ end
+
+ within(".container h1") do
+ page.should have_content(name)
+ end
+end
@@ -58,6 +58,7 @@ def self.add_setting(name, opts = {})
add_setting :curl_host, :default => nil
add_setting :keep_source_order, :default => false
+ add_setting :api_name, :default => "API Documentation"
def settings
@settings ||= {}
@@ -35,6 +35,10 @@ def initialize(index, configuration)
self.template_path = configuration.template_path
end
+ def api_name
+ @configuration.api_name
+ end
+
def sections
IndexWriter.sections(examples, @configuration)
end
@@ -35,6 +35,10 @@ def initialize(index, configuration)
self.template_path = configuration.template_path
end
+ def api_name
+ @configuration.api_name
+ end
+
def sections
IndexWriter.sections(examples, @configuration)
end
@@ -51,6 +51,7 @@
its(:curl_host) { should be_nil }
its(:url_prefix) { should be_blank }
its(:keep_source_order) { should be_false }
+ its(:api_name) { should == "API Documentation" }
end
describe "#define_groups" do
@@ -1,12 +1,12 @@
<!DOCTYPE html>
<html>
<head>
- <title>API Documentation</title>
+ <title>{{ api_name }}</title>
<link rel="stylesheet" href="{{ url_prefix }}/assets/stylesheets/bootstrap.css"/>
</head>
<body>
<div class="container">
- <h1>API Documentation</h1>
+ <h1>{{ api_name }}</h1>
{{# sections }}
<div class="article">
@@ -1,12 +1,12 @@
<!DOCTYPE html>
<html>
<head>
- <title>API Documentation</title>
+ <title>{{ api_name }}</title>
<link rel="stylesheet" href="{{ url_prefix }}/assets/stylesheets/bootstrap.css"/>
</head>
<body>
<div class="container">
- <h1>API Documentation</h1>
+ <h1>{{ api_name }}</h1>
{{# sections }}
<div class="article">

0 comments on commit 7db5d1c

Please sign in to comment.