Sha256: 732cc40186bbe1854f047fe32e85f139b4bddae306cb8bc85dff2c5c93922399
Contents?: true
Size: 1.27 KB
Versions: 6
Compression:
Stored size: 1.27 KB
Contents
require 'spec_helper' describe Medivo::Appointment do let(:lab_code) { 20060 } describe "with valid data" do let(:all_times) { ["11/03/2011|08:30 AM", "11/04/2011|08:30 AM", "11/04/2011|08:30 PM"] } let(:body) { {'times'=> all_times} } def returned_times(date, am_pm) Timecop.freeze(Time.strptime(date, "%m/%d/%Y")) stub_appointment_request(lab_code, date, am_pm, body) value = Medivo::Appointment.find(lab_code, date, am_pm) Timecop.return return value['times'] end it "returns times" do returned_times('11/01/2011', '').should == all_times end it "filters out past date times" do returned_times('11/04/2011', '').should == all_times.slice(1,2) end it "filters out past or pm times" do returned_times('11/04/2011', 'AM').should == ["11/04/2011|08:30 AM"] end it "filters out past or am times" do returned_times('11/04/2011', 'PM').should == ["11/04/2011|08:30 PM"] end end describe "with invalid request returns error message" do let(:body) { {'message'=> "invalid data"} } it "for status 400" do date = '11/01/2011' stub_appointment_request(lab_code, date, '', body, 400) expect { Medivo::Appointment.find(lab_code, date) }.to raise_error end end end
Version data entries
6 entries across 6 versions & 1 rubygems