Skip to content

Commit

Permalink
Merge pull request #142 from fhir-crucible/get-when-flag-false
Browse files Browse the repository at this point in the history
Add test to make sure that GETs are issued when search flag is false
  • Loading branch information
arscan authored Apr 30, 2021
2 parents e0f0d44 + 1684fb5 commit 94bbf4b
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 23 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Ruby

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['2.6', '2.7']

steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run tests
run: bundle exec rake
- name: Rubocop
run: bundle exec rubocop
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ task :rubocop do
RuboCop::RakeTask.new
end

task test: [:rubocop] do
task :test do
system('open coverage/index.html')
end

Expand Down
2 changes: 1 addition & 1 deletion lib/fhir_client/sections/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def search(klass, options = {}, format = @default_format)
options[:resource] = klass
options[:format] = format

reply = if options.dig(:search, :flag).nil? && options.dig(:search, :body).nil?
reply = if options.dig(:search, :flag) != true && options.dig(:search, :body).nil?
get resource_url(options), fhir_headers
else
options[:search][:flag] = true
Expand Down
2 changes: 1 addition & 1 deletion lib/fhir_client/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module FHIR
class Client
VERSION = '4.0.5'.freeze
VERSION = '4.0.6'.freeze
end
end
20 changes: 20 additions & 0 deletions test/unit/client_interface_sections/search_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,26 @@ def test_get_search
)
assert_requested(search_response)
end

def test_get_search_flag_false
search_response = stub_request(:get, 'http://search-test/Patient?address=123%20Sesame%20Street&given=name').
to_return(empty_search_response)

reply = @client.search(
FHIR::Patient,
{
search: {
flag: false,
parameters: {
given: 'name',
address: '123 Sesame Street'
}
}
}
)
assert_requested(search_response)
end

def test_post_search
search_body = {
given: 'name',
Expand Down

0 comments on commit 94bbf4b

Please sign in to comment.