Skip to content

Commit 97c129d

Browse files
authored
Merge pull request #359 from llenodo/master
Change Json classnames to JSON
2 parents f2945e4 + 72372ad commit 97c129d

File tree

7 files changed

+17
-14
lines changed

7 files changed

+17
-14
lines changed

lib/rspec_api_documentation.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module Writers
3737
autoload :HtmlWriter
3838
autoload :TextileWriter
3939
autoload :MarkdownWriter
40-
autoload :JsonWriter
40+
autoload :JSONWriter
4141
autoload :AppendJsonWriter
4242
autoload :JsonIodocsWriter
4343
autoload :IndexHelper

lib/rspec_api_documentation/api_documentation.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require 'rspec_api_documentation/writers/json_iodocs_writer'
2+
13
module RspecApiDocumentation
24
class ApiDocumentation
35
attr_reader :configuration, :index

lib/rspec_api_documentation/writers/combined_json_writer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def write
77
File.open(configuration.docs_dir.join("combined.json"), "w+") do |f|
88
examples = []
99
index.examples.each do |rspec_example|
10-
examples << Formatter.to_json(JsonExample.new(rspec_example, configuration))
10+
examples << Formatter.to_json(JSONExample.new(rspec_example, configuration))
1111
end
1212

1313
f.write "["

lib/rspec_api_documentation/writers/json_iodocs_writer.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def sections
3232
end
3333

3434
def examples
35-
@index.examples.map { |example| JsonExample.new(example, @configuration) }
35+
@index.examples.map { |example| JsonIodocsExample.new(example, @configuration) }
3636
end
3737

3838
def as_json(opts = nil)
@@ -48,7 +48,7 @@ def as_json(opts = nil)
4848
end
4949
end
5050

51-
class JsonExample
51+
class JsonIodocsExample
5252
def initialize(example, configuration)
5353
@example = example
5454
end

lib/rspec_api_documentation/writers/json_writer.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
module RspecApiDocumentation
44
module Writers
5-
class JsonWriter < Writer
5+
class JSONWriter < Writer
66
delegate :docs_dir, :to => :configuration
77

88
def write
99
File.open(docs_dir.join("index.json"), "w+") do |f|
10-
f.write Formatter.to_json(JsonIndex.new(index, configuration))
10+
f.write Formatter.to_json(JSONIndex.new(index, configuration))
1111
end
1212
write_examples
1313
end
1414

1515
def write_examples
1616
index.examples.each do |example|
17-
json_example = JsonExample.new(example, configuration)
17+
json_example = JSONExample.new(example, configuration)
1818
FileUtils.mkdir_p(docs_dir.join(json_example.dirname))
1919
File.open(docs_dir.join(json_example.dirname, json_example.filename), "w+") do |f|
2020
f.write Formatter.to_json(json_example)
@@ -23,7 +23,7 @@ def write_examples
2323
end
2424
end
2525

26-
class JsonIndex
26+
class JSONIndex
2727
def initialize(index, configuration)
2828
@index = index
2929
@configuration = configuration
@@ -34,7 +34,7 @@ def sections
3434
end
3535

3636
def examples
37-
@index.examples.map { |example| JsonExample.new(example, @configuration) }
37+
@index.examples.map { |example| JSONExample.new(example, @configuration) }
3838
end
3939

4040
def as_json(opts = nil)
@@ -61,7 +61,7 @@ def section_hash(section)
6161
end
6262
end
6363

64-
class JsonExample
64+
class JSONExample
6565
def initialize(example, configuration)
6666
@example = example
6767
@host = configuration.curl_host

spec/writers/json_example_spec.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
# -*- coding: utf-8 -*-
22
require 'spec_helper'
3+
require 'rspec_api_documentation/writers/json_writer'
34

4-
describe RspecApiDocumentation::Writers::JsonExample do
5+
describe RspecApiDocumentation::Writers::JSONExample do
56
let(:configuration) { RspecApiDocumentation::Configuration.new }
67

78
describe "#dirname" do
89
it "strips out leading slashes" do
910
example = double(resource_name: "/test_string")
1011

1112
json_example =
12-
RspecApiDocumentation::Writers::JsonExample.new(example, configuration)
13+
RspecApiDocumentation::Writers::JSONExample.new(example, configuration)
1314

1415
expect(json_example.dirname).to eq "test_string"
1516
end
@@ -18,7 +19,7 @@
1819
example = double(resource_name: "test_string/test")
1920

2021
json_example =
21-
RspecApiDocumentation::Writers::JsonExample.new(example, configuration)
22+
RspecApiDocumentation::Writers::JSONExample.new(example, configuration)
2223

2324
expect(json_example.dirname).to eq "test_string/test"
2425
end

spec/writers/json_writer_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'spec_helper'
22

3-
describe RspecApiDocumentation::Writers::JsonWriter do
3+
describe RspecApiDocumentation::Writers::JSONWriter do
44
let(:index) { RspecApiDocumentation::Index.new }
55
let(:configuration) { RspecApiDocumentation::Configuration.new }
66

0 commit comments

Comments
 (0)