Skip to content

Commit 7fb46d1

Browse files
authored
Merge pull request #27 from patch-technology/lovisa/fix-sdg
Fix thrown error when calling Patch::Sdg
2 parents 1d7dd06 + 93f8919 commit 7fb46d1

File tree

5 files changed

+27
-2
lines changed

5 files changed

+27
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.5.1] - 2021-03-02
9+
10+
### Fixed
11+
12+
- Fixed a `NameError` that was thrown when `Patch::Sdg` was called. Specs have been added to ensure this does not happen again.
13+
814
## [1.5.0] - 2021-03-01
915

1016
### Changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
patch_ruby (1.4.0)
4+
patch_ruby (1.5.1)
55
json (~> 2.1, >= 2.1.0)
66
typhoeus (~> 1.0, >= 1.0.1)
77

lib/patch_ruby.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
require 'patch_ruby/models/project'
3737
require 'patch_ruby/models/project_list_response'
3838
require 'patch_ruby/models/project_response'
39+
require 'patch_ruby/models/sdg'
3940
require 'patch_ruby/models/standard'
4041

4142
# APIs

lib/patch_ruby/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
=end
1212

1313
module Patch
14-
VERSION = '1.5.0'
14+
VERSION = '1.5.1'
1515
end

spec/patch_ruby_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
describe Patch do
2+
context 'Models' do
3+
it 'defines all models' do
4+
constants.each do |constant|
5+
expect { Patch.const_get(constant) }.not_to raise_error
6+
end
7+
end
8+
end
9+
10+
def constants
11+
# Given a file path return the constant of that path, for example:
12+
# 'lib/patch_ruby/models/project_response.rb' -> ProjectResponse
13+
Dir.glob("lib/patch_ruby/models/*.rb").map do |file|
14+
parsed_filename = file.split('/').last.split('.').first
15+
constant = parsed_filename.split('_').map(&:capitalize).join('')
16+
end
17+
end
18+
end

0 commit comments

Comments
 (0)