require 'spec_helper'

describe 'A logged customer visiting the mentors page' do
  let(:customer) { create :customer, name: 'Jhon Doe', email: 'jhon@foobar.com' }
  describe 'should view a list of mentors' do

    before do
      login_as_user customer
      click_link 'Mentor'
    end

    it "should have your mentors link" do
      click_link 'Your mentors'
      current_path.should eq customer_mentors_path
    end

    it "should have find mentor and the mentor name", :js => true do

      mentor1 = create :mentor
      mentor2 = build :mentor, availability_defaults: nil, searchable: false

      click_link 'Find a mentor'
      current_path.should eq search_customer_mentors_path
      page.should have_content mentor1.name
      page.should_not have_content mentor2.name
    end
  end
end
