require 'spec_helper'

describe "Profile Menu", :js => true, :type => :feature, :capybara_feature => true  do

  subject { page }

  before(:all) do
    Capybara.javascript_driver = :poltergeist
    Capybara.current_driver = Capybara.javascript_driver
    Capybara.default_wait_time = 10
  end

  let(:user) { FactoryGirl.create(:user) }

  before(:each) do
    UserMailer.deliveries.clear
    sign_in_poltergeist user
    visit "/"
    find('h2', text: 'musicians')
  end

  describe "Invite more Users" do

    before(:each) do
      find('.sidebar .invite-friend-row').hover
      find('.sidebar .invitation-button-holder')
    end

    it { should have_selector('.friend-name',    text: 'Invite More Friends') }

    describe "try to invite" do
      before(:each) do
        find('.sidebar .btn-email-invitation').trigger(:click)
      end
      it {should have_selector('label',    text: 'Enter email address(es). If multiple addresses, separate with commas.')}
    end
  end


end
