-
Notifications
You must be signed in to change notification settings - Fork 463
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disables FrozenStringLiteralComment rule (#840)
* Disables FrozenStringLiteralComment rule Why https://github.com/testdouble/standard#why-arent-frozen_string_literal-true-magic-comments-enforced * Pass error message to constructor instead of overriding `#to_s` `Exception#to_s` returns the given message, we can pass the error message to constructor instead of overriding the method. This will also fix the Rubocop offenses. * Exclude files from MissingSuper
- Loading branch information
1 parent
2fc6aca
commit d5cd745
Showing
4 changed files
with
63 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require 'spec_helper' | ||
|
||
describe Apipie::NoDocumentedMethod do | ||
let(:error) { described_class.new(controller_name, method_name) } | ||
let(:controller_name) { 'UserController' } | ||
let(:method_name) { 'index' } | ||
|
||
describe '#to_s' do | ||
subject { error.to_s } | ||
|
||
let(:error_message) do | ||
"There is no documented method #{controller_name}##{method_name}" | ||
end | ||
|
||
it { is_expected.to eq(error_message) } | ||
end | ||
end |
35 changes: 35 additions & 0 deletions
35
spec/lib/apipie/response_does_not_match_swagger_schema_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
require 'spec_helper' | ||
|
||
describe Apipie::ResponseDoesNotMatchSwaggerSchema do | ||
let(:error) do | ||
described_class.new( | ||
controller_name, | ||
method_name, | ||
response_code, | ||
error_messages, | ||
schema, | ||
returned_object | ||
) | ||
end | ||
|
||
let(:controller_name) { 'UserController' } | ||
let(:method_name) { 'index' } | ||
let(:response_code) { 200 } | ||
let(:error_messages) { [] } | ||
let(:schema) { {} } | ||
let(:returned_object) { {} } | ||
|
||
describe '#to_s' do | ||
subject { error.to_s } | ||
|
||
let(:error_message) do | ||
<<~HEREDOC.chomp | ||
Response does not match swagger schema (#{controller_name}##{method_name} #{response_code}): #{error_messages} | ||
Schema: #{JSON(schema)} | ||
Returned object: #{returned_object} | ||
HEREDOC | ||
end | ||
|
||
it { is_expected.to eq(error_message) } | ||
end | ||
end |