require 'spec_helper' describe Medlink::User do describe ":search" do context "valid token" do before(:each) do VCR.use_cassette "users/search/julien" do @searched_user = Medlink::User.search(first_name: "Julien", last_name: "Vibert").first end end it { expect(@searched_user.ecn_ranking).to eq(1) } it { expect(@searched_user.ecn_year).to eq(2015) } it { expect(@searched_user.internat_end_year).to eq(2020) } it { expect(@searched_user.first_name).to eq("Julien") } it { expect(@searched_user.last_name).to eq("Vibert") } it { expect(@searched_user.birthdate).to eq Date.new(1990, 7, 16) } it { expect(@searched_user.speciality.name).to eq("Oncologie médicale") } it { expect(@searched_user.city.name).to eq("Paris") } it { expect(@searched_user.profession.name).to eq("Interne") } it { expect(@searched_user.profession.code).to eq(5) } end context "valid token" do before(:each) do VCR.use_cassette "users/search/william" do @searched_user = Medlink::User.search(first_name: "William", last_name: "Eclancher").first end end it { expect(@searched_user.ecn_ranking).to be_nil } it { expect(@searched_user.ecn_year).to be_nil } it { expect(@searched_user.internat_end_year).to be_nil } it { expect(@searched_user.first_name).to eq("William") } it { expect(@searched_user.last_name).to eq("Eclancher") } it { expect(@searched_user.birthdate).to be_nil } it { expect(@searched_user.speciality.name).to eq("Spécialiste en Médecine Générale") } it { expect(@searched_user.city).to be_nil } it { expect(@searched_user.profession.name).to eq("Médecin") } it { expect(@searched_user.profession.code).to eq(10) } it { expect(@searched_user.institutions.first.name).to eq("CABINET DU DR WILLIAM ECLANCHER") } end end end