From e251a21f8ff64a671b58357cabf91a789669d734 Mon Sep 17 00:00:00 2001 From: capripot Date: Fri, 19 Jan 2018 14:50:43 -0800 Subject: [PATCH] Fix packages --- Changelog.md | 2 +- lib/checkr/package.rb | 2 +- lib/checkr/program.rb | 1 - lib/checkr/version.rb | 2 +- test/checkr/package_test.rb | 8 ++++++++ test/checkr/program_test.rb | 16 ++++++++-------- test/test_data.rb | 14 ++++++++++++++ 7 files changed, 33 insertions(+), 12 deletions(-) diff --git a/Changelog.md b/Changelog.md index 3be65f3..40c106e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,4 +1,4 @@ -## 1.3.0 (2018-01-19) +## 1.3.1 (2018-01-19) Features: diff --git a/lib/checkr/package.rb b/lib/checkr/package.rb index fef44d4..089bdbe 100644 --- a/lib/checkr/package.rb +++ b/lib/checkr/package.rb @@ -6,7 +6,7 @@ class Package < APIResource attribute :price attribute :screenings - api_class_method :all, :get, :constructor => APIList.constructor(:Geo) + api_class_method :all, :get, :constructor => APIList.constructor(:Package) api_class_method :retrieve, :get, ":path/:id", :arguments => [:id] api_class_method :create, :post diff --git a/lib/checkr/program.rb b/lib/checkr/program.rb index ac7ab63..c64d235 100644 --- a/lib/checkr/program.rb +++ b/lib/checkr/program.rb @@ -11,7 +11,6 @@ class Program < APIResource api_class_method :all, :get, :constructor => APIList.constructor(:Program) api_class_method :retrieve, :get, ":path/:id", :arguments => [:id] - api_class_method :create, :post def self.path "/v1/programs" diff --git a/lib/checkr/version.rb b/lib/checkr/version.rb index 75516c6..f092467 100644 --- a/lib/checkr/version.rb +++ b/lib/checkr/version.rb @@ -1,3 +1,3 @@ module Checkr - VERSION = '1.3.0'.freeze + VERSION = '1.3.1'.freeze end diff --git a/test/checkr/package_test.rb b/test/checkr/package_test.rb index 1272134..d4e0edd 100644 --- a/test/checkr/package_test.rb +++ b/test/checkr/package_test.rb @@ -73,6 +73,14 @@ class PackageTest < Test::Unit::TestCase end end + context '#all' do + should 'return instances of Package' do + @mock.expects(:get).once.with(@package_url, anything, anything) + .returns(test_response(test_package_list)) + assert_equal(Package.all.first.class, Package) + end + end + should 'be registered' do assert(APIClass.subclasses.include?(Package)) assert_equal(Package, APIClass.subclass_fetch('package')) diff --git a/test/checkr/program_test.rb b/test/checkr/program_test.rb index 1b9997e..86052a8 100644 --- a/test/checkr/program_test.rb +++ b/test/checkr/program_test.rb @@ -14,14 +14,6 @@ class ProgramTest < Test::Unit::TestCase program = Program.retrieve(id) assert(program.is_a?(Program)) end - - should 'be createable' do - @mock.expects(:post).once.with(@program_url, anything, test_program) - .returns(test_response(test_program)) - program = Program.create(test_program) - assert(program.is_a?(Program)) - assert_equal(program.id, test_program[:id]) - end end context 'Program instance' do @@ -80,6 +72,14 @@ class ProgramTest < Test::Unit::TestCase end end + context '#all' do + should 'return instances of Program' do + @mock.expects(:get).once.with(@program_url, anything, anything) + .returns(test_response(test_program_list)) + assert_equal(Program.all.first.class, Program) + end + end + should 'be registered' do assert(APIClass.subclasses.include?(Program)) assert_equal(Program, APIClass.subclass_fetch('program')) diff --git a/test/test_data.rb b/test/test_data.rb index 9bd139f..8fe52a4 100644 --- a/test/test_data.rb +++ b/test/test_data.rb @@ -140,6 +140,13 @@ def test_package :subtype=>"7years"}]} end + def test_package_list + { + :object => 'list', + :data => [test_package, test_package, test_package], + } + end + def test_program {:id=>"e44aa283528e6fde7d542194", :object=>"program", @@ -150,6 +157,13 @@ def test_program :package_ids=>["a57a0cd15965a585ff7d5d35"]} end + def test_program_list + { + :object => 'list', + :data => [test_program, test_program, test_program], + } + end + def test_ssn_trace {:id=>"539fd88c101897f7cd000001", :object=>"ssn_trace",