Skip to content

Commit

Permalink
update bundler gemspec, travis and add couple tests
Browse files Browse the repository at this point in the history
  • Loading branch information
radamson committed Feb 11, 2019
1 parent 6ef4236 commit 4196066
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
language: ruby
rvm:
- 2.2
- 2.3
- 2.4
- 2.5
- 2.6
before_install:
- gem update --system
- gem install bundler
Expand Down
2 changes: 1 addition & 1 deletion fhir_client.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
spec.add_dependency 'rest-client', '~> 2.0'
spec.add_dependency 'tilt', '>= 1.1'

spec.add_development_dependency 'bundler', '~> 1.13'
spec.add_development_dependency 'bundler', '~> 2.0'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'pry'
spec.add_development_dependency 'webmock'
Expand Down
28 changes: 26 additions & 2 deletions test/unit/model_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class TestUnitCustomException < ClientException ; end

class ModelTest < Test::Unit::TestCase

def test_default_exception
def test_default_instance_exception
stub_request(:post, /create/).to_return(status: 403, body: "")
client = FHIR::Client.new('create')
client.default_json
Expand All @@ -15,7 +15,7 @@ def test_default_exception
end
end

def test_custom_exception
def test_custom_instance_exception
stub_request(:post, /create/).to_return(status: 403, body: "")
client = FHIR::Client.new('create')
client.default_json
Expand All @@ -26,5 +26,29 @@ def test_custom_exception
FHIR::Patient.new({'id':'foo'}).create
end
end

def test_default_class_exception
stub_request(:post, /create/).to_return(status: 403, body: "")
client = FHIR::Client.new('create')
client.default_json
FHIR::Model.client = client

assert_raise ClientException do
FHIR::Patient.create({'id':'foo'})
end
end

def test_custom_class_exception
stub_request(:post, /create/).to_return(status: 403, body: "")
client = FHIR::Client.new('create')
client.default_json
client.exception_class = TestUnitCustomException
FHIR::Model.client = client

assert_raise TestUnitCustomException do
FHIR::Patient.create({'id':'foo'})
end
end

end

0 comments on commit 4196066

Please sign in to comment.