|
| 1 | +require File.expand_path('../../test_helper', __FILE__) |
| 2 | + |
| 3 | +module Checkr |
| 4 | + class VerificationTest < Test::Unit::TestCase |
| 5 | + setup do |
| 6 | + @report = Report.construct(test_report) |
| 7 | + @verification_url = "#{Checkr.api_base}#{@report.path}/verifications" |
| 8 | + end |
| 9 | + |
| 10 | + context 'Constructed Verification instance' do |
| 11 | + setup do |
| 12 | + @verification = Verification.construct(test_verification) |
| 13 | + end |
| 14 | + |
| 15 | + should 'have the id attribute' do |
| 16 | + assert_equal(test_verification[:id], @verification.id) |
| 17 | + end |
| 18 | + |
| 19 | + should 'have the object attribute' do |
| 20 | + assert_equal(test_verification[:object], @verification.object) |
| 21 | + end |
| 22 | + |
| 23 | + should 'have the uri attribute' do |
| 24 | + assert_equal(test_verification[:uri], @verification.uri) |
| 25 | + end |
| 26 | + |
| 27 | + should 'have the created_at attribute' do |
| 28 | + assert_equal(test_verification[:created_at], @verification.created_at) |
| 29 | + end |
| 30 | + |
| 31 | + should 'have the completed_at attribute' do |
| 32 | + assert_equal(test_verification[:completed_at], @verification.completed_at) |
| 33 | + end |
| 34 | + |
| 35 | + should 'have the verification_type attribute' do |
| 36 | + assert_equal(test_verification[:verification_type], @verification.verification_type) |
| 37 | + end |
| 38 | + |
| 39 | + should 'have the verification_url attribute' do |
| 40 | + assert_equal(test_verification[:verification_url], @verification.verification_url) |
| 41 | + end |
| 42 | + end |
| 43 | + |
| 44 | + context '#all' do |
| 45 | + should 'return instances of Verification' do |
| 46 | + @mock.expects(:get).once.with(@verification_url, anything, anything) |
| 47 | + .returns(test_response(test_verification_list)) |
| 48 | + assert_equal(@report.verifications.all.first.class, Verification) |
| 49 | + end |
| 50 | + end |
| 51 | + |
| 52 | + should 'be registered' do |
| 53 | + assert(APIClass.subclasses.include?(Verification)) |
| 54 | + assert_equal(Verification, APIClass.subclass_fetch('verification')) |
| 55 | + end |
| 56 | + |
| 57 | + end |
| 58 | +end |
0 commit comments