-
Notifications
You must be signed in to change notification settings - Fork 2
Fix thrown error when calling Patch::Sdg #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| PATH | ||
| remote: . | ||
| specs: | ||
| patch_ruby (1.4.0) | ||
| patch_ruby (1.5.1) | ||
| json (~> 2.1, >= 2.1.0) | ||
| typhoeus (~> 1.0, >= 1.0.1) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,5 +11,5 @@ | |
| =end | ||
|
|
||
| module Patch | ||
| VERSION = '1.5.0' | ||
| VERSION = '1.5.1' | ||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| describe Patch do | ||
| context 'Models' do | ||
| it 'defines all models' do | ||
| constants.each do |constant| | ||
| expect { Patch.const_get(constant) }.not_to raise_error | ||
| end | ||
| end | ||
| end | ||
|
|
||
| def constants | ||
| # Given a file path return the constant of that path, for example: | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All recommendations on how to achieve this in a smoother way is welcome. I'm sure there's a more straightforward approach to this that I can't think of right now.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That looks pretty OK for now! Let's do a survey of other SDKs a bit later for best practices? |
||
| # 'lib/patch_ruby/models/project_response.rb' -> ProjectResponse | ||
| Dir.glob("lib/patch_ruby/models/*.rb").map do |file| | ||
| parsed_filename = file.split('/').last.split('.').first | ||
| constant = parsed_filename.split('_').map(&:capitalize).join('') | ||
| end | ||
| end | ||
| end | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The model wasn't required, which caused the error.