Sha256: c31fc5789614abd773d51a00013d07c21ecc6f42368c3cdf7879863f4e4ff607

Contents?: true

Size: 1.88 KB

Versions: 6

Compression:

Stored size: 1.88 KB

Contents

require 'spec_helper'

describe 'LabController' do

  before do
    WebMock.allow_net_connect!
  end

  describe "showing lab list and map" do

    before do
      @zip_code = "90210"
      stub(Medivo::Lab).findLabs(@zip_code) { [BeverlyHillsLab1, BeverlyHillsLab2] }
    end

    it "/labs/data returns lab and zip data as json" do
      visit Medivo::Engine.routes.url_helpers.data_labs_path :zip_code => @zip_code
      # can't seem to get json back .. just html .. but it works in rails server just fine
      # so testing for the string will have to do for now
      page.body.should match /#{BeverlyHillsLab1.name}/i
      page.body.should match /#{BeverlyHillsLab2.name}/i
    end

    it "/labs/search shows search results on the map and list", :js=>true, :driver=>:selenium_chrome do
      visit search_labs_path :zip_code=>@zip_code
      page.body.should match /465 N ROXBURY DR STE 715, BEVERLY HILLS, CA/i
      page.body.should match /8737 BEVERLY BLVD STE 401, LOS ANGELES, CA/i
    end
  end

  describe "making appointments" do

    before do
      @lab_code = "20060"
      @date = "11/01/2011"
      @am_pm = ''
    end

    it "/labs/appointments returns appointment data as json" do
      body = {'time'=> ["11/03/2011|08:30 AM", "11/04/2011|08:30 AM"]}
      stub(Medivo::Appointment).find(@lab_code, @date, nil) { body }
      visit Medivo::Engine.routes.url_helpers.data_appointments_path :lab_code=>@lab_code, :date=>@date
      page.body.should match "08:30 AM"
    end

    #it "/labs/appointments returns appointment data as json", :js=>true, :driver=>:selenium_chrome  do
    #  body = {'time'=> ["11/03/2011|08:30 AM", "11/04/2011|08:30 AM"]}
    #  stub(Medivo::Appointment).find(@lab_code, @date, nil) { body }
    #  visit Medivo::Engine.routes.url_helpers.data_appointments_path :lab_code=>@lab_code, :appointment_date=>@date
    #  page.body.should match "08:30 AM"
    #end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
medivo-0.2.7 spec/requests/labs_spec.rb
medivo-0.2.6 spec/requests/labs_spec.rb
medivo-0.2.5 spec/requests/labs_spec.rb
medivo-0.2.3 spec/requests/labs_spec.rb
medivo-0.2.2 spec/requests/labs_spec.rb
medivo-0.2.1 spec/requests/labs_spec.rb