Skip to content

Commit 4ea45a0

Browse files
authored
Merge pull request #38 from checkr/fix-package-return-packages
Fix packages
2 parents a7779b9 + e251a21 commit 4ea45a0

File tree

7 files changed

+33
-12
lines changed

7 files changed

+33
-12
lines changed

Changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 1.3.0 (2018-01-19)
1+
## 1.3.1 (2018-01-19)
22

33
Features:
44

lib/checkr/package.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Package < APIResource
66
attribute :price
77
attribute :screenings
88

9-
api_class_method :all, :get, :constructor => APIList.constructor(:Geo)
9+
api_class_method :all, :get, :constructor => APIList.constructor(:Package)
1010
api_class_method :retrieve, :get, ":path/:id", :arguments => [:id]
1111
api_class_method :create, :post
1212

lib/checkr/program.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ class Program < APIResource
1111

1212
api_class_method :all, :get, :constructor => APIList.constructor(:Program)
1313
api_class_method :retrieve, :get, ":path/:id", :arguments => [:id]
14-
api_class_method :create, :post
1514

1615
def self.path
1716
"/v1/programs"

lib/checkr/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Checkr
2-
VERSION = '1.3.0'.freeze
2+
VERSION = '1.3.1'.freeze
33
end

test/checkr/package_test.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ class PackageTest < Test::Unit::TestCase
7373
end
7474
end
7575

76+
context '#all' do
77+
should 'return instances of Package' do
78+
@mock.expects(:get).once.with(@package_url, anything, anything)
79+
.returns(test_response(test_package_list))
80+
assert_equal(Package.all.first.class, Package)
81+
end
82+
end
83+
7684
should 'be registered' do
7785
assert(APIClass.subclasses.include?(Package))
7886
assert_equal(Package, APIClass.subclass_fetch('package'))

test/checkr/program_test.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@ class ProgramTest < Test::Unit::TestCase
1414
program = Program.retrieve(id)
1515
assert(program.is_a?(Program))
1616
end
17-
18-
should 'be createable' do
19-
@mock.expects(:post).once.with(@program_url, anything, test_program)
20-
.returns(test_response(test_program))
21-
program = Program.create(test_program)
22-
assert(program.is_a?(Program))
23-
assert_equal(program.id, test_program[:id])
24-
end
2517
end
2618

2719
context 'Program instance' do
@@ -80,6 +72,14 @@ class ProgramTest < Test::Unit::TestCase
8072
end
8173
end
8274

75+
context '#all' do
76+
should 'return instances of Program' do
77+
@mock.expects(:get).once.with(@program_url, anything, anything)
78+
.returns(test_response(test_program_list))
79+
assert_equal(Program.all.first.class, Program)
80+
end
81+
end
82+
8383
should 'be registered' do
8484
assert(APIClass.subclasses.include?(Program))
8585
assert_equal(Program, APIClass.subclass_fetch('program'))

test/test_data.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,13 @@ def test_package
140140
:subtype=>"7years"}]}
141141
end
142142

143+
def test_package_list
144+
{
145+
:object => 'list',
146+
:data => [test_package, test_package, test_package],
147+
}
148+
end
149+
143150
def test_program
144151
{:id=>"e44aa283528e6fde7d542194",
145152
:object=>"program",
@@ -150,6 +157,13 @@ def test_program
150157
:package_ids=>["a57a0cd15965a585ff7d5d35"]}
151158
end
152159

160+
def test_program_list
161+
{
162+
:object => 'list',
163+
:data => [test_program, test_program, test_program],
164+
}
165+
end
166+
153167
def test_ssn_trace
154168
{:id=>"539fd88c101897f7cd000001",
155169
:object=>"ssn_trace",

0 commit comments

Comments
 (0)