Skip to content

Commit 1b58235

Browse files
committed
refactoring generator spec
1 parent 6a20c25 commit 1b58235

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

.hound.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ruby:
2+
config_file: .rubocop.yml

.rubocop.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Style/IfUnlessModifier:
2+
MaxLineLength: 120
3+
Style/WhileUntilModifier:
4+
MaxLineLength: 120
5+
Metrics/LineLength:
6+
Max: 120
7+
Style/FrozenStringLiteralComment:
8+
Enabled: false

spec/generators/apidoco_generator_spec.rb

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
require "rails/generators"
2-
require "generators/apidoco_generator"
3-
require "generator_spec"
1+
require 'rails/generators'
2+
require 'generators/apidoco_generator'
3+
require 'generator_spec'
44

55
describe ApidocoGenerator, type: :generator do
66
def remove_docs_directory
@@ -12,20 +12,20 @@ def remove_docs_directory
1212
end
1313

1414
context 'default actions' do
15-
it "creates a crud documentation files" do
15+
it 'creates a crud documentation files' do
1616
run_generator %w(api/v1/posts)
17-
assert_file "#{Rails.root}/docs/api/v1/posts/create.json", /api\/v1\/posts.json/
18-
assert_file "#{Rails.root}/docs/api/v1/posts/destroy.json", /api\/v1\/posts\/:id.json/
19-
assert_file "#{Rails.root}/docs/api/v1/posts/index.json", /api\/v1\/posts.json/
20-
assert_file "#{Rails.root}/docs/api/v1/posts/show.json", /api\/v1\/posts\/:id.json/
21-
assert_file "#{Rails.root}/docs/api/v1/posts/update.json", /api\/v1\/posts\/:id.json/
17+
assert_file "#{Rails.root}/docs/api/v1/posts/create.json", %r{api/v1/posts.json}
18+
assert_file "#{Rails.root}/docs/api/v1/posts/destroy.json", %r{api/v1/posts/:id.json}
19+
assert_file "#{Rails.root}/docs/api/v1/posts/index.json", %r{api/v1/posts.json}
20+
assert_file "#{Rails.root}/docs/api/v1/posts/show.json", %r{api/v1/posts/:id.json}
21+
assert_file "#{Rails.root}/docs/api/v1/posts/update.json", %r{api/v1/posts/:id.json}
2222
end
2323
end
2424

2525
context 'custom actions' do
2626
let(:upload_acton) { 'upload' }
2727

28-
it "creates the documentation files for the actions supplied in arguments" do
28+
it 'creates the documentation files for the actions supplied in arguments' do
2929
run_generator ['api/v1/posts', upload_acton]
3030

3131
assert_file "#{Rails.root}/docs/api/v1/posts/#{upload_acton}.json"

0 commit comments

Comments
 (0)