Sha256: a20a398d062cb0c8947712f18d94ffebf588eb643d895840e992bc0066f89dae
Contents?: true
Size: 1.91 KB
Versions: 2
Compression:
Stored size: 1.91 KB
Contents
require 'spec_helper' describe CareerBuilder::Client do describe "#authenticate" do context "with valid credentials" do before do stub_request(:post, "http://ws.careerbuilder.com/resumes/resumes.asmx/BeginSessionV2").with(:body => 'Packet=%3cPacket%3e%3cEmail%3evalid_email%3c%2fEmail%3e%3cPassword%3evalid_password%3c%2fPassword%3e%3c%2fPacket%3e').to_return(:body => "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<string xmlns=\"http://ws.careerbuilder.com/resumes/\"><Packet><Errors /><SessionToken>42df77a98a874c6ca8644cf8e8ceffa6-330779842-RY-4</SessionToken></Packet></string>") @client = CareerBuilder::Client.new("valid_email", "valid_password") end it 'should return true' do @client.authenticate.should be_true end it 'should be authenticated' do @client.authenticate @client.should be_authenticated end end context "with invalid credentials" do before do stub_request(:post, "http://ws.careerbuilder.com/resumes/resumes.asmx/BeginSessionV2").with(:body => 'Packet=%3cPacket%3e%3cEmail%3evalid_email%3c%2fEmail%3e%3cPassword%3einvalid_password%3c%2fPassword%3e%3c%2fPacket%3e').to_return(:body => "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<string xmlns=\"http://ws.careerbuilder.com/resumes/\"><Packet><Errors><CBError><Code>300</Code><Text>300|Email (ryan@recruitmilitary.com) and password (AZG24N4) could not be validated.</Text></CBError></Errors><SessionToken>Invalid</SessionToken></Packet></string>") @client = CareerBuilder::Client.new("valid_email", "invalid_password") end it 'should return false' do @client.authenticate.should be_false end it 'should not be authenticated' do @client.authenticate @client.should_not be_authenticated end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
career_builder-0.2.2 | spec/career_builder/client/authentication_spec.rb |
career_builder-0.2.1 | spec/career_builder/client/authentication_spec.rb |